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

# Errors

> Status codes, the error body, and how to retry safely.

Errors return JSON with a `detail` field:

```json theme={null}
{ "detail": "insufficient credits" }
```

| Status | Meaning | What to check |
| - | - | - |
| `400` | Invalid request | Unreadable or unsupported audio, clip under 1 second, solution code, multipart fields |
| `401` | Not authorized | Customer key and API access status |
| `402` | Insufficient credits | Account balance and available credits |
| `409` | Idempotency conflict | The key was already used for a different file or solution |
| `413` | File too large | File size of the upload |
| `422` | Invalid input | Field values and the `Idempotency-Key` length |
| `503` | Service unavailable | Retry later with the same `Idempotency-Key` |
| `504` | Analysis timed out | Retry later with the same `Idempotency-Key` |

## Retry safely

Send an optional `Idempotency-Key` header (up to 128 characters) with each upload. If a request fails and you retry the same upload, reuse the same key so it is charged only once. Reusing a key for a different file or solution returns `409`.

Credits are reserved before analysis, charged when it succeeds and released if it fails.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.