API reference

API reference · API

Search a memory space by meaning

POST/v1/memories/searchAPI key

The query is embedded with the space's model, billed as this key, and the space's memories come back nearest first, held to user, the metadata filters (eq, ne, gt, gte, lt, lte, in, nin, and, or) and the threshold. A 404 at every path while the operator has not turned memory on.

Request body

application/json, required

Request body fields
FieldTypeWhat it is
queryrequiredstringAt most 4000 characters.
space_idstringAt most 100 characters.
userstring or null
filtersobject or nullOpenAI's attribute filter over each memory's metadata: { type: eq | ne | gt | gte | lt | lte | in | nin, key, value } or { type: and | or, filters: [...] }, nested.
top_kintegerFrom 1 to 100.
thresholdnumberFrom 0 to 1.

Example

{
  "query": "string"
}

Answer 200

The nearest memories with their scores.

Headers: x-antimatter-cost-micros

Fields of the 200 answer
FieldTypeWhat it is
object"list"
dataarray of object
data[].idstringmem_ and 24 hex digits.
data[].object"memory"
data[].space_idstring
data[].memorystringThe remembered text.
data[].userstring or nullYour end user it is about.
data[].metadataobject
data[].sourcestringOne of "explicit", "extracted", "chat", "agent".
data[].confidencenumber or null0 to 1, as the extraction gave it; null for a text written as is.
data[].scorenumberOn a search: cosine similarity, 0 to 1.
data[].created_atinteger
data[].updated_atinteger
first_idstring or null
last_idstring or null
has_moreboolean

Errors

  • 400OpenAI shaped error.
  • 401OpenAI shaped error.
  • 402OpenAI shaped error.
  • 404OpenAI shaped error.
  • 429Rate limited, or a spent budget or spend cap. The type distinguishes rate_limit_error, policy_exceeded, and spend_cap_exceeded.

Every error answers in one shape, with its type, code and the field it names. The whole list is in the docs' Errors section.

Antimatter