{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/athenahq-ai/json-schema/athenahq-ai-response-schema.json",
  "title": "Response",
  "description": "An AI model response",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/athenahq-ai-openapi.json#/components/schemas/Response",
  "type": "object",
  "required": [
    "schedule",
    "id",
    "website_id",
    "prompt_id",
    "base_prompt",
    "prompt",
    "model",
    "mentioned",
    "cited",
    "created_at",
    "competitors"
  ],
  "properties": {
    "schedule": {
      "description": "Streaming schedule provenance: default (including legacy history and ad hoc runs), or a custom/archived schedule UUID. Uses the catalog selection value, not a stock schedule UUID.",
      "oneOf": [
        {
          "type": "string",
          "enum": [
            "default"
          ]
        },
        {
          "type": "string",
          "format": "uuid"
        }
      ]
    },
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Unique identifier for the response"
    },
    "website_id": {
      "type": "string",
      "format": "uuid",
      "description": "Associated website ID"
    },
    "prompt_id": {
      "type": "string",
      "format": "uuid",
      "description": "Associated prompt ID"
    },
    "base_prompt": {
      "type": "string",
      "description": "Original prompt text"
    },
    "prompt": {
      "type": "string",
      "description": "Actual prompt variation used"
    },
    "model": {
      "type": "string",
      "description": "AI model that generated the response"
    },
    "response": {
      "type": "string",
      "description": "The AI-generated response text. Omitted when `include_response` is `false`."
    },
    "mentioned": {
      "type": "boolean",
      "description": "Whether your website was mentioned in the response"
    },
    "position": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Your website's rank/position in the response (null if not mentioned)"
    },
    "cited": {
      "type": "boolean",
      "description": "Whether your website was cited as a source"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp when the response was captured (UTC)"
    },
    "sources": {
      "type": "array",
      "description": "Sources cited in the response. Omitted when `compact_sources` is `true`; `source_domains` takes its place.",
      "items": {
        "$ref": "#/$defs/Source"
      }
    },
    "source_domains": {
      "type": "array",
      "description": "Deduped, alphabetically sorted root domains cited in the response. Hosts are lower-cased with any leading `www.` removed; subdomains are preserved, so `shop.example.com` stays distinct from `example.com`. Present only when `compact_sources` is `true`.",
      "items": {
        "type": "string"
      }
    },
    "competitors": {
      "type": "array",
      "description": "Competitors mentioned in the response",
      "items": {
        "$ref": "#/$defs/ResponseCompetitor"
      }
    }
  },
  "$defs": {
    "ResponseCompetitor": {
      "type": "object",
      "description": "A competitor mentioned in an AI response",
      "required": [
        "id",
        "name",
        "url",
        "position"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "Competitor ID"
        },
        "name": {
          "type": "string",
          "description": "Competitor name"
        },
        "url": {
          "type": "string",
          "description": "Competitor URL"
        },
        "position": {
          "type": "integer",
          "description": "Position/rank of competitor mention in the response"
        }
      }
    },
    "Source": {
      "type": "object",
      "description": "A source cited in an AI response",
      "required": [
        "url",
        "root_domain"
      ],
      "properties": {
        "url": {
          "type": "string",
          "description": "The source URL"
        },
        "normalized_url": {
          "type": [
            "string",
            "null"
          ],
          "description": "Normalized version of the URL"
        },
        "root_domain": {
          "type": "string",
          "description": "Root domain of the source"
        },
        "suffix": {
          "type": [
            "string",
            "null"
          ],
          "description": "Domain suffix"
        }
      }
    }
  }
}