> ## Documentation Index
> Fetch the complete documentation index at: https://docs.yabetoopay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Error Handling

> Understand and handle API errors effectively.

The Yabetoo API uses conventional HTTP response codes to indicate the success or failure of an API request.

## HTTP Status Codes

| Code  | Status                | Description                   |
| ----- | --------------------- | ----------------------------- |
| `200` | OK                    | Request succeeded             |
| `201` | Created               | Resource created successfully |
| `400` | Bad Request           | Invalid request parameters    |
| `401` | Unauthorized          | Invalid or missing API key    |
| `403` | Forbidden             | Insufficient permissions      |
| `404` | Not Found             | Resource does not exist       |
| `429` | Too Many Requests     | Rate limit exceeded           |
| `500` | Internal Server Error | Server-side error             |

## Payment Error Codes

When a payment fails, the API returns specific error codes to help you understand what went wrong:

| Code                                                | Description                                                                                                                 |
| --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `LOW_BALANCE_OR_PAYEE_LIMIT_REACHED_OR_NOT_ALLOWED` | The customer has insufficient funds, has reached their transaction limit, or the transaction is not allowed by the operator |
| `TIMEOUT`                                           | The customer did not confirm the payment in time (did not enter their PIN)                                                  |

### Example Error Response

```json theme={null}
{
  "error": {
    "message": "LOW_BALANCE_OR_PAYEE_LIMIT_REACHED_OR_NOT_ALLOWED",
    "code": "LOW_BALANCE_OR_PAYEE_LIMIT_REACHED_OR_NOT_ALLOWED"
  }
}
```

## Best Practices

1. **Always handle errors gracefully** - Never expose raw error messages to end users
2. **Log errors for debugging** - Store error details for troubleshooting
3. **Implement retry logic** - For rate limits and temporary failures
4. **Validate before sending** - Check parameters client-side to reduce errors

<Note>
  If you encounter persistent errors, contact [support@yabetoopay.com](mailto:support@yabetoopay.com) with the error details.
</Note>
