# API keys

> widar marks AI output for the EU AI Act and California's AI Transparency Act: an invisible watermark and a signed C2PA credential on text, images, audio and video, in one API, by Bynn Intelligence.

Documentation index: https://widar.com/llms.txt

The examples in these docs use invented companies, such as Lumen Labs B.V., and invented values: none is a real check, mark, signature or certificate.

Section: API reference. URL: https://widar.com/docs/keys

Create, roll and revoke the keys your servers and agents use: secret, restricted, provisioning, test and publishable. A secret is shown once and stored as a hash.

Updated December 3, 2026

Every key belongs to one workspace and one mode. A restricted key holds only the scopes it needs, read or write per resource, with an expiry and a daily spend cap. See [Keys and test mode](https://widar.com/docs/keys-and-test-mode).

## Check a key

`GET /v1/key_check`

Which workspace a key belongs to, its mode, its kind, its scopes and when it expires. It changes and bills nothing, so an agent can check its key before it starts.

Check a key

- Who may: Any key
- CLI: `widar auth status`
- MCP tool: `check_key`
- Returns: The key's workspace, mode, kind, scopes and expiry.

No parameters.

**Check a key**

API:

```bash
curl -X GET https://api.widar.com/v1/key_check \
  -H "Authorization: Bearer $WIDAR_API_KEY"
```

CLI:

```bash
widar auth status
```

MCP tool:

```json
{
  "name": "check_key",
  "arguments": {}
}
```

**Response, 200 OK**

```json
{
  "object": "key_check",
  "workspace": { "id": "ws_Lm3Qx8Rk2VnT", "name": "Lumen Labs" },
  "mode": "test",
  "kind": "secret",
  "scopes": [],
  "expires_at": null
}
```

## List API keys

The workspace's keys, live and test, each shown by its start and last four characters.

`GET /v1/keys`. Who may: Owner, Admin and Developer. CLI: `widar keys list`. MCP tool: `list_api_keys`.

**Parameters**

**Returns** list of keys: The keys, never their secrets.

API:

```bash
curl -X GET https://api.widar.com/v1/keys \
  -H "Authorization: Bearer $WIDAR_API_KEY"
```

CLI:

```bash
widar keys list
```

MCP tool `list_api_keys`:

```json
{
  "name": "list_api_keys",
  "arguments": {}
}
```

## Create an API key

A key for a server (secret or restricted) or for a page or an app (publishable), live or test.

`POST /v1/keys`. Who may: Owner, Admin and Developer. CLI: `widar keys create --name <name> [--kind <secret|restricted|publishable>] [--mode <live|test>] [--scopes <scope,...>] [--origins <url,...>] [--allow-native]`. MCP tool: `create_api_key`.

**Parameters**
- `name` (string, required): The name. At most 80 characters.
- `kind` (enum, default "secret"): The kind. One of `secret`, `restricted`, `publishable`.
- `mode` (enum): live or test; the call's own mode when left out One of `live`, `test`.
- `scopes` (array of string, default []): a restricted key's, each resource:read or resource:write; write includes read At most 30 items.
- `origins` (array of URL, default []): The origins. At most 20 items.
- `allow_native` (boolean): a publishable key's: it also starts a verification from a native app, which sends no origin; with it, origins may be empty

**Returns** key with its secret: The key, and its secret shown once.

API:

```bash
curl -X POST https://api.widar.com/v1/keys \
  -H "Authorization: Bearer $WIDAR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "<name>"
  }'
```

CLI:

```bash
widar keys create --name <name>
```

MCP tool `create_api_key`:

```json
{
  "name": "create_api_key",
  "arguments": {
    "name": "<name>"
  }
}
```

## Roll an API key

Replace a key's secret; the old one keeps working for the hours you give, up to 30 days, then stops.

`POST /v1/keys/{key_id}/roll`. Who may: Owner, Admin and Developer. CLI: `widar keys roll <key_id> [--expire-old-in-hours <0-720>]`. MCP tool: `roll_api_key`.

**Parameters**
- `key_id` (id (key_), required): The key's id. In the path.
- `expire_old_in_hours` (integer, default 0): The expire old in hours. At most 720.

**Returns** key with its secret: The key with its new secret, shown once.

API:

```bash
curl -X POST https://api.widar.com/v1/keys/key_7Kq2Xw9/roll \
  -H "Authorization: Bearer $WIDAR_API_KEY"
```

CLI:

```bash
widar keys roll key_7Kq2Xw9
```

MCP tool `roll_api_key`:

```json
{
  "name": "roll_api_key",
  "arguments": {
    "key_id": "key_7Kq2Xw9"
  }
}
```

## Change an API key

Rename a key, change the scopes of a restricted key, the origins of a publishable key and whether a native app may start with it, or the most a secret or restricted key may spend in a UTC day. Its secret stays the same.

`PATCH /v1/keys/{key_id}`. Who may: Owner, Admin and Developer. CLI: `widar keys update <key_id> [--name <name>] [--scopes <scope,...>] [--origins <url,...>] [--allow-native <true|false>] [--daily-spend-cap <usd|none>]`. MCP tool: `update_api_key`.

**Parameters**
- `key_id` (id (key_), required): The key's id. In the path.
- `name` (string): The name. At most 80 characters.
- `scopes` (array of string): The scopes. At most 30 items.
- `origins` (array of string): The origins. At most 20 items.
- `allow_native` (boolean): The allow native.
- `daily_spend_cap` (object): The most the key may spend in a UTC day, in USD from 0.01 to 1000 in whole cents; null removes the cap `null` clears it.

**Returns** key: The key as it now stands, never its secret.

API:

```bash
curl -X PATCH https://api.widar.com/v1/keys/key_7Kq2Xw9 \
  -H "Authorization: Bearer $WIDAR_API_KEY"
```

CLI:

```bash
widar keys update key_7Kq2Xw9
```

MCP tool `update_api_key`:

```json
{
  "name": "update_api_key",
  "arguments": {
    "key_id": "key_7Kq2Xw9"
  }
}
```

## Revoke an API key

Stop a key at once: every call made with it is refused from now on. It cannot be undone; make a new key instead.

`DELETE /v1/keys/{key_id}`. Who may: Owner, Admin and Developer. CLI: `widar keys revoke <key_id>`. MCP tool: `revoke_api_key`.

**Parameters**
- `key_id` (id (key_), required): The key's id. In the path.

**Returns** deleted key: The key's id, object key and deleted true: it stopped at once.

API:

```bash
curl -X DELETE https://api.widar.com/v1/keys/key_7Kq2Xw9 \
  -H "Authorization: Bearer $WIDAR_API_KEY"
```

CLI:

```bash
widar keys revoke key_7Kq2Xw9
```

MCP tool `revoke_api_key`:

```json
{
  "name": "revoke_api_key",
  "arguments": {
    "key_id": "key_7Kq2Xw9"
  }
}
```

## Read how the keys are used

For each key: its requests in the last 24 hours and the last 7 days, its errors, when it was last used, and until when an old secret still works after a roll.

`GET /v1/key_usage`. Who may: Owner, Admin and Developer. CLI: `widar keys usage [--key-id <key_id>]`. MCP tool: `get_api_key_usage`.

**Parameters**
- `key_id` (id (key_)): The key's id.

**Returns** list of key usage: One row per key, never a secret.

API:

```bash
curl -X GET https://api.widar.com/v1/key_usage \
  -H "Authorization: Bearer $WIDAR_API_KEY"
```

CLI:

```bash
widar keys usage
```

MCP tool `get_api_key_usage`:

```json
{
  "name": "get_api_key_usage",
  "arguments": {}
}
```
