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

# Get an API token

Returns the metadata of one of your API tokens.

`GET https://api.akua.dev/v1/api_tokens/{id}`

## Authorizations

- `Authorization: Bearer <token>` (BearerAuth): Bearer token for the authenticated caller.

## Path Parameters

- `id` (string, required): API token ID. Required string length: `3 - 54`. Example: `"tok_3k9x2mfq8a1b7c4d5e6f"`.

## Response

### 200: Token metadata

`application/json`: `ApiToken`

- `id` (string, required): API token ID. Required string length: `3 - 54`. Example: `"tok_3k9x2mfq8a1b7c4d5e6f"`.
- `name` (string, required): Required string length: `1 - 100`. Example: `"My CLI token"`.
- `prefix` (string, required): The first 12 characters of the token, for recognizing it. Never the secret. Example: `"sk_akua_a3B2"`.
- `workspace_id` (string | null, required): The only Workspace the token may act in. Omitted or null: every Workspace the person may use. Required string length: `2 - 53`. Example: `"ws_j572abc123def4"`.
- `roles` (string[] | null, required): A ceiling of IAM roles: the token may do only what one of these roles includes, and only what the person may. Omitted or null: the rights of the person. Required array length: `1 - 16 elements`. Example: `["roles/viewer"]`.
- `created_at` (integer, required): Unix timestamp (seconds). Required range: `x >= 0`.
- `last_used_at` (integer | null, required): Unix timestamp (seconds) of last use, or null if never used. Required range: `x >= 0`.
- `expires_at` (integer | null, required): Unix timestamp (seconds) when the token expires, or null if never. Required range: `x >= 0`.

### 401: Missing, invalid or expired credential.

`application/json`: `ApiUnauthorized`

- `_tag` (enum<string>, required): Available options: `"Unauthorized"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

### 403: The credential may not act in this workspace.

`application/json`: `ApiForbidden`

- `_tag` (enum<string>, required): Available options: `"Forbidden"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

### 404: The resource was not found in this workspace.

`application/json`: `ApiNotFound`

- `_tag` (enum<string>, required): Available options: `"NotFound"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

## Example request

```bash
curl --request GET \
  --url 'https://api.akua.dev/v1/api_tokens/tok_3k9x2mfq8a1b7c4d5e6f' \
  --header 'Authorization: Bearer <token>'
```

## Example response

`200` `application/json`

```json
{
  "id": "tok_3k9x2mfq8a1b7c4d5e6f",
  "name": "My CLI token",
  "prefix": "sk_akua_a3B2",
  "workspace_id": "ws_j572abc123def4",
  "roles": [
    "roles/viewer"
  ],
  "created_at": 123,
  "last_used_at": 123,
  "expires_at": 123
}
```
