> For a complete page index of the Captain API documentation, fetch https://docs.captain.dev/llms.txt?excludeSpec=true

# List Keys

GET https://acme.captain.dev/v1/keys

List every key, never its secret. The calling key has `current: true`. Takes a write key for every index.

Reference: https://docs.captain.dev/reference/product-search/keys/list-keys

## Authentication

- `Authorization` header (bearer token, required) — A write key, issued by Captain. Server side only. Sent as Authorization: Bearer \<key>.

## Response

### 200

keys

- `keys` (list of Key, optional)

## Types

### Key

- `id` (string, optional)
- `type` (enum, optional)
  - Allowed values: `search`, `scoped`, `issuer`, `console`, `write`
- `prefix` (string, optional)
- `operator` (string, optional) — minted by a console key: the person it was minted for, fixed. Its events record it, and a request with it may not send X-Captain-Operator
- `principals` (list of string, optional)
- `filter_expr` (string, optional)
- `max_ttl` (integer, optional)
- `issued_by` (string, optional)
- `issued_by_captain` (boolean, optional) — in a write key's view: a key Captain issued (a console or support key). Its operator and description are left out, and only Captain revokes it
- `indexes` (list of string, optional)
- `filter` (KeyFilter, optional, nullable)
- `expires_at` (integer, optional, nullable)
- `allowed_origins` (list of string, optional)
- `description` (string, optional)
- `created_at` (integer, optional)
- `key` (string, optional) — only in the response to POST /v1/keys

### KeyFilter

## Examples

**Response**

```json
{
  "keys": [
    {
      "id": "key_2c7e90a1b4d35f18",
      "type": "write",
      "prefix": "cap_Q2mz7a",
      "indexes": [
        "*"
      ],
      "description": "bootstrap write key",
      "created_at": 1759000000,
      "current": true
    },
    {
      "id": "key_8a1f3c0d9e2b4f67",
      "type": "search",
      "prefix": "cap_k3Jd9x",
      "indexes": [
        "products-staging"
      ],
      "description": "staging storefront",
      "created_at": 1759433001,
      "created_by": "key_2c7e90a1b4d35f18"
    }
  ]
}
```

**SDK Code**

```python Python REST
import json
import requests

BASE_URL = "https://acme.captain.dev"
API_KEY = "your_write_key"

headers = {
    "Authorization": f"Bearer {API_KEY}",
}

response = requests.get(
    f"{BASE_URL}/v1/keys",
    headers=headers,
    timeout=30.0,
)

print(json.dumps(response.json(), indent=2))
```

```typescript TypeScript REST
const BASE_URL = "https://acme.captain.dev";
const API_KEY = "your_write_key";

const response = await fetch(`${BASE_URL}/v1/keys`, {
  method: "GET",
  headers: {
    Authorization: `Bearer ${API_KEY}`,
  },
});

const result = await response.json();
console.log(JSON.stringify(result, null, 2));
```