The ZentyGents API uses conventional HTTP response codes to indicate success or failure of requests. All errors return a JSON object with an error message and code.
{
"success": false,
"error": {
"code": 404,
"message": "Resource not found"
}
}| Code | Description |
|---|---|
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Invalid API key |
| 403 | Forbidden - Insufficient permissions |
| 404 | Not Found - Resource not found |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Internal Server Error - Something went wrong |
try {
const balance = await client.wallets.getBalance(address);
} catch (error) {
if (error.response?.status === 404) {
console.error('Wallet not found');
} else if (error.response?.status === 429) {
console.error('Rate limit exceeded');
} else {
console.error('API Error:', error.message);
}
}