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

# Error Codes

> Status codes, error responses, and empty-state behavior

All endpoints return `application/json` unless stated otherwise.

## Status codes

| Code  | Meaning                             | What to do                                        |
| ----- | ----------------------------------- | ------------------------------------------------- |
| `200` | Success (may include empty results) | Process the response                              |
| `401` | Missing or invalid API key          | Check the `X-API-Key` header                      |
| `404` | Unknown `deviceId`                  | Verify the device ID                              |
| `500` | Internal server error               | Retry with backoff; contact support if persistent |

## Error response shape

Errors return a single `error` field:

```json theme={null}
{
  "error": "Device not found"
}
```

## Empty states are not errors

When a device has no data for the requested day, the endpoint still returns `200`. List fields come back as an empty array and summary values as `null`:

```json theme={null}
{
  "deviceId": "863758060992848",
  "date": "2026-06-11",
  "series": [],
  "average": null,
  "max": null,
  "min": null
}
```

<Note>
  Treat empty arrays and `null` summaries as "no reading for this period," not as a failure. This is common for intermittently measured metrics such as ECG, metabolic markers, and body composition.
</Note>

## Retry guidance

* For `500`, retry with exponential backoff (for example 1s, 2s, 4s) up to a few attempts.
* For `401` and `404`, do not retry — fix the request first.
* If `500` responses persist for an endpoint, contact [support@stealthera.in](mailto:support@stealthera.in).
