{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/lockally-com/json-schema/lockally-com-apikey-schema.json",
  "title": "APIKey",
  "x-generated": "2026-11-17",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/lockally-com-openapi.yml#/components/schemas/APIKey",
  "type": "object",
  "required": [
    "id",
    "tenant_id",
    "prefix",
    "scopes",
    "label",
    "created_at"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "tenant_id": {
      "type": "string",
      "format": "uuid"
    },
    "prefix": {
      "type": "string",
      "description": "8-char public prefix; safe to store and display."
    },
    "scopes": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "label": {
      "type": "string"
    },
    "last_used_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "revoked_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "test": {
      "type": "boolean",
      "description": "True for an lk_test_* key: the whole request path runs but a send never reaches the mail server and nothing counts against the account."
    },
    "expires_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When the key stops authenticating. Null means it does not expire,\nwhich is how every key behaved before expiry existed. Enforced at\nauthentication, so the key fails the first request after this\nmoment rather than whenever a sweep runs.\n"
    },
    "rotated_to": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "The successor issued by `POST /v1/api-keys/{id}/rotate`. Set on the\nPREDECESSOR, so you can see which key replaced this one while both\nstill work through the overlap window.\n"
    }
  }
}