# Desktop app and device tokens

Check which workspace a credential resolves to and manage the device tokens that sign the desktop app in to a workspace.

The macOS desktop app, which is an alpha, lets a member work with their workspace's agents from their own device. It signs in with a **device token**: a long-lived credential that starts with `abt_` and belongs to one member in one workspace. A device token acts as that member with member-level access and never carries workspace admin rights. It stops working once it is revoked or its member is no longer an active member of the workspace.

Two parts of this area are useful outside the desktop app. `GET /api/desktop/me` reports the identity and workspace behind any supported credential, including an API key. The device-token endpoints let a signed-in member see and revoke their own devices. They need a browser session rather than an API key; see [Authentication](https://centerofagentic.com/docs/authentication) for the credential types.

The calls the desktop app makes while it runs an agent (its model proxy, connector proxy and run-record sync) follow that app's own protocol and are not offered as a public API; server-side integrations start runs through the [REST API](https://centerofagentic.com/docs/api) with an API key.

## Identity

A credential check that answers for every supported credential type: an API key, a browser session or a device token sent with the header `X-Client: electron`.

### GET /api/desktop/me

Show the identity and workspace behind a credential

Returns the caller's identity and active workspace. The desktop app calls it to confirm its stored device token, and it works the same way for an API key, so it is a quick check that a key is valid and which workspace it belongs to. For an API key, `userId` is `api-key:` followed by the key's id; for a session or device token it is the member's user id.

**Access:** API key with the `read` scope, or a signed-in workspace member. Device tokens are accepted. An API key that belongs to a registered external agent is refused with `403` and the error code `external_credential_not_supported`.

**Request headers**

| Name | Type | Description |
| --- | --- | --- |
| `X-Client` | `"electron"` | Required only when the credential is a device token: send `X-Client: electron`. A device token sent without it is not accepted, and the request is answered with `401 unauthenticated`. API keys and browser sessions do not need it. |

**Returns:** An object `{ userId, orgId, orgSlug, tenantId }`. `orgId` is the workspace's organization id, `orgSlug` is its URL slug (can be `null`) and `tenantId` is the workspace's id as a UUID.

```bash
curl https://centerofagentic.com/api/desktop/me \
  -H "Authorization: Bearer $COA_API_KEY"
```

```json
{
  "userId": "api-key:5d0e7c2a-41b8-4c6f-9f0a-2b7e6d1c3a90",
  "orgId": "org_2xExampleWorkspace",
  "orgSlug": "example-workspace",
  "tenantId": "9b2d4c1e-7a3f-4f0b-8c6d-2e5a1b0f9c33"
}
```

## Device tokens

Create, list and revoke the tokens that sign the desktop app in. A token is personal: a signed-in member creates it for their active workspace, and its value is shown once, at creation. In normal use the web workspace's desktop connect page creates the token after the member confirms and passes it to the desktop app on the same machine. The endpoints are listed here so that you know how the credential is issued and how to withdraw it. Token expiry is being switched on by the service operator and is not active everywhere yet. Once it is on, a token expires 90 days after it was created, or after 30 days without use, whichever comes first; a workspace can have shorter limits; a token belongs to the membership it was created under, so it stops working when that member leaves and is not carried over if they join again; and every token created before the switch is signed out once, so each device has to sign in again. Until then tokens do not expire and the expiry fields described below are absent.

### GET /api/desktop/tokens

List your active device tokens

Lists the caller's own device tokens in the active workspace that have not been revoked, newest first. Tokens that belong to other members are never included, not even for a workspace admin. The token value is not returned. Where token expiry is on, expired tokens and tokens from an earlier membership of the same person are left out as well.

**Access:** A signed-in workspace member only. API keys are not accepted. Tokens are personal, so each caller sees only their own. An API key owns no device tokens, so a request made with a key is answered with an empty list instead of an error.

**Returns:** An object `{ tokens }`. Each entry has `id`, `name`, `createdAt`, `lastUsedAt`, `expiresAt` and `idleExpiresAt`; `lastUsedAt` is `null` until the token has been used. `createdAt` and `lastUsedAt` are date strings, currently in JavaScript's default text form (such as `Thu Nov 19 2026 09:30:00 GMT+0000 (Coordinated Universal Time)`) and not ISO 8601, so parse them leniently. `expiresAt` is the fixed deadline set when the token was created, and `idleExpiresAt` is when the token stops working if it is not used again (never later than `expiresAt`); both are ISO 8601 timestamps, and both are `null` where token expiry is not on.

### POST /api/desktop/tokens

Create a device token for the desktop app

Creates a device token for the signed-in member in their active workspace. The member and the workspace are taken from the session; the request cannot choose them, and it cannot choose how long the token lives. The creation is recorded in the workspace audit log.

**Access:** A signed-in workspace member only. API keys are not accepted. Only a signed-in browser session can create a token. Device tokens and API keys cannot create one.

**Request body**

| Name | Type | Description |
| --- | --- | --- |
| `name` | `string` | A label for the device, shown in the token list. Surrounding spaces are removed and the label is cut to 80 characters. Defaults to `Desktop`. |

**Returns:** Status 201 with `{ token, org }`. `token` is the device token in plain text; this response is the only time it is shown and it cannot be retrieved later. `org` is the workspace slug, or the organization id when the workspace has no slug. Where token expiry is on, the response also has `expiresAt`, the token's fixed deadline as an ISO 8601 timestamp, and `idleDays`, the number of days without use after which it expires.

**Errors**

| Status | Code | When |
| --- | --- | --- |
| 403 | `session_required` | The request is authenticated with a device token or an API key that has the `admin` scope instead of a signed-in browser session. A key without the `admin` scope is refused earlier with `insufficient_scope`. |
| 403 | `desktop_enrollment_refused` | Token expiry is on and the caller's current workspace membership could not be established, so there is nothing to tie the token to. No token is created. |
| 503 | `desktop_enrollment_unavailable` | Token expiry is on and the workspace's token limits could not be read. No token is created; try again later. |

### DELETE /api/desktop/tokens/{id}

Revoke a device token

Revokes one device token; requests that use it are rejected from then on. A member can revoke only their own tokens, and a workspace admin can revoke any member's token in the workspace, for example for a lost device. A request that is itself authenticated with a device token can revoke only that same token, so a device can sign itself out but not another device. A token that does not exist, is already revoked or is not the caller's to revoke is reported as not found. Revocations are recorded in the workspace audit log.

**Access:** A signed-in workspace member only. API keys are not accepted. A member revokes only their own tokens; a workspace admin can revoke any token in the workspace; a device token revokes only itself. API keys cannot revoke device tokens: a key owns none, so a key with the `admin` scope gets the not-found response and a key with a lower scope gets `insufficient_scope`.

**Path parameters**

| Name | Type | Description |
| --- | --- | --- |
| `id` required | `uuid` | The token's `id` from the token list. |

**Returns:** Status 200 with `{ revoked: true }`. When no active token with that id is the caller's to revoke, the status is 404 and the body is `{ revoked: false }`.

Source: https://centerofagentic.com/docs/api/desktop

## Related pages

- [Authentication](https://centerofagentic.com/docs/authentication)
- [REST API](https://centerofagentic.com/docs/api)
