# Request IDs (/request-ids)

Every response from the API carries an `X-Request-ID` header. Errors repeat it in the body as `error.requestId`. It identifies one request end to end in CallMitra's logs, so it is the fastest way for support to find what happened.

```http
HTTP/1.1 404 Not Found
X-Request-ID: req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69
Content-Type: application/json

{
  "detail": "Campaign not found",
  "error": {
    "type": "not_found_error",
    "code": "resource_not_found",
    "message": "Campaign not found",
    "param": null,
    "docUrl": "https://docs.callmitra.ai/errors/resource_not_found",
    "requestId": "req_5f1c2e9b7a3d4c0e8b6a1f2d3c4b5a69"
  }
}
```

## Send your own [#send-your-own]

To correlate CallMitra's logs with yours, send your own ID in the `X-Request-ID` request header. CallMitra uses it as-is when it is 1–64 characters of letters, digits, `.`, `_` or `-`; otherwise it generates a new `req_…` ID. Either way, the ID in use is echoed back in the response.

<Tabs groupId="language" persist items={["cURL","Node.js","Python"]}>
<Tab value="cURL">
```bash
curl -i https://api.callmitra.ai/api/v1/campaigns/ \
  -H "X-API-Key: $CALLMITRA_API_KEY" \
  -H "X-Request-ID: crm-sync-2026-11-15-0042"
```
</Tab>

<Tab value="Node.js">
```js
const res = await fetch('https://api.callmitra.ai/api/v1/campaigns/', {
  headers: {
    'X-API-Key': process.env.CALLMITRA_API_KEY,
    'X-Request-ID': 'crm-sync-2026-11-15-0042',
  },
});
console.log(res.status, res.headers.get('X-Request-ID'));
```
</Tab>

<Tab value="Python">
```python
res = requests.get(
    "https://api.callmitra.ai/api/v1/campaigns/",
    headers={
        "X-API-Key": os.environ["CALLMITRA_API_KEY"],
        "X-Request-ID": "crm-sync-2026-11-15-0042",
    },
    timeout=30,
)
print(res.status_code, res.headers["X-Request-ID"])
```
</Tab>
</Tabs>

## Good practice [#good-practice]

- Log the `X-Request-ID` of every failed request next to your own error.
- Do not reuse one ID for many requests; it makes logs harder to read. To retry safely, use an [`Idempotency-Key`](/idempotency) instead.
- When you contact support, include the request ID, the time, and the endpoint.