# API keys

Create, inventory and revoke service credentials.



[Authentication](/build/authentication/) · [Errors](/build/errors/) · [Amounts and units](/build/units/)


Response examples below come from a local test account. IDs, balances and timestamps are sample data. Replace IDs and credentials with values from your account.


## Create API key

`POST /keys`


Secret is shown only once in the response.


**Access:** `keys:admin`.


**SDK methods:** TypeScript `client.keys.create(…)`; Python `client.keys.create(…)`.



### Request body

Schema: [CreateKeyInputDto](/api/partner-models/#createkeyinputdto)


### Request example

```bash
curl --fail-with-body -X POST "$THESAUROS_API_BASE/keys" \
  -H "Authorization: Bearer $THESAUROS_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{"label":"Documentation fixture key"}'
```

### Response · 201

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `object` | `string` | Yes |   |
| `data` | [ApiKeyOutputDto](/api/partner-models/#apikeyoutputdto) | Yes |   |


<details><summary>View example response</summary>

```json
{
  "object": "api_key",
  "data": {
    "id": "key_30fced9152fd3cf1",
    "object": "api_key",
    "label": "Documentation fixture key",
    "prefix": "tsk_test_BqM",
    "environment": "test",
    "created_at": "2026-09-07T14:42:43.444Z",
    "last_used_at": null,
    "revoked": false,
    "scopes": [
      "read",
      "write"
    ],
    "partner_id": null,
    "secret": "REDACTED_EXAMPLE"
  }
}
```

</details>


For failed requests, inspect `error.code`, `error.message` and the request ID. [Error handling](/build/errors/).


## List API keys (secrets masked)

`GET /keys`


**Access:** `keys:admin`.


**SDK methods:** TypeScript `client.keys.list(…)`; Python `client.keys.list(…)`.


### Request example

```bash
curl --fail-with-body -X GET "$THESAUROS_API_BASE/keys" \
  -H "Authorization: Bearer $THESAUROS_API_KEY"
```

### Response · 200

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `object` | `string` | Yes |   |
| `data` | [ApiKeyOutputDto](/api/partner-models/#apikeyoutputdto)[] | Yes |   |


<details><summary>View example response</summary>

```json
{
  "object": "list",
  "data": [
    {
      "id": "key_seed_orbit",
      "object": "api_key",
      "label": "Orbit Finance partner key",
      "prefix": "tsk_test_orb",
      "environment": "test",
      "created_at": "2026-06-15T12:00:00.000Z",
      "last_used_at": null,
      "revoked": false,
      "scopes": [
        "partner:read"
      ],
      "partner_id": "ptn_seed_orbit",
      "secret": "REDACTED_EXAMPLE"
    },
    {
      "id": "key_bootstrap",
      "object": "api_key",
      "label": "Sandbox bootstrap key",
      "prefix": "tsk_test_the",
      "environment": "test",
      "created_at": "2026-04-29T12:00:00.000Z",
      "last_used_at": null,
      "revoked": false,
      "scopes": [
        "read",
        "write"
      ],
      "partner_id": null,
      "secret": "REDACTED_EXAMPLE"
    },
    {
      "id": "key_seed_acme",
      "object": "api_key",
      "label": "Acme Wallet partner key",
      "prefix": "tsk_test_acm",
      "environment": "test",
      "created_at": "2026-05-31T12:00:00.000Z",
      "last_used_at": null,
      "revoked": false,
      "scopes": [
        "partner:read"
      ],
      "partner_id": "ptn_seed_acme",
      "secret": "REDACTED_EXAMPLE"
    },
    {
      "id": "key_30fced9152fd3cf1",
      "object": "api_key",
      "label": "Documentation fixture key",
      "prefix": "tsk_test_BqM",
      "environment": "test",
      "created_at": "2026-09-07T14:42:43.444Z",
      "last_used_at": null,
      "revoked": false,
      "scopes": [
        "read",
        "write"
      ],
      "partner_id": null,
      "secret": "REDACTED_EXAMPLE"
    },
    {
      "id": "key_master",
      "object": "api_key",
      "label": "Master full-access key (QA)",
      "prefix": "tsk_test_mas",
      "environment": "test",
      "created_at": "2026-04-29T12:00:00.000Z",
      "last_used_at": "2026-09-07T14:42:43.604Z",
      "revoked": false,
      "scopes": [
        "read",
        "write",
        "keys:admin",
        "partner:admin",
        "partner:read"
      ],
      "partner_id": null,
      "secret": "REDACTED_EXAMPLE"
    }
  ]
}
```

</details>


For failed requests, inspect `error.code`, `error.message` and the request ID. [Error handling](/build/errors/).


## Revoke an API key

`DELETE /keys/{id}`


**Access:** `keys:admin`.


**SDK methods:** TypeScript `client.keys.revoke(…)`; Python `client.keys.revoke(…)`.


### Parameters

| Name | Location | Type | Required | Description |

| --- | --- | --- | --- | --- |

| `id` | path | `string` | Yes |  |

### Request example

```bash
curl --fail-with-body -X DELETE "$THESAUROS_API_BASE/keys/key_30fced9152fd3cf1" \
  -H "Authorization: Bearer $THESAUROS_API_KEY"
```

### Response · 200

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `object` | `string` | Yes |   |
| `data` | [RevokedApiKey](/api/partner-models/#revokedapikey) | Yes |   |


<details><summary>View example response</summary>

```json
{
  "object": "api_key",
  "data": {
    "id": "key_30fced9152fd3cf1",
    "revoked": true
  }
}
```

</details>


For failed requests, inspect `error.code`, `error.message` and the request ID. [Error handling](/build/errors/).

