Skip to main content
POST
/
api-keys
Create API key
curl --request POST \
  --url https://api.natural.co/api-keys \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "data": {
    "attributes": {
      "name": "production-key",
      "scopes": [
        "payments.read",
        "payments.create"
      ],
      "ttl_days": 90
    }
  }
}
'
{
  "data": {
    "type": "api_key",
    "id": "key_019cd360-4fd6-7bf5-a3b5-821ca7836c14",
    "attributes": {
      "api_key_prefix": "nat_live_abc123__",
      "name": "production-key",
      "scopes": [
        "payments.read",
        "payments.create"
      ],
      "environment": "production",
      "status": "ACTIVE",
      "created_at": "2026-01-04T15:30:00Z",
      "expires_at": "2026-04-04T15:30:00Z",
      "last_used_at": null,
      "revoked_at": null,
      "created_by": null,
      "revoked_by": null,
      "api_key": "nat_live_abc123_full_secret_key_example"
    },
    "relationships": {
      "party": {
        "data": {
          "type": "party",
          "id": "pty_019cd1798d617f65a79cb965dda9eac3"
        }
      }
    }
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

Idempotency-Key
string | null

Unique key for idempotent request handling. If a request with the same key was already processed, the original response is returned.

X-Agent-ID
string | null

Agent ID (agt_xxx) identifying which agent is making the request.

X-Instance-ID
string | null

Agent session/conversation ID for observability.

Maximum string length: 1024

Body

application/json

Request body for creating an API key (JSON:API).

data
ApiKeyCreateData · object
required

Resource object

Response

Successful Response

Single API key creation response (includes secret).

data
ApiKeyCreateResource · object
required

Resource object