{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amplerun-com/json-schema/amplerun-com-api-key-view-schema.json",
  "title": "ApiKeyView",
  "description": "API key metadata. The secret itself appears only in the creation response.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amplerun-com-account-api-openapi.yml#/components/schemas/ApiKeyView",
  "type": "object",
  "required": [
    "key_id",
    "label",
    "prefix",
    "scopes",
    "expires_at",
    "revoked_at",
    "created_at"
  ],
  "properties": {
    "key_id": {
      "$ref": "#/$defs/UUID"
    },
    "label": {
      "type": "string"
    },
    "prefix": {
      "type": "string",
      "description": "First 12 characters of the key, for recognising it."
    },
    "scopes": {
      "type": "array",
      "items": {
        "enum": [
          "renter",
          "host"
        ]
      }
    },
    "expires_at": {
      "anyOf": [
        {
          "$ref": "#/$defs/Rfc3339Utc"
        },
        {
          "type": "null"
        }
      ]
    },
    "revoked_at": {
      "anyOf": [
        {
          "$ref": "#/$defs/Rfc3339Utc"
        },
        {
          "type": "null"
        }
      ]
    },
    "created_at": {
      "$ref": "#/$defs/Rfc3339Utc"
    }
  },
  "$defs": {
    "Rfc3339Utc": {
      "type": "string",
      "format": "date-time",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?Z$"
    },
    "UUID": {
      "type": "string",
      "format": "uuid",
      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
    }
  }
}