{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/bamf-ai/json-schema/bamf-ai-agent-identity-operation-response-schema.json",
  "title": "AgentIdentityOperationResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/bamf-ai-agent-api-openapi.yml#/components/schemas/AgentIdentityOperationResponse",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "operation_ref",
    "data",
    "receipt"
  ],
  "properties": {
    "schema": {
      "const": "bamf.operation-result/v1"
    },
    "operation_ref": {
      "const": "bamf.agent.identity.read/v1"
    },
    "data": {
      "$ref": "#/$defs/AgentIdentity"
    },
    "receipt": {
      "type": "null"
    }
  },
  "$defs": {
    "AgentIdentity": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "user_id",
        "key_type",
        "email",
        "display_name",
        "creator_id",
        "creator_space",
        "default_creator_space",
        "recommended_creator_space",
        "accessible_creator_space_count",
        "scopes"
      ],
      "properties": {
        "user_id": {
          "type": "string",
          "minLength": 1
        },
        "key_type": {
          "enum": [
            "session",
            "user",
            "creator"
          ]
        },
        "email": {
          "type": [
            "string",
            "null"
          ],
          "description": "Authenticated BAMF account email when available."
        },
        "display_name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Authenticated BAMF account display name when available."
        },
        "creator_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "creator_space": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/AgentIdentityCreatorSpace"
            }
          ]
        },
        "default_creator_space": {
          "description": "Saved default creator space, returned only when it is inside the caller's effective creator-space access set.",
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/AgentIdentityCreatorSpace"
            }
          ]
        },
        "recommended_creator_space": {
          "description": "Sole accessible creator space suggested when no verified saved default exists; never silently promoted to the saved default.",
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/AgentIdentityCreatorSpace"
            }
          ]
        },
        "accessible_creator_space_count": {
          "type": "integer",
          "minimum": 0
        },
        "scopes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "AgentIdentityCreatorSpace": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "creator_id",
        "name"
      ],
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "creator_id": {
          "type": "string",
          "minLength": 1
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  }
}