---
title: "Error: invalid_cli_token"
description: "A `dsdk_*` CLI token is missing, expired, or revoked."
---

> 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: invalid_cli_token

## What it means

The request used a `dsdk_*`-prefixed token, but it didn't match any active CLI token in the database. CLI tokens are short-lived; they're paired with refresh tokens and rotate every few hours.

The CLI itself usually handles this transparently - `devicesdk login` writes both an access token and a refresh token to `~/.devicesdk/credentials.json`, and subsequent calls auto-refresh. If you're seeing this code surface, it usually means refresh has also failed.

## Common causes and fixes

- **You haven't logged in.** Run `devicesdk login --host http://<server>:8080`.
- **The refresh token also expired** (typical after long inactivity). Run `devicesdk login --host http://<server>:8080` to issue a fresh pair.
- **You revoked the token from your server's dashboard.** Run `devicesdk login --host http://<server>:8080` to issue a new one.
- **You're sharing one `~/.devicesdk/credentials.json` across machines.** Each `devicesdk login` rotates the refresh token; only the most recent machine has the live one. Run `devicesdk login` again on whichever machine got 401'd.
- **You set `DEVICESDK_TOKEN` to a non-CLI token.** Use a regular API token from your server's dashboard for that env var.

## Related

- [`invalid_token`](../invalid_token/) - generic-token variant of this error.
- [`missing_credentials`](../missing_credentials/) - no token at all.

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