{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/stealthstack-ai/json-schema/stealthstack-ai-search-request-schema.json",
  "title": "SearchRequest",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/stealthstack-ai-openapi.yaml#/components/schemas/SearchRequest",
  "type": "object",
  "required": [
    "query"
  ],
  "properties": {
    "query": {
      "allOf": [
        {
          "$ref": "#/$defs/QueryModel"
        },
        {
          "type": "object",
          "required": [
            "text"
          ],
          "properties": {
            "text": {
              "type": "string"
            }
          }
        }
      ]
    },
    "federation": {
      "type": "string",
      "enum": [
        "auto",
        "referrals",
        "none"
      ],
      "default": "auto",
      "description": "none = local only; referrals = local + registry pointers; auto (default) = spec \"query upstream and merge\": local results ranked together with filtered results from the configured peer registries (local only when none are configured), without referrals. Other values → 400.\n"
    },
    "pageSize": {
      "type": "integer",
      "default": 10,
      "maximum": 100
    },
    "pageToken": {
      "type": "string",
      "maxLength": 2048
    },
    "sensitive": {
      "type": "string",
      "enum": [
        "exclude",
        "include",
        "only"
      ],
      "default": "exclude",
      "description": "RESERVED StealthStack extension. Ignored (always `exclude`) unless the index is deployed with its sensitive opt-in flag on (off in production). Also accepted on /explore."
    }
  },
  "$defs": {
    "QueryFilter": {
      "type": "object",
      "maxProperties": 32,
      "description": "Structured constraints. Values within one key are OR'd; different keys are AND'd; a bare scalar is a 1-element array; an empty array is no constraint. When the record's value at a key/path is an array, the constraint matches if ANY element matches.\n\nSupported keys: `type` (exact media type), `kind`, `tags` (case-insensitive), `capabilities`, `version`, `publisher` (the `<publisher>` segment of the URN `urn:air:<publisher>:…`, case-insensitive; legacy `urn:ai:` too), `domain` (source.domain), `trust` (trust.status), `via` (source.via), `sensitive` (RESERVED: matches nothing unless the index's sensitive opt-in is on), `paid` (the payment protocol a record lists, case-insensitive; `x402` today), and literal dot-paths under `trustManifest.*` / `metadata.*` (JSON path on the raw member, traversing arrays; values compared as strings).\n\nAny other key — including namespaced `prefix:term` keys and full IRIs — is rejected with 400 INVALID_ARGUMENT naming the key.\n",
      "additionalProperties": {
        "oneOf": [
          {
            "type": "string",
            "maxLength": 512
          },
          {
            "type": "number"
          },
          {
            "type": "boolean"
          },
          {
            "type": "array",
            "maxItems": 64,
            "items": {
              "oneOf": [
                {
                  "type": "string",
                  "maxLength": 512
                },
                {
                  "type": "number"
                },
                {
                  "type": "boolean"
                }
              ]
            }
          }
        ]
      }
    },
    "QueryModel": {
      "description": "ARD v0.91 §5.3.1 query object shared by /search and /explore. Unknown members are ignored.\n",
      "type": "object",
      "properties": {
        "@context": {
          "description": "Optional JSON-LD context binding prefixes used in filter keys. Accepted and IGNORED by this index (namespaced filter keys are not supported, see `filter`).\n",
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "object"
            },
            {
              "type": "array"
            }
          ]
        },
        "text": {
          "type": "string",
          "maxLength": 1024,
          "description": "Free-text query. Bounded to bound abuse (a 1KB query is already far longer than any real search)."
        },
        "filter": {
          "$ref": "#/$defs/QueryFilter"
        }
      }
    }
  }
}