{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/flashdata-dev/json-schema/flashdata-dev-api-key-schema.json",
  "title": "ApiKey",
  "description": "API key details. A key remains active until scheduledRevocationAt when revocation is scheduled.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/flashdata-dev-api-keys-api-openapi.yml#/components/schemas/ApiKey",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "name",
    "prefix",
    "last4",
    "scopes",
    "status",
    "createdAt"
  ],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^key_"
    },
    "name": {
      "type": "string"
    },
    "prefix": {
      "type": "string"
    },
    "last4": {
      "type": "string",
      "minLength": 4,
      "maxLength": 4
    },
    "scopes": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "revoked",
        "expired"
      ]
    },
    "lastUsedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "expiresAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "scheduledRevocationAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Planned revocation time for an overlapping retiring key; null for a primary or immediately revoked key."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    }
  }
}