Skip to main content
POST
/
v1
/
consumer
/
api-keys
Create Consumer API Key
curl --request POST \
  --url https://api.truthlocks.com/v1/consumer/api-keys \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "CI pipeline key"
}
'
{
  "key_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "name": "CI pipeline key",
  "prefix": "tlk_abcd1234",
  "status": "active",
  "scopes": [
    "consumer:read",
    "consumer:write",
    "attestations:mint",
    "attestations:read",
    "verify:read"
  ],
  "secret": "tlk_abcd1234abcd5678ef901234abcd5678ef901234abcd5678ef901234abcd5678",
  "created_at": "2026-03-25T14:30:00Z",
  "expires_at": "2026-06-23T14:30:00Z"
}
Creates a new personal API key for the authenticated consumer. The full secret is returned once in the response and cannot be retrieved again — store it securely. Each consumer can hold up to 5 active keys. Keys automatically expire after 90 days.

Parameters

name
string
required
A human-readable label for the key (e.g., “CI pipeline key”).

Responses

{
  "key_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "name": "CI pipeline key",
  "prefix": "tlk_abcd1234",
  "status": "active",
  "scopes": [
    "consumer:read",
    "consumer:write",
    "attestations:mint",
    "attestations:read",
    "verify:read"
  ],
  "secret": "tlk_abcd1234abcd5678ef901234abcd5678ef901234abcd5678ef901234abcd5678",
  "created_at": "2026-03-25T14:30:00Z",
  "expires_at": "2026-06-23T14:30:00Z"
}

Authorizations

Authorization
string
header
required

JWT for user-initiated operations

Body

application/json
name
string
required

A human-readable label for the key

Response

API key created. The secret is shown only in this response.

key_id
string<uuid>
name
string

Human-readable label for the key

prefix
string

First 12 characters of the key, for display purposes

status
enum<string>
Available options:
active,
revoked
scopes
string[]

Permission scopes granted to this key

created_at
string<date-time>
expires_at
string<date-time>

Keys expire 90 days after creation

last_used_at
string<date-time>

Timestamp of the last request made with this key

secret
string

Full API key value (shown once)