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

# Debugging requests

> X-Request-ID and the error code.

Two things diagnose a failure: `X-Request-ID` on the response and `code` in the body. Log both on every call. When you contact support, include `X-Request-ID` and, when a request failed after dispatch, `nito_operation_id` from the body.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl -i "https://app.trynito.ai/v1/chat/completions" \
  -H "Authorization: Bearer z_sk_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{ "model": "z-ai/glm-5.2", "messages": [{ "role": "user", "content": "Hi" }] }'
# look for: X-Request-ID: <value>
```

Branch on `code`, then read `message` and `param` for detail.

## By Status

| Status | Likely cause | What to check |
| - | - | - |
| `400` | Invalid request, unsupported feature/attachment, or unresolved model (`param: model`). | Validate the JSON body, the `model`, and any attachments. Do not retry unchanged. |
| `401` | Missing, malformed, revoked, or expired key. | The key starts with `z_sk_` and is sent as `Authorization: Bearer`. |
| `404` | Wrong path (`unknown_route`). | The base URL ends in `/v1` for OpenAI-style clients. |
| `429` | Rate limit or quota. | The `X-RateLimit-*` headers, `Retry-After`, and whether `code` is `rate_limited` or `insufficient_quota`. |

For `400`/`401`/`403`, fix the request or credential. For `429`/`502`/`503`, retry with [backoff](/api/api-reference/errors-and-rate-limits/backoff). If it persists, send [support@trynito.ai](mailto:support@trynito.ai) the `X-Request-ID`, the `code`, the `nito_operation_id` if present, and the timestamp.

## Related

* [Error envelope](/api/api-reference/errors-and-rate-limits/error-envelope)
* [Status mapping](/api/api-reference/errors-and-rate-limits/status-mapping)
* [Backoff](/api/api-reference/errors-and-rate-limits/backoff)


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