REST API · keys

POST /keys

Mints a new key. Body: {name, mode, ttlDays?}. Returns the one-shot plaintext.

post_api_keys_create

Authentication

  • Bearer

Request body

application/json · required

{
    "name": "Production key",
    "mode": "live",
    "ttlDays": 90
}

Responses

201

The minted key and its one-shot plaintext.

application/json

{
    "key": {
        "id": "e5f6a7b8-9c0d-4e5f-b06b-3c4d5e6f7a8b",
        "name": "Production key",
        "mode": "live",
        "prefix": "er_live_4f9a2c8b",
        "createdAt": "2026-01-15T09:00:00+00:00",
        "createdBy": "owner@example.com",
        "lastUsedAt": null,
        "expiresAt": "2026-04-15T09:00:00+00:00",
        "revokedAt": null,
        "successorId": null,
        "predecessorId": null,
        "successorRevealedAt": null
    },
    "plaintext": "er_live_4f9a2c8b1d6e3f7a0b5c9d2e8f1a3b6c4d7e0f2a1b5c8d3e"
}

422

Validation failed.

application/json

{
    "required": [
        "error"
    ],
    "properties": {
        "error": {
            "description": "Machine-readable error code, e.g. \"not_found\", \"forbidden\", \"validation\".",
            "type": "string",
            "enum": [
                "bad_request",
                "unauthorized",
                "insufficient_credits",
                "forbidden",
                "web_only",
                "allowlist_widens",
                "not_found",
                "conflict",
                "draft_revision_conflict",
                "rollback_confirmation_conflict",
                "not_replayable",
                "targets_outside_allowlist",
                "gone",
                "deprecated_operation",
                "validation",
                "rate_limited",
                "payment_provider",
                "verification_unavailable",
                "analytics_unavailable",
                "credential_vault_unavailable",
                "notification_grants_unavailable"
            ]
        },
        "message": {
            "description": "Human-readable explanation of what went wrong. Absent on a field-level validation failure, where `fields` carries the detail instead.",
            "type": "string"
        },
        "object": {
            "description": "The resource the error concerns, when there is one.",
            "required": [
                "type",
                "id"
            ],
            "properties": {
                "type": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                }
            },
            "type": "object"
        },
        "action": {
            "description": "What to do next, naming the call or the panel page that does it. Absent when there is no corrective step.",
            "type": "string"
        },
        "fields": {
            "description": "Present when `error` is \"validation\" — one message per rejected field, keyed by the field name.",
            "type": "object",
            "additionalProperties": {
                "type": "string"
            }
        },
        "retry_after": {
            "description": "An RFC 3339 timestamp, the moment the request may be retried. Not every `rate_limited` refusal carries one.",
            "type": "string",
            "format": "date-time"
        }
    },
    "type": "object"
}

← REST API reference