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

# Errors

> HTTP status codes and error responses

Errors return JSON with a `detail` field.

```json theme={null}
{
  "detail": "Rate limit exceeded. pro tier: 300 req/min."
}
```

## Status codes

| Code  | Meaning                                            |
| ----- | -------------------------------------------------- |
| `200` | Success                                            |
| `201` | Created (webhooks)                                 |
| `401` | No API key provided                                |
| `403` | Bad key or wrong tier for this feature             |
| `404` | Alert or resource doesn't exist                    |
| `429` | Rate limited — `Retry-After` header included       |
| `500` | Server error — DM [@alrerat](https://t.me/alrerat) |

## Handling errors

<CodeGroup>
  ```python Python theme={null}
  r = requests.get(url, headers=headers)

  if r.status_code == 429:
      wait = int(r.headers.get("Retry-After", 60))
      time.sleep(wait)
  elif r.status_code == 403:
      print("Wrong tier or bad key")
  elif r.status_code != 200:
      print(f"Error {r.status_code}: {r.json()['detail']}")
  ```

  ```javascript JavaScript theme={null}
  const r = await fetch(url, { headers });

  if (r.status === 429) {
    const wait = r.headers.get("Retry-After") || 60;
    await new Promise(res => setTimeout(res, wait * 1000));
  } else if (!r.ok) {
    const err = await r.json();
    console.error(`${r.status}: ${err.detail}`);
  }
  ```
</CodeGroup>
