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

# API Keys

> View and regenerate your workspace API key.

API keys authenticate SDK requests to Pikarc. Each workspace has one active API key at a time. The key format is `lg_<prefix>_<secret>`.

## Get Active Key

```
GET /v1/api-keys/
```

Returns the active API key for your workspace. The full key is returned if it was stored encrypted; otherwise only the prefix is available.

**Auth**: JWT or API Key

### Response `200`

```json theme={null}
{
  "id": "aa0e8400-e29b-41d4-a716-446655440000",
  "prefix": "a1b2c3d4",
  "key": "lg_a1b2c3d4_e5f6a7b8c9d0e1f2a3b4c5d6e7f8",
  "label": null,
  "is_active": true,
  "created_at": "2025-01-01T00:00:00Z"
}
```

| Field        | Type             | Description                                 |
| ------------ | ---------------- | ------------------------------------------- |
| `id`         | `string`         | Key UUID                                    |
| `prefix`     | `string`         | Key prefix (first 8 characters after `lg_`) |
| `key`        | `string \| null` | Full key if decryptable, otherwise null     |
| `label`      | `string \| null` | Optional label                              |
| `is_active`  | `boolean`        | Whether this key is active                  |
| `created_at` | `string`         | ISO 8601 creation timestamp                 |

### Response `404`

```json theme={null}
{
  "detail": "No active API key"
}
```

***

## Regenerate Key

```
POST /v1/api-keys/regenerate
```

Revokes all existing keys and generates a new one. The plaintext key is returned **once** — store it securely.

**Auth**: JWT or API Key

### Response `200`

```json theme={null}
{
  "id": "bb0e8400-e29b-41d4-a716-446655440000",
  "prefix": "x9y8z7w6",
  "label": null,
  "key": "lg_x9y8z7w6_a1b2c3d4e5f6a7b8c9d0e1f2",
  "created_at": "2025-01-15T12:00:00Z"
}
```

<Warning>
  After regeneration, the old key immediately stops working. Update your SDK configuration with the new key.
</Warning>
