{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/UserApiKey",
  "title": "UserApiKey",
  "type": "object",
  "properties": {
    "object": {
      "type": "string",
      "description": "Distinguishes the API Key object.",
      "const": "api_key"
    },
    "id": {
      "type": "string",
      "description": "Unique identifier of the API Key.",
      "example": "api_key_01EHZNVPK3SFK441A1RGBFSHRT"
    },
    "owner": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "description": "The type of the API Key owner.",
          "example": "user",
          "const": "user"
        },
        "id": {
          "type": "string",
          "description": "Unique identifier of the API Key owner.",
          "example": "user_01EHZNVPK3SFK441A1RGBFSHRT"
        },
        "organization_id": {
          "type": "string",
          "description": "Unique identifier of the organization the API Key can access.",
          "example": "org_01EHZNVPK3SFK441A1RGBFSHRT"
        }
      },
      "required": [
        "type",
        "id",
        "organization_id"
      ],
      "description": "The entity that owns the API Key."
    },
    "name": {
      "type": "string",
      "description": "A descriptive name for the API Key.",
      "example": "Production API Key"
    },
    "obfuscated_value": {
      "type": "string",
      "description": "An obfuscated representation of the API Key value.",
      "example": "sk_...3456"
    },
    "last_used_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Timestamp of when the API Key was last used.",
      "example": null
    },
    "permissions": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "The permission slugs assigned to the API Key.",
      "example": [
        "posts:read",
        "posts:write"
      ]
    },
    "created_at": {
      "format": "date-time",
      "type": "string",
      "description": "An ISO 8601 timestamp.",
      "example": "2026-01-15T12:00:00.000Z"
    },
    "updated_at": {
      "format": "date-time",
      "type": "string",
      "description": "An ISO 8601 timestamp.",
      "example": "2026-01-15T12:00:00.000Z"
    }
  },
  "required": [
    "object",
    "id",
    "owner",
    "name",
    "obfuscated_value",
    "last_used_at",
    "permissions",
    "created_at",
    "updated_at"
  ]
}