2026-01-20 10:29:13 +00:00
---
2026-01-30 03:15:10 +01:00
summary: "CLI reference for `openclaw devices` (device pairing + token rotation/revocation)"
2026-01-20 10:29:13 +00:00
read_when:
- You are approving device pairing requests
- You need to rotate or revoke device tokens
2026-01-31 16:04:03 -05:00
title: "devices"
2026-01-20 10:29:13 +00:00
---
2026-01-30 03:15:10 +01:00
# `openclaw devices`
2026-01-20 10:29:13 +00:00
Manage device pairing requests and device-scoped tokens.
## Commands
2026-01-30 03:15:10 +01:00
### `openclaw devices list`
2026-01-20 10:29:13 +00:00
List pending pairing requests and paired devices.
```
2026-01-30 03:15:10 +01:00
openclaw devices list
openclaw devices list --json
2026-01-20 10:29:13 +00:00
```
2026-03-19 18:26:06 -05:00
Pending request output includes the requested role and scopes so approvals can
be reviewed before you approve.
2026-02-25 02:40:05 +00:00
### `openclaw devices remove <deviceId>`
Remove one paired device entry.
2026-04-04 15:28:36 +01:00
When you are authenticated with a paired device token, non-admin callers can
remove only **their own ** device entry. Removing some other device requires
`operator.admin` .
2026-02-25 02:40:05 +00:00
```
openclaw devices remove <deviceId>
openclaw devices remove <deviceId> --json
```
### `openclaw devices clear --yes [--pending]`
Clear paired devices in bulk.
```
openclaw devices clear --yes
openclaw devices clear --yes --pending
openclaw devices clear --yes --pending --json
```
2026-02-17 14:08:04 +00:00
### `openclaw devices approve [requestId] [--latest]`
2026-01-20 10:29:13 +00:00
2026-02-17 14:08:04 +00:00
Approve a pending device pairing request. If `requestId` is omitted, OpenClaw
automatically approves the most recent pending request.
2026-01-20 10:29:13 +00:00
2026-03-19 18:26:06 -05:00
Note: if a device retries pairing with changed auth details (role/scopes/public
key), OpenClaw supersedes the previous pending entry and issues a new
`requestId` . Run `openclaw devices list` right before approval to use the
current ID.
2026-01-20 10:29:13 +00:00
```
2026-02-17 14:08:04 +00:00
openclaw devices approve
2026-01-30 03:15:10 +01:00
openclaw devices approve <requestId>
2026-02-17 14:08:04 +00:00
openclaw devices approve --latest
2026-01-20 10:29:13 +00:00
```
2026-01-30 03:15:10 +01:00
### `openclaw devices reject <requestId>`
2026-01-20 10:29:13 +00:00
Reject a pending device pairing request.
```
2026-01-30 03:15:10 +01:00
openclaw devices reject <requestId>
2026-01-20 10:29:13 +00:00
```
2026-01-30 03:15:10 +01:00
### `openclaw devices rotate --device <id> --role <role> [--scope <scope...>]`
2026-01-20 10:29:13 +00:00
Rotate a device token for a specific role (optionally updating scopes).
2026-04-04 11:35:51 +01:00
The target role must already exist in that device's approved pairing contract;
rotation cannot mint a new unapproved role.
2026-04-04 14:23:26 +01:00
If you omit `--scope` , later reconnects with the stored rotated token reuse that
token's cached approved scopes. If you pass explicit `--scope` values, those
become the stored scope set for future cached-token reconnects.
2026-04-04 15:28:36 +01:00
Non-admin paired-device callers can rotate only their **own ** device token.
Also, any explicit `--scope` values must stay within the caller session's own
operator scopes; rotation cannot mint a broader operator token than the caller
already has.
2026-01-20 10:29:13 +00:00
```
2026-01-30 03:15:10 +01:00
openclaw devices rotate --device <deviceId> --role operator --scope operator.read --scope operator.write
2026-01-20 10:29:13 +00:00
```
2026-04-04 08:36:27 +01:00
Returns the new token payload as JSON.
2026-01-30 03:15:10 +01:00
### `openclaw devices revoke --device <id> --role <role>`
2026-01-20 10:29:13 +00:00
Revoke a device token for a specific role.
2026-04-04 15:28:36 +01:00
Non-admin paired-device callers can revoke only their **own ** device token.
Revoking some other device's token requires `operator.admin` .
2026-01-20 10:29:13 +00:00
```
2026-01-30 03:15:10 +01:00
openclaw devices revoke --device <deviceId> --role node
2026-01-20 10:29:13 +00:00
```
2026-04-04 08:36:27 +01:00
Returns the revoke result as JSON.
2026-01-20 10:29:13 +00:00
## Common options
- `--url <url>` : Gateway WebSocket URL (defaults to `gateway.remote.url` when configured).
- `--token <token>` : Gateway token (if required).
- `--password <password>` : Gateway password (password auth).
- `--timeout <ms>` : RPC timeout.
- `--json` : JSON output (recommended for scripting).
2026-02-04 18:59:44 -05:00
Note: when you set `--url` , the CLI does not fall back to config or environment credentials.
Pass `--token` or `--password` explicitly. Missing explicit credentials is an error.
2026-01-20 10:29:13 +00:00
## Notes
- Token rotation returns a new token (sensitive). Treat it like a secret.
- These commands require `operator.pairing` (or `operator.admin` ) scope.
2026-04-04 11:35:51 +01:00
- Token rotation stays inside the approved pairing role set and approved scope
baseline for that device. A stray cached token entry does not grant a new
rotate target.
2026-04-04 15:28:36 +01:00
- For paired-device token sessions, cross-device management is admin-only:
`remove` , `rotate` , and `revoke` are self-only unless the caller has
`operator.admin` .
2026-02-25 02:40:05 +00:00
- `devices clear` is intentionally gated by `--yes` .
- If pairing scope is unavailable on local loopback (and no explicit `--url` is passed), list/approve can use a local pairing fallback.
2026-04-04 08:36:27 +01:00
- `devices approve` picks the newest pending request automatically when you omit `requestId` or pass `--latest` .
2026-03-10 17:05:57 -05:00
## Token drift recovery checklist
Use this when Control UI or other clients keep failing with `AUTH_TOKEN_MISMATCH` or `AUTH_DEVICE_TOKEN_MISMATCH` .
1. Confirm current gateway token source:
``` bash
openclaw config get gateway.auth.token
```
2. List paired devices and identify the affected device id:
``` bash
openclaw devices list
```
3. Rotate operator token for the affected device:
``` bash
openclaw devices rotate --device <deviceId> --role operator
```
4. If rotation is not enough, remove stale pairing and approve again:
``` bash
openclaw devices remove <deviceId>
openclaw devices list
openclaw devices approve <requestId>
```
5. Retry client connection with the current shared token/password.
2026-04-04 14:36:52 +01:00
Notes:
- Normal reconnect auth precedence is explicit shared token/password first, then explicit `deviceToken` , then stored device token, then bootstrap token.
- Trusted `AUTH_TOKEN_MISMATCH` recovery can temporarily send both the shared token and the stored device token together for the one bounded retry.
2026-03-10 17:05:57 -05:00
Related:
- [Dashboard auth troubleshooting ](/web/dashboard#if-you-see-unauthorized-1008 )
- [Gateway troubleshooting ](/gateway/troubleshooting#dashboard-control-ui-connectivity )