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

# Errors

> Understanding CubeStack API error responses.

# Errors

The CubeStack API uses standard HTTP status codes to indicate success or failure.

## Error Response Format

```json theme={null}
{
  "error": "Error message describing what went wrong"
}
```

## Common Status Codes

| Code  | Description                                      |
| ----- | ------------------------------------------------ |
| `200` | Success                                          |
| `201` | Created                                          |
| `400` | Bad Request — Invalid parameters or request body |
| `401` | Unauthorized — Missing or invalid API key        |
| `403` | Forbidden — Insufficient permissions             |
| `404` | Not Found — Resource does not exist              |
| `409` | Conflict — Duplicate or constraint violation     |
| `429` | Too Many Requests — Rate limit exceeded          |
| `500` | Internal Server Error                            |

## Handling Errors

Always check the HTTP status code and parse the error message:

```javascript theme={null}
const response = await fetch(url, { headers });

if (!response.ok) {
  const { error } = await response.json();
  console.error(`API Error (${response.status}): ${error}`);
}
```

See [Error Codes](/reference/error-codes) for a complete list of error codes.
