Skip to content

ReferenceWorkspace

API keys

An API key lets your own systems call Kontiga for the workspace. A secret key is for a server, a restricted key is for one job with only the scopes it needs, and a publishable key starts an end customer’s session from a page or an app. Every key is live or test. A secret is shown once, when the key is made or rolled.

Updated

Ask about this pageRead this page as Markdown

The key object

  • idstring

    The key’s id: key_ and 32 hex characters. It is not the secret.

  • namestring

    The system that uses it.

  • kindenum

    secret, restricted or publishable.

  • modeenum

    live or test. A test key makes test objects that never bill.

  • prefixstring

    How its secret starts: kt_live_ or kt_test_ for a secret or restricted key, kt_pub_live_ or kt_pub_test_ for a publishable key (one made before 29 November 2026 starts kt_pub_ and keeps working). The secret is the prefix and 64 hex characters.

  • last4string

    The last four characters of its secret.

  • scopesarray

    For a restricted key: what it may do, each resource:read or resource:write, such as documents:write or cases:read. Write includes read. Empty on other keys.

  • originsarray

    For a publishable key: the exact web addresses it works from. Empty on other keys.

  • allow_nativeboolean

    For a publishable key only: a native app, which sends no origin, may start a verification with it. A publishable key has at least one origin, or this set to true.

  • created_bystring

    Who made it: a member’s id (mem_) or, for a device’s key, the provisioning key’s id (key_).

  • created_atstring

    When it was made.

  • last_used_atstring

    When it last made a call, to within ten minutes, or null.

  • expires_atstring

    When it stops working, or null for never.

  • statusenum

    active, or expired once past expires_at (its calls are refused with key_expired).

  • old_secret_expires_atstring

    After a roll that kept the old secret working: when it stops. null otherwise.

  • device_idstring

    For a device’s restricted key: the device it was made for, or null.

  • labelsobject

    For a device’s restricted key: the labels a bulk revoke selects by, or null.

  • secretstring

    Only in the answer that makes or rolls the key. Store it then: it cannot be read again.

A key
{
  "id": "key_bf17a8a43ad428b8b6de567666b9a46b",
  "name": "Document sync worker",
  "kind": "restricted",
  "mode": "live",
  "prefix": "kt_live_",
  "last4": "0f3c",
  "scopes": ["documents:write", "cases:read"],
  "origins": [],
  "created_by": "mem_34e593e655241ff32e468c8e54ddd984",
  "created_at": "2026-10-17T13:04:22Z",
  "last_used_at": "2026-11-27T08:58:40Z",
  "expires_at": "2027-04-16T00:00:00Z",
  "status": "active",
  "old_secret_expires_at": null,
  "device_id": null,
  "labels": null
}

Create an API key

Changes data

POST/v1/keys

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

Who may
Owner, Admin and Developer
CLI
kontiga keys create --name <name> [--kind <secret|restricted|publishable>] [--mode <live|test>] [--scopes <scope,...>] [--origins <url,...>] [--allow-native]
MCP tool
create_api_key
Returns
The key, and its secret shown once.

Parameters

  • namestringRequired

    Name it after the system that uses it. At most 80 characters.

  • kindenumDefault "secret"

    secret for a server, restricted for one job with only its scopes, publishable for a page or an app. A key can do only what your role may in its mode: a kind or a scope past it is refused with 403.

  • modeenum

    Live or test. Left out, the call’s own mode: the Kontiga-Mode header’s, or live. One of live, test.

  • scopesarray of stringDefault []

    For a restricted key: what it may do, each resource:read or resource:write. Write includes read. At most 30 items.

  • originsarray of URLDefault []

    For a publishable key: the exact addresses it works from, such as https://apply.harbourline.example. At most 20 items.

  • allow_nativeboolean

    For a publishable key: true lets your iOS or Android app start a verification with it too (an app sends no origin). With it, origins may be empty.

