{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/korely-ai/json-schema/korely-ai-search-body-schema.json",
  "title": "SearchBody",
  "x-generated": "2026-11-14",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/korely-ai-openapi.json#/components/schemas/SearchBody",
  "properties": {
    "query": {
      "type": "string",
      "maxLength": 2000,
      "minLength": 1,
      "title": "Query"
    },
    "user_id": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 255
        },
        {
          "type": "null"
        }
      ],
      "title": "User Id"
    },
    "agent_id": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 255
        },
        {
          "type": "null"
        }
      ],
      "title": "Agent Id"
    },
    "run_id": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 255
        },
        {
          "type": "null"
        }
      ],
      "title": "Run Id",
      "description": "Scope to one run/session."
    },
    "metadata": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Metadata",
      "description": "Filter on the metadata you stored at write time, e.g. {\"tier\": \"pro\"}. Keys are ANDed. A value matches the stored value compared as text (true, false and numbers as JSON writes them, so \"5\" matches 5), a number also matches an equal number (5 and 5.0), and null matches a stored null. Strings, numbers, booleans and null only: an object or an array is a 422. At most 32 keys and 8,192 bytes, what stored metadata may hold: past either it is a 422."
    },
    "limit": {
      "type": "integer",
      "maximum": 50.0,
      "minimum": 1.0,
      "title": "Limit",
      "default": 15
    },
    "exclude_sessions": {
      "type": "boolean",
      "title": "Exclude Sessions",
      "description": "Leave out the work sessions (memories written with `kind: session`, what a coding assistant's hooks save), for a read that wants what was said and decided. Default false: everything.",
      "default": false
    },
    "min_score": {
      "anyOf": [
        {
          "type": "number",
          "maximum": 1.0,
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Min Score",
      "description": "Leave out the memories whose `score` is below this, 0 to 1 (a cosine similarity, compared as the response shows it). Absent: no floor, every nearest memory comes back. Fewer than `limit` results can come back, none when nothing in the store is that close. A higher floor drops more of the weak matches and, past some value, true ones too: the right value depends on your texts and on the embedding model."
    },
    "types": {
      "items": {
        "type": "string",
        "enum": [
          "memories",
          "facts"
        ]
      },
      "type": "array",
      "maxItems": 2,
      "minItems": 1,
      "title": "Types",
      "description": "What to search, a list of kinds, each once: `memories` (the default, alone) the memories, as before 1.0.13; `facts` the facts true now (those GET /v1/facts lists, the ones written with POST /v1/facts included; one still waiting for its vector is listed there and found once it has it), by the cosine of their own vector. With both, each kind is ranked by its own score and the rankings are merged by rank (reciprocal rank fusion, k = 60: the first memory, the first fact, the second memory...), not by score: how a fact's cosine compares with a memory's was not measured. The order of the list does not matter; at equal rank a memory comes first, so with `limit: 1` the best memory is the answer whenever there is one. When the request names `types`, each result says its `type`. `run_id`, `metadata` and `min_score` narrow the memories only: with `facts` in the list each of them is a 422.",
      "default": [
        "memories"
      ]
    },
    "full_text": {
      "type": "boolean",
      "title": "Full Text",
      "description": "Also return each result's whole text as `content`: a memory's as it is stored, a fact's line (`subject · predicate · object`, its dates). `snippet` stays its first 280 characters. Default false: no `content` in the results. A memory can hold 16,000 characters, so a page of 50 whole memories can be large.",
      "default": false
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "query"
  ]
}