Unkey · Schema

KeyResponseData

API KeysRate LimitingAuthenticationDeveloper PlatformAccess ControlIdentityAnalytics

Properties

Name Type Description
keyId string Unique identifier for this key.
start string First few characters of the key for identification.
enabled boolean Whether the key is enabled or disabled.
name string Human-readable name for this key.
meta object Custom metadata associated with this key.
createdAt integer Unix timestamp in milliseconds when key was created.
updatedAt integer Unix timestamp in milliseconds when key was last updated.
lastUsedAt integer Unix timestamp in milliseconds when key was last used for verification. This is an approximated value, accurate to within 5 minutes.
expires integer Unix timestamp in milliseconds when key expires (if set).
permissions array
roles array
credits object
identity object
plaintext string Decrypted key value (only when decrypt=true).
ratelimits array
View JSON Schema on GitHub

JSON Schema

unkey-keyresponsedata-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/KeyResponseData",
  "title": "KeyResponseData",
  "type": "object",
  "properties": {
    "keyId": {
      "type": "string",
      "minLength": 8,
      "maxLength": 255,
      "pattern": "^[a-zA-Z0-9_]+$",
      "description": "Unique identifier for this key.",
      "example": "key_1234567890abcdef"
    },
    "start": {
      "type": "string",
      "minLength": 1,
      "maxLength": 50,
      "description": "First few characters of the key for identification.",
      "example": "sk_test_abc123"
    },
    "enabled": {
      "type": "boolean",
      "description": "Whether the key is enabled or disabled.",
      "example": true
    },
    "name": {
      "type": "string",
      "maxLength": 255,
      "description": "Human-readable name for this key.",
      "example": "Production API Key",
      "x-go-type-skip-optional-pointer": true,
      "x-go-type-skip-optional-pointer-with-omitzero": true
    },
    "meta": {
      "type": "object",
      "additionalProperties": true,
      "maxProperties": 100,
      "description": "Custom metadata associated with this key.",
      "example": null,
      "x-go-type-skip-optional-pointer": true,
      "x-go-type-skip-optional-pointer-with-omitzero": true
    },
    "createdAt": {
      "type": "integer",
      "format": "int64",
      "minimum": 0,
      "maximum": 9223372036854776000,
      "description": "Unix timestamp in milliseconds when key was created.",
      "example": 1701425400000
    },
    "updatedAt": {
      "type": "integer",
      "format": "int64",
      "minimum": 0,
      "maximum": 9223372036854776000,
      "description": "Unix timestamp in milliseconds when key was last updated.",
      "example": 1701425400000,
      "x-go-type-skip-optional-pointer": true,
      "x-go-type-skip-optional-pointer-with-omitzero": true
    },
    "lastUsedAt": {
      "type": "integer",
      "format": "int64",
      "minimum": 0,
      "description": "Unix timestamp in milliseconds when key was last used for verification. This is an approximated value, accurate to within 5 minutes.",
      "example": 1701425400000,
      "x-go-type-skip-optional-pointer": true,
      "x-go-type-skip-optional-pointer-with-omitzero": true
    },
    "expires": {
      "type": "integer",
      "format": "int64",
      "minimum": 0,
      "maximum": 9223372036854776000,
      "description": "Unix timestamp in milliseconds when key expires (if set).",
      "example": 1735689600000,
      "x-go-type-skip-optional-pointer": true,
      "x-go-type-skip-optional-pointer-with-omitzero": true
    },
    "permissions": {
      "type": "array",
      "items": {
        "type": "string",
        "description": "List of permission slugs granted to this key."
      },
      "example": [
        "documents.read",
        "documents.write"
      ],
      "x-go-type-skip-optional-pointer": true,
      "x-go-type-skip-optional-pointer-with-omitzero": true
    },
    "roles": {
      "type": "array",
      "items": {
        "type": "string",
        "description": "List of roles assigned to this key."
      },
      "example": [
        "editor",
        "viewer"
      ],
      "x-go-type-skip-optional-pointer": true,
      "x-go-type-skip-optional-pointer-with-omitzero": true
    },
    "credits": {
      "$ref": "#/components/schemas/KeyCreditsData"
    },
    "identity": {
      "$ref": "#/components/schemas/Identity",
      "x-go-type-skip-optional-pointer": true,
      "x-go-type-skip-optional-pointer-with-omitzero": true
    },
    "plaintext": {
      "type": "string",
      "description": "Decrypted key value (only when decrypt=true).",
      "example": "sk_test_abc123def456",
      "x-go-type-skip-optional-pointer": true,
      "x-go-type-skip-optional-pointer-with-omitzero": true
    },
    "ratelimits": {
      "type": "array",
      "maxItems": 50,
      "items": {
        "$ref": "#/components/schemas/RatelimitResponse"
      },
      "x-go-type-skip-optional-pointer": true,
      "x-go-type-skip-optional-pointer-with-omitzero": true
    }
  },
  "required": [
    "keyId",
    "start",
    "createdAt",
    "enabled"
  ],
  "additionalProperties": false
}