curl -X POST https://api.kontiga.com/v1/keys \
  -H "Authorization: Bearer $KONTIGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Loan origination server",
    "kind": "secret",
    "mode": "live"
  }'

POST /v1/keys

Response, 201 Created
{
  "id": "key_8972d33cc4bd488fe0c563a5a75f389b",
  "name": "Loan origination server",
  "kind": "secret",
  "mode": "live",
  "prefix": "kt_live_",
  "last4": "0504",
  "scopes": [],
  "origins": [],
  "created_by": "mem_34e593e655241ff32e468c8e54ddd984",
  "created_at": "2026-11-27T11:30:00Z",
  "last_used_at": null,
  "expires_at": null,
  "status": "active",
  "old_secret_expires_at": null,
  "device_id": null,
  "labels": null,
  "secret": "kt_live_6243686061587473ee05800066d90868143a94e1b583b1c06c42fcb5756b0504"
}

List API keys

Reads only

GET/v1/keys

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

Who may
Owner, Admin and Developer
CLI
kontiga keys list
MCP tool
list_api_keys
Returns
The keys, never their secrets.

No parameters.

curl -X GET https://api.kontiga.com/v1/keys \
  -H "Authorization: Bearer $KONTIGA_API_KEY"

GET /v1/keys

Response, 200 OK
{
  "items": [
    {
      "id": "key_8972d33cc4bd488fe0c563a5a75f389b",
      "name": "Loan origination server",
      "kind": "secret",
      "mode": "live",
      "prefix": "kt_live_",
      "last4": "174b",
      "scopes": [],
      "origins": [],
      "created_by": "mem_34e593e655241ff32e468c8e54ddd984",
      "created_at": "2026-11-27T11:30:00Z",
      "last_used_at": "2026-11-27T11:40:11Z",
      "expires_at": null,
      "status": "active",
      "old_secret_expires_at": "2026-11-28T11:35:00Z",
      "device_id": null,
      "labels": null
    },
    {
      "id": "key_b293cb646d8c36a861354dec94fa964f",
      "name": "Local development",
      "kind": "secret",
      "mode": "test",
      "prefix": "kt_test_",
      "last4": "9a1e",
      "scopes": [],
      "origins": [],
      "created_by": "mem_34e593e655241ff32e468c8e54ddd984",
      "created_at": "2026-10-02T09:12:45Z",
      "last_used_at": "2026-11-26T03:40:09Z",
      "expires_at": null,
      "status": "active",
      "old_secret_expires_at": null,
      "device_id": null,
      "labels": null
    }
  ],
  "next_cursor": null
}

Change an API key

Changes data

PATCH/v1/keys/{key_id}

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

Who may
Owner, Admin and Developer
CLI
kontiga keys update <key_id> [--name <name>] [--scopes <scope,...>] [--origins <url,...>] [--allow-native <true|false>]
MCP tool
update_api_key
Returns
The key as it now stands, never its secret.

Parameters

  • key_idid (key_)Required

    The key to change. Its secret stays the same. In the path.

  • namestring

    A new name. At most 80 characters.

  • scopesarray of string

    For a restricted key: its new scopes, each one your role holds in the key’s mode. At most 30 items.

  • originsarray of string

    For a publishable key: its new origins. At most 20 items.

  • allow_nativeboolean

    For a publishable key: whether a native app may start with it. Turning it off needs at least one origin left.

curl -X PATCH https://api.kontiga.com/v1/keys/key_bf17a8a43ad428b8b6de567666b9a46b \
  -H "Authorization: Bearer $KONTIGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "scopes": [
      "documents:write",
      "cases:read",
      "people:read"
    ]
  }'

PATCH /v1/keys/{key_id}

