# HTTP status codes

The API returns standard HTTP status codes to indicate the success or failure of a request.

- **2xx codes** indicate success.
- **4xx codes** indicate an error with the request (e.g., invalid parameters, missing authentication, resource not found).
- **5xx codes** indicate a server-side error.


Clients should always be prepared to handle `4xx` and `5xx` responses gracefully. Some errors may include an error payload with additional details to help diagnose and resolve issues.

## Status codes reference

| Status Code | Error Type | Description |
|  --- | --- | --- |
| 400 | Bad Request | The request was malformed or missing required fields. Review the request payload and parameters. |
| 401 | Unauthorized | Authentication failed. The API key is missing or invalid. |
| 403 | Forbidden | The authenticated user is not authorized to perform this action on the specified resource. Check the credential's permissions. |
| 404 | Not Found | The requested resource could not be found. Verify the resource identifier or endpoint URL. |
| 405 | Method Not Allowed | The endpoint exists but doesn't support the HTTP method used. The `Allow` response header lists the methods it does support. |
| 409 | Conflict | The resource is not in a state that allows the request. A dataset whose saved modification is still being applied returns this until the build finishes—wait the number of seconds given in the `Retry-After` header, then send the same request again. |
| 413 | Request Entity Too Large | The payload size exceeded the allowed limit. Consider reducing the request size or batching data. |
| 429 | Too Many Requests | The request rate limit was exceeded. Wait the number of seconds given in the `Retry-After` header when one is present, otherwise retry with exponential backoff. |
| 500 | Internal Server Error | A server-side error occurred while processing the request. These errors are rare—retrying the request may resolve the issue. |


## Handling errors

- Validate requests before sending them to reduce `400` errors.
- Check authentication headers and tokens for `401` responses.
- Confirm the API key's permissions for `403` responses.
- Read the `Allow` header on a `405` to see which methods the endpoint supports.
- Honor the `Retry-After` header and resend the same request unchanged when a `409` reports `modification_in_progress`. A `409` reporting `modification_failed` is final, and retrying will not help.
- Retry with backoff when encountering `429` (rate limits) or certain `500` errors.
- Log error payloads for debugging and support purposes.