---
title: "Error reference"
description: "Stable error codes returned by the DeviceSDK API and CLI"
---

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

# Error reference

DeviceSDK API responses use a `{ success: false, error, code, docs }` shape on every error path. The `code` is a stable identifier suitable for `===` comparison; the `docs` URL points to a page on this site explaining the error and the most common fix.

The CLI surfaces the same fields on `DeviceSDKApiError` instances:

```typescript
import { DeviceSDKApiError } from "@devicesdk/cli";
try { /* ... */ }
catch (err) {
  if (err instanceof DeviceSDKApiError) {
console.error(err.message);
if (err.code === "invalid_token") await login();
if (err.docs) console.error(`See ${err.docs}`);
  }
}
```

## Error codes

- [`missing_credentials`](./missing_credentials/) - no Bearer token, session cookie, or CLI token on the request
- [`invalid_token`](./invalid_token/) - token does not match any active session/API/legacy entry
- [`invalid_cli_token`](./invalid_cli_token/) - CLI token (`dsdk_*`) is missing, expired, or revoked

If you hit an error code that isn't listed here, please [open an issue](https://github.com/device-sdk/devicesdk/issues) so we can document it.

Source: https://docs.devicesdk.com/errors/index.mdx