Response, 200 OK
{
  "id": "key_bf17a8a43ad428b8b6de567666b9a46b",
  "name": "Document sync worker",
  "kind": "restricted",
  "mode": "live",
  "prefix": "kt_live_",
  "last4": "0f3c",
  "scopes": ["documents:write", "cases:read"],
  "origins": [],
  "created_by": "mem_34e593e655241ff32e468c8e54ddd984",
  "created_at": "2026-10-17T13:04:22Z",
  "last_used_at": "2026-11-27T08:58:40Z",
  "expires_at": "2027-04-16T00:00:00Z",
  "status": "active",
  "old_secret_expires_at": null,
  "device_id": null,
  "labels": null
}

Roll an API key

Changes data

POST/v1/keys/{key_id}/roll

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

Who may
Owner, Admin and Developer
CLI
kontiga keys roll <key_id> [--expire-old-in-hours <0-720>]
MCP tool
roll_api_key
Returns
The key with its new secret, shown once.

Parameters

  • key_idid (key_)Required

    The key whose secret to replace. Your role must hold everything the key can do, in its mode. In the path.

  • expire_old_in_hoursintegerDefault 0

    How long the old secret keeps working, up to 720 hours (30 days). 0 stops it at once.

curl -X POST https://api.kontiga.com/v1/keys/key_8972d33cc4bd488fe0c563a5a75f389b/roll \
  -H "Authorization: Bearer $KONTIGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "expire_old_in_hours": 24
  }'

POST /v1/keys/{key_id}/roll

Response, 200 OK
{
  "id": "key_8972d33cc4bd488fe0c563a5a75f389b",
  "name": "Loan origination server",
  "kind": "secret",
  "mode": "live",
  "prefix": "kt_live_",
  "last4": "174b",
  "scopes": [],
  "origins": [],
  "created_by": "mem_34e593e655241ff32e468c8e54ddd984",
  "created_at": "2026-11-27T11:30:00Z",
  "last_used_at": "2026-11-27T11:34:10Z",
  "expires_at": null,
  "status": "active",
  "old_secret_expires_at": "2026-11-28T11:35:00Z",
  "device_id": null,
  "labels": null,
  "secret": "kt_live_c301af86f6fca145fac49f0dbe3ca95db5b1d11d755dceb2f8640aa63c9e174b"
}

Revoke an API key

Changes data

DELETE/v1/keys/{key_id}

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

Who may
Owner, Admin and Developer
CLI
kontiga keys revoke <key_id>
MCP tool
revoke_api_key
Returns
The key’s id, object key and deleted true: it stopped at once.

Parameters

  • key_idid (key_)Required

    The key to stop. Every call with it is refused from now on. This cannot be undone. The answer is the key’s id with object and deleted: true, as every delete. In the path.

curl -X DELETE https://api.kontiga.com/v1/keys/key_b293cb646d8c36a861354dec94fa964f \
  -H "Authorization: Bearer $KONTIGA_API_KEY"

DELETE /v1/keys/{key_id}

Response, 200 OK
{
  "id": "key_b293cb646d8c36a861354dec94fa964f",
  "object": "key",
  "deleted": true
}

Read how the keys are used

Reads only

GET/v1/key_usage

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.

Who may
Owner, Admin and Developer
CLI
kontiga keys usage [--key-id <key_id>]
MCP tool
get_api_key_usage
Returns
One row per key, never a secret.

Parameters

  • key_idid (key_)

    One key. Every key when left out.

curl -X GET "https://api.kontiga.com/v1/key_usage?key_id=key_8972d33cc4bd488fe0c563a5a75f389b" \
  -H "Authorization: Bearer $KONTIGA_API_KEY"

GET /v1/key_usage

Response, 200 OK
{
  "items": [
    {
      "key_id": "key_8972d33cc4bd488fe0c563a5a75f389b",
      "requests_24h": 2602,
      "daily": [2310, 2475, 1980, 640, 512, 2390, 2602],
      "errors_24h": 14,
      "last_used_at": "2026-11-27T11:40:11Z",
      "old_secret_expires_at": "2026-11-28T11:35:00Z"
    }
  ],
  "next_cursor": null
}