{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/h2o-ai/main/json-schema/h2o-ai-custom-agent-key-association-schema.json",
  "title": "CustomAgentKeyAssociation",
  "x-generated": "2026-10-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/h2o-ai-agents-api-openapi.yml#/components/schemas/CustomAgentKeyAssociation",
  "required": [
    "id",
    "agent_id",
    "env_key_name",
    "user_id",
    "requirement_type"
  ],
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Association UUID"
    },
    "agent_id": {
      "type": "string",
      "format": "uuid",
      "description": "Custom agent UUID"
    },
    "env_key_name": {
      "type": "string",
      "description": "Env var name (from envs.json or user-added)"
    },
    "key_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "Agent key UUID (null for placeholder associations)"
    },
    "user_id": {
      "type": "string",
      "format": "uuid",
      "description": "User UUID who owns the association"
    },
    "requirement_type": {
      "type": "string",
      "enum": [
        "required",
        "optional_with_default",
        "optional_no_default",
        "custom"
      ],
      "description": "From envs.json value or custom if assigned after the fact"
    },
    "key_name": {
      "type": [
        "string",
        "null"
      ],
      "description": "Agent key name"
    },
    "owner_email": {
      "type": [
        "string",
        "null"
      ],
      "description": "Agent key owner email"
    }
  }
}