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

# Error Handling

> How to handle errors with our API endpoints

Finvera’s API provides clear and structured error responses to help developers diagnose and resolve issues efficiently. Below is a breakdown of common errors, their meanings, and best practices for handling them.

### **Error Response Format**

All error responses follow a standardized JSON format:

```json theme={null}
{
  "error": {
    "code": 400,
    "message": "Invalid request parameters",
    "details": "The 'symbol' parameter is required"
  }
}
```

### Common Error Codes & Their Causes

| **HTTP Status Code**          | **Error Type**           | **Description**                                                                      |
| ----------------------------- | ------------------------ | ------------------------------------------------------------------------------------ |
| **400 Bad Request**           | Invalid Parameters       | The request contains malformed or missing parameters.                                |
| **401 Unauthorized**          | Invalid API Key          | Authentication is missing or incorrect. Ensure you include the Bearer token.         |
| **403 Forbidden**             | Insufficient Permissions | The request is valid but the API key does not have access to the requested resource. |
| **404 Not Found**             | Resource Not Found       | The requested endpoint or data does not exist.                                       |
| **429 Too Many Requests**     | Rate Limit Exceeded      | The request limit has been reached; slow down requests or upgrade your plan.         |
| **500 Internal Server Error** | Unexpected Error         | A server-side issue occurred; retry later or contact support.                        |

### **Best Practices for Handling Errors**

1. **Check Error Messages:** Every error response includes a descriptive message to help pinpoint the issue.
2. **Implement Retries with Backoff:** Use exponential backoff (e.g., 1s, 2s, 4s) when handling transient errors like `429 Too Many Requests` or `500 Internal Server Error`.
3. **Validate Requests Before Sending:** Ensure required parameters are included and correctly formatted.
4. **Monitor Rate Limits:** Avoid hitting rate limits by keeping track of API usage and applying caching strategies.
5. **Graceful Degradation:** If an error occurs, provide fallback behavior (e.g., displaying cached data instead of failing completely).
6. **Log Errors:** Capture and analyze errors to improve request handling and debug failures efficiently.

By following these guidelines, you can ensure smooth and resilient API integrations. For persistent issues, please reach out for assistance.
