--- title: "Error Handling" source: "https://palt.ohmyteam.cc/error-handling" --- # Error Handling The API uses standard HTTP status codes. Responses are in JSON (or XML for some legacy endpoints). ## Common Errors | Status Code | Description | Handling Tips | |-------------|-------------|---------------| | **200** | Success | - | | **201** | Created (e.g., file upload) | - | | **401** | Unauthorized | Verify API key/subdomain. Regenerate key if needed. | | **403** | Forbidden | Check user permissions for the resource. | | **404** | Not Found | Invalid ID or category (e.g., file category). | | **413** | Payload Too Large | File exceeds 20MB or company storage limit. Resize or check quota. | | **500** | Internal Server Error | Retry later; contact support if persistent. | ### Example Error Response (403) ```json { "error": "You do not have permissions to hit this endpoint" } ``` ## Best Practices - Always check status code before parsing response. - Implement exponential backoff for retries on 5xx errors. - Log error details for debugging. ```javascript fetch('/api/v1/datasets', { headers: { Authorization: 'Basic ...' } }) .then(response => { if (!response.ok) { throw new Error(`HTTP ${response.status}`); } return response.json(); }) .catch(error => console.error('API Error:', error)); ```