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

# Error handling

> Handle ThinkFeel status codes and errors.

The API uses standard HTTP status codes and returns detailed error messages.

## Status codes

| Status | Meaning               | Description                                                               |
| ------ | --------------------- | ------------------------------------------------------------------------- |
| `200`  | Success               | Request completed successfully                                            |
| `400`  | Bad Request           | Invalid request body on the OpenAI-compatible endpoint                    |
| `401`  | Unauthorized          | Invalid or missing API key                                                |
| `402`  | Payment Required      | Payment challenge for enabled self-serve personas when no API key is sent |
| `403`  | Forbidden             | API key is not associated with an active billing account                  |
| `404`  | Not Found             | Invalid persona ID                                                        |
| `422`  | Unprocessable Entity  | Invalid request body or parameters                                        |
| `429`  | Too Many Requests     | Insufficient balance or quota exhausted on API-key billing                |
| `500`  | Internal Server Error | Server error. Contact support if persistent                               |

## ThinkFeel endpoint validation errors

The `/generate` and `/personify` endpoints return plain text for most validation and authentication errors.

```text theme={null}
Unknown `personaId` was provided in the body.
```

Quota and unexpected server errors may return JSON, so clients should check the response content type before parsing errors.

Requests without API-key headers may also receive a payment challenge instead of a JSON or plain-text error when self-serve payment access is enabled for the target persona.

If a persona is not enabled for self-serve payment access, send an API key header. Unauthenticated requests can return `404` instead of confirming persona availability.

## OpenAI-compatible error format

```json theme={null}
{
  "error": {
    "message": "Missing required `model`.",
    "type": "invalid_request_error",
    "param": "model",
    "code": null
  }
}
```
