Errors and Response Handling
When interacting with the Eden AI API, understanding how to handle responses is crucial for effective integration. This section provides insights into response formats, status codes, and error handling strategies.
Response Formats
Eden AI returns all responses in JSON format, ensuring consistency and ease of parsing across various programming languages. The structure of the JSON response varies depending on the specific API endpoint and the nature of the request. For detailed information on response types and their fields, refer to the API Reference.
Status Codes and Their Meanings
The API utilizes standard HTTP status codes to indicate the outcome of a request:
- 200 OK: The request was successful, and the server returned the requested data.
- 400 Bad Request: The server could not understand the request due to invalid syntax.
- 401 Unauthorized: Authentication failed or the user does not have the necessary permissions.
- 402 Payment required: You don't have enough credits. You can add more credits to your account here.
- 403 Forbidden: The server understands the request but refuses to authorize it. You now have configured "Authorization" correctly (Make sure you did not forget "Bearer" before your API token).
- 404 Not Found: The requested resource could not be found on the server. You may have made a mistake with the endpoint "URL".
- 429 Rate limit exceeded: You exceeded the number of requests per second you can do. You can see more details here.
- 500 Internal Server Error: The server encountered an unexpected condition that prevented it from fulfilling the request.
Updated about 1 month ago