{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/customdomain-ai/json-schema/customdomain-ai-api-key-schema.json",
  "title": "ApiKey",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/customdomain-ai-applications-api-openapi.yml#/components/schemas/ApiKey",
  "type": "object",
  "required": [
    "id",
    "application_id",
    "name",
    "prefix",
    "environment",
    "is_default",
    "created_at"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "application_id": {
      "type": "string",
      "description": "The application the key belongs to."
    },
    "name": {
      "type": "string"
    },
    "prefix": {
      "type": "string",
      "description": "The stored, non-secret prefix that identifies the key, for example cd_live_ab12cd34."
    },
    "environment": {
      "$ref": "#/$defs/Environment"
    },
    "scopes": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "is_default": {
      "type": "boolean",
      "description": "true on the workspace default key (at most one active per workspace)."
    },
    "last_used_at": {
      "type": "string",
      "format": "date-time",
      "description": "When the key last authenticated a request. Absent until it has been used."
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "revoked_at": {
      "type": "string",
      "format": "date-time",
      "description": "When the key was revoked. Absent while the key is active."
    }
  },
  "$defs": {
    "Environment": {
      "type": "string",
      "enum": [
        "production",
        "staging",
        "development"
      ]
    }
  }
}