Hoppa till innehållet

Read a key of a server

GET/v1/servers/{id}/tokens/{tokenId}

TypeScript account.servers.tokens.get(serverId, tokenId)

Python account.servers.tokens.get(server_id, token_id)

PHP $account->servers->tokens->get($serverId, $tokenId)

Java account.servers().tokens().get(serverId, tokenId)

Key ak_… an account key

Parameters

  • idin pathstring (uuid)required

    The server id.

  • tokenIdin pathstring (uuid)required

    The key id.

Responses

Every field of a response is always present. A field that can be null says so in its type.

200A key of this server; the value itself is shown only when it is created.

Example

{
  "tokenId": "3b0c9e2f-6d4a-4e8b-8a1c-9f2d7e6c5b40",
  "name": "default",
  "prefix": "sk_a1b2c3d4e5",
  "createdAt": "2026-09-20T12:00:00.000Z",
  "revokedAt": null
}
  • tokenIdstring (uuid)
  • namestring

    The name given at creation, for people to tell keys apart.

  • prefixstring

    The first characters of the key, to match it with a value in hand.

  • createdAtstring (date-time)
  • revokedAtstring (date-time) or null

Errors

Every error answers error, the code, and message, a sentence for a person. A code that adds fields is shown in full below the table.

CodeStatusMeaning
unauthorized401The key is missing, malformed or revoked.
wrong_token_kind403The key is of the other kind: a server key (sk_) where an account key (ak_) is needed, or the reverse. The message names the kind the operation takes.
not_for_connections403A connected app called an operation that no tool of the MCP server calls. An API key can.
read_only_connection403A connected app may only read here: the account is read only through a connection, and a live server takes changes only if the person allowed them when connecting.
test_server_only403A connected app may create a secret, or do what cannot be undone, on a test server only.
not_found404No such server of this account, or no such key of the server.
  • WWW-Authenticateheader on 401"Bearer"

    Always Bearer: send the key as Authorization: Bearer <key>.