← Back to websiteHomeMemoraX API · v0.1.0
Developer documentation

Memorax API Developer Documentation

Documentation version 0.1.0 · Published 2026-11-06

Use Add to store user messages and Search to retrieve relevant memories, providing ongoing user context for your application.

Quick Start

Configure access

Prepare an API key with read and write permissions and use the official API root URL https://platform.memoraxai.com.

export MEMORAX_BASE_URL='https://platform.memoraxai.com'
export MEMORAX_API_KEY='YOUR_API_KEY'

Choose cURL, Python, or JavaScript. Python requires requests (pip install requests). JavaScript requires Node.js 18+ and an .mjs file.

Add memories

POST /v1/memories/add

Store the development requirements as code memories. Set content_type=code, provide session_id and metadata.source=memorax-code. The server generates the task ID automatically; save data.task_id from the response to query write status.

cURL
# metadata.source: currently required for code scenarios and must be memorax-code; this requirement will be removed soon.
# content_type: use auto for mixed scenarios and work for office productivity scenarios.
curl --request POST "$MEMORAX_BASE_URL/v1/memories/add" \
  --header "Authorization: Token $MEMORAX_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "user_id": "quickstart-user",
  "async_mode": true,
  "content_type": "code",
  "mode": "default",
  "session_id": "cedar-coding-session",
  "metadata": {
    "source": "memorax-code"
  },
  "messages": [
    {
      "role": "user",
      "content": "The Cedar callback module permits at most 3 delivery attempts. Retries reuse the same event_id, with a unique constraint preventing duplicate effects.",
      "timestamp": -1
    }
  ]
}'

Example response · HTTP 202

{
  "success": true,
  "data": {
    "task_id": "22222222-2222-4222-8222-222222222222",
    "status": "accepted",
    "data": null,
    "balances": []
  },
  "meta": {
    "request_id": "request-demo",
    "timestamp": "2026-11-06T00:00:00Z"
  }
}

status=accepted indicates that the write task was accepted. Query its processing status next.

Check write status

GET /v1/memories/add/status/{task_id}

Replace TASK_ID with data.task_id from the preceding Add response and run a single status request.

cURL
curl --request GET "$MEMORAX_BASE_URL/v1/memories/add/status/TASK_ID" \
  --header "Authorization: Token $MEMORAX_API_KEY"

Example response · HTTP 200

{
  "task_id": "22222222-2222-4222-8222-222222222222",
  "status": "success",
  "phase": "done",
  "memory": {
    "total": 1
  },
  "error": null
}
status Meaning Next step
processing Processing in progress Run the status request again later.
success Write succeeded Run Search.
failed Write failed Inspect error and retain task_id for troubleshooting.

Search memories

POST /v1/memories/search

After the task reports success, query the development requirements using the same user_id as Add.

cURL
curl --request POST "$MEMORAX_BASE_URL/v1/memories/search" \
  --header "Authorization: Token $MEMORAX_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "user_id": "quickstart-user",
  "query": "What retry and idempotency requirements apply to the Cedar callback module?",
  "mode": "fast",
  "output_mode": "summary",
  "top_k": 5
}'

Example response · HTTP 200

{
  "success": true,
  "data": {
    "task_id": "33333333-3333-4333-8333-333333333333",
    "status": "completed",
    "data": [
      {
        "id": "memory-demo",
        "memory": "Cedar callbacks allow at most 3 delivery attempts, reuse event_id on retries, and enforce idempotency with a unique constraint.",
        "content_type": "code",
        "user_id": "quickstart-user",
        "created_at": "2026-11-06T00:00:00Z",
        "updated_at": "2026-11-06T00:00:00Z"
      }
    ],
    "balances": []
  },
  "meta": {
    "request_id": "request-demo",
    "timestamp": "2026-11-06T00:00:00Z"
  }
}

Read memory from each entry in data.data and include the retrieved requirements in the Coding Agent context. For empty results, check user_id, task completion, and query conditions.

These responses illustrate the response structure. Actual task IDs and memory content come from the service. See Add request body, Asynchronous task status, and Search request body for field details.

Base URL and Authentication

Set MEMORAX_BASE_URL to the official URL https://platform.memoraxai.com/, without a trailing slash or /v1. The API key determines the account, project, and permissions. You can define user_id to identify the memory subject within the project; use the same value for Add and Search.

export MEMORAX_BASE_URL='https://platform.memoraxai.com'
export MEMORAX_API_KEY='YOUR_API_KEY'
Authorization: Token YOUR_API_KEY
Content-Type: application/json

Use Authorization: Token YOUR_API_KEY. Store API keys in environment variables or server-side configuration.

Request and response examples use synthetic data. Replace the example API key and business data before calling. Add requires write permission; Search and task status queries require read permission.

Add

POST /v1/memories/add

Submit dialogue, coding content, or documents to create searchable user memories. The default asynchronous mode returns a task ID. Use application/json for the request body.

Add examples

These examples store and retrieve callback requirements. Python uses requests, and JavaScript uses Node.js 18+.

cURL
curl --request POST "$MEMORAX_BASE_URL/v1/memories/add" \
  --header "Authorization: Token $MEMORAX_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "user_id": "demo-user",
  "async_mode": true,
  "messages": [
    {
      "role": "user",
      "content": "Cedar callbacks allow at most three retries.",
      "timestamp": -1
    },
    {
      "role": "assistant",
      "content": "Confirmed. The implementation will follow this requirement.",
      "timestamp": -1
    }
  ]
}'
View request JSON
{
  "user_id": "demo-user",
  "async_mode": true,
  "messages": [
    {
      "role": "user",
      "content": "Cedar callbacks allow at most three retries.",
      "timestamp": -1
    },
    {
      "role": "assistant",
      "content": "Confirmed. The implementation will follow this requirement.",
      "timestamp": -1
    }
  ]
}

Example response · HTTP 202, task accepted

The following example illustrates the response structure.

{
  "success": true,
  "data": {"task_id": "22222222-2222-4222-8222-222222222222", "status": "accepted", "data": null, "balances": []},
  "meta": {"request_id": "request-demo", "timestamp": "2026-11-03T00:00:00Z"}
}

The server automatically generates task_id; omit it from the Add request. Save data.task_id from the response and wait for task status=success before running Search.

Add request body

application/json. Select “Show properties” beneath a compound field to inspect its children. Expanding an array shows the structure of one element.

user_id

string · required · at least 1 character

You can define user_id to identify the user who owns these memories. Use a stable business user ID such as demo-user, and use the same value in subsequent Search requests. Account and project permissions are determined by the API key.

messages

Message[] · required for ordinary message writes · default []

Messages to process, in conversation order. Submit a single user message or multiple user and assistant turns. Each item contains role, content, and timestamp. Expand the properties below. Ordinary message writes require at least one item.

Show properties

Example field value · add.messages

This JSON shows the value at this level. Replace IDs, URLs, and content with your own data.

[
  {
    "role": "user",
    "content": "Retry a failed callback at most 3 times.",
    "timestamp": -1
  }
]
role

string · required · user / assistant

The sender role, either user or assistant.

content

string / object[] · required

The message body. Plain text must contain a non-whitespace character. A content-part array requires at least one item. Expand the text, image, and file structures below.

Show properties

Example field value · add.messages[].content

This JSON shows the value at this level. Replace IDs, URLs, and content with your own data.

[
  {
    "type": "input_text",
    "text": "Retry a failed callback at most 3 times."
  }
]
text / input_text · Text part

Example field value · add.messages[].content.text

This JSON shows the value at this level. Replace IDs, URLs, and content with your own data.

{
  "type": "input_text",
  "text": "Retry a failed callback at most 3 times."
}
type

string · required

Use text. The public endpoint also accepts input_text and normalizes it to text.

text

string · required

The text content, including at least one non-whitespace character.

input_image · Visual image

Base64 image example · add.messages[].content.input_image

Pass a Base64 Data URL with a MIME type prefix in image_url. This example is a 1×1 pixel PNG that illustrates the encoding format. Replace it with your image data and update caption. Only Base64 Data URLs are supported; HTTP(S) image URLs are not supported.

{
  "type": "input_image",
  "image_url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVR4nGP4//8/AAX+Av4N70a4AAAAAElFTkSuQmCC",
  "detail": "auto",
  "caption": "Sample pixel image"
}
type

string · required

The fixed value input_image.

image_url

string · required

Accepts only PNG/JPEG/WebP/GIF Base64 Data URLs with a MIME type prefix, such as data:image/png;base64,.... The field is named image_url, but HTTP(S) image URLs are not supported. Do not send a plain Base64 string without the Data URL prefix.

detail

string · optional · default auto

auto / low / high / original indicates the requested visual detail level. Behavior depends on model capabilities.

caption

string · optional · at most 4,000 characters

A nonblank image description supplied by the caller. When provided, visual caption generation is skipped.

file · File

New file upload example · add.messages[].content.file

Pass a Base64 Data URL with a MIME type prefix in file_data and a filename with an extension in filename. The example encodes Retry up to 3 times. followed by a newline. Replace the data and filename with your own; omit file_id for this upload.

{
  "type": "file",
  "file": {
    "file_data": "data:text/plain;base64,UmV0cnkgdXAgdG8gMyB0aW1lcy4K",
    "filename": "retry-rules.txt"
  }
}
type

string · required

The fixed value file.

file

object · required

Provide an existing file reference or new file data.

Show properties

New file upload example · add.messages[].content.file

Pass a Base64 Data URL with a MIME type prefix in file_data and a filename with an extension in filename. The example encodes Retry up to 3 times. followed by a newline. Replace the data and filename with your own; omit file_id for this upload.

{
  "file_data": "data:text/plain;base64,UmV0cnkgdXAgdG8gMyB0aW1lcy4K",
  "filename": "retry-rules.txt"
}
file_id

UUID string · exactly one of this field and file_data

Reference an existing file belonging to the current project and user_id.

file_data

string · exactly one of this field and file_id

Base64 data for a new file, optionally prefixed with a Data URL header. filename is required when this field is provided.

filename

string · required for new files

A filename with an extension, without directory components or control characters, up to 255 characters. Supported file types also depend on the service.

After submitting a file, save data.task_id from the Add acceptance response and query GET /v1/memories/add/status/{task_id}. See Asynchronous task status for the next step.

timestamp

integer · required

The message event time as a 13-digit Unix millisecond timestamp, or -1 when unspecified. Every message must include this field.

sender_id

string / null · optional

The sender identifier, supplementing role. Omit this field for file-part requests.

The default limit is 12,000 characters per ordinary message and 128,000 for code/default, subject to deployment configuration. Images and files have separate limits described under attachment constraints.

async_mode

boolean · optional · default true

Control whether the caller waits for processing. true returns HTTP 202 and a task ID, whose result is obtained through the status endpoint. false waits within the request and returns HTTP 200 on completion. Production environments require true. Synchronous writes are available in nonproduction environments that enable them.

mode

string · optional · default default

Select the input processing mode.

Value Purpose Conditions
default Extract and organize memories from the input. Default for ordinary dialogue, coding input, and document input.
raw Write memories using the original content. Used for raw-text writes.
pre_summarized Accept prepared coding summaries. Requires content_type=code, a coding session, and source metadata.

content_type

string · optional · default auto · enum code / work / auto / document

Select the content category and its validation and processing flow. Use code for coding conversations. Currently, session_id and metadata.source="memorax-code" are required. The requirement to provide metadata.source is planned to be removed soon; continue sending it until then. Submit documents through supported Responses-style file content parts with the required document content. The entry point determines the document type.

work: For work productivity scenarios.

auto: For mixed scenarios or when the specific scenario is uncertain; the server automatically determines the content type.

memory_output_language

string · optional · default zh · enum zh / en

Set the language of generated memories, zh for Chinese or en for English.

agent_id

string / null · optional · default null · at most 255 characters

Record the source Agent, such as coding-assistant. To restrict Search to that Agent, use an eq condition with the same value in filters. Omission leaves this source identifier unspecified.

app_id

string / null · optional · default null · at most 255 characters

Record the source application, such as desktop-client. A user may use several applications. Restrict Search to one application using an app_id condition in filters.

session_id

string / null · optional. required for code writes · default null · at most 255 characters

Associate the write with a conversation or coding session. Use the same ID across batches in one session, then filter by that session in Search. A session may contain multiple Add requests.

metadata

object / null · optional · default null

Attach source information and other metadata. Code scenarios currently require {"source":"memorax-code"}. The requirement to provide metadata.source is planned to be removed soon; continue sending it until then. Other attributes follow the deployment contract. Supported Search conditions are listed under filters.

Show properties

Example field value · add.metadata

This JSON shows the value at this level. Replace IDs, URLs, and content with your own data.

{
  "source": "memorax-code"
}
source

string · required for code writes

Currently required for code scenarios, with the value memorax-code. This requirement is planned to be removed soon; continue sending the field until then. Other attributes follow the deployment metadata contract. Search supports the documented filter keys.

timestamp

integer / null · optional · default null · 13-digit Unix milliseconds or -1

Provide a request-level event time used for event_created_at metadata. This is useful when importing events with their original occurrence time. -1 leaves this event time unspecified. Each messages[] item still requires its own timestamp.

add_only

boolean / null · optional · default null

Control operation decisions after extraction during ordinary memory writes. true skips add/update/delete decisions for summaries and Facts and treats them as additions. With false, omission, or null, operation decisions are performed. This option does not skip extraction or embedding, does not control Bucket updates, and does not apply to raw writes.

code_extraction_instructions

string / null · optional · at most 12,000 characters · only for code + default

Provide guidance for code-memory extraction, such as retaining confirmed compatibility constraints and decision rationale. This field guides extraction, while messages contains the conversation. Whitespace-only input is normalized to null. Supported with code/default.

chunk

object / null · optional · default null · only for code + default

Identify which client-generated chunk this submission represents. The client splits the input and submits each chunk separately. Expand the properties below.

Show properties
Code chunk properties

Example field value · add.chunk

This JSON shows the value at this level. Replace IDs, URLs, and content with your own data.

{
  "group_id": "callback-session-001",
  "index": 0,
  "count": 2
}
group_id

string · required · minimum characters 1 · maximum characters 512

Identify a group of chunks. All requests in a group use the same value. Length after trimming is 1–512 characters.

index

integer · required · minimum 0

The zero-based chunk position. It must be less than count and must be a strict integer.

count

integer · required · minimum 2

The total number of chunks in the group. A strict integer of at least 2 is required.

window_context

object[] · optional · default []

Provide recent conversation context for Bucket topic routing, for example {"role":"user","content":"Continue discussing callback retries"}. Put content to store in messages. The service retains at most the last 50 entries, then removes older entries to meet a 10,000-character content budget. A sole remaining oversized entry is retained.

Show properties

Example field value · add.window_context

This JSON shows the value at this level. Replace IDs, URLs, and content with your own data.

[
  {
    "role": "user",
    "content": "We just discussed callback retries."
  }
]

An array of free-form objects. Common properties are role and content, providing recent conversational context.

Add input combinations and attachment limits

Image, file, and message limits

Submit images using input_image with a Base64 Data URL. HTTP(S) image URLs are not supported. Default limits are 4 images per message, 8 per request, 8 MiB per image, 20 million pixels, and 16 frames, subject to configuration. input_image supports content_type="work" or "code" and requires mode="default". Code scenarios must still satisfy the current session_id and metadata.source requirements.

file allows up to 10 files per request in user messages. File input supports content_type="work" or "auto" and requires async_mode=true and mode="default". It does not support content_type="code" or sender_id. File IDs must be unique within the request. Existing IDs must belong to the current project and user_id. For image input, use input_image with a Base64 Data URL. The file limits here apply to document attachments.

The configurable default file-size limit is 20 MiB of original bytes. filename must use a supported extension from pdf, doc, docx, ppt, pptx, xls, xlsx, xlsm, jpg, jpeg, png, bmp, gif, md, markdown, html, epub, mobi, rtf, or txt. File parsing must be enabled. Query task status for parsing results.

Code write example
{
  "user_id": "demo-user",
  "content_type": "code",
  "mode": "default",
  "session_id": "coding-session-demo",
  "metadata": {"source": "memorax-code"},
  "messages": [{"role": "user", "timestamp": -1, "content": "Retries must reuse event_id. A unique constraint prevents duplicate charges."}]
}

pre_summarized requires code, session_id, and the source metadata above. Limits apply to individual messages and the total normalized summary length.

File write example
{
  "user_id": "demo-user",
  "messages": [{"role": "user", "timestamp": -1, "content": [
    {"type": "text", "text": "Read this example document."},
    {"type": "file", "file": {"filename": "cedar.txt", "file_data": "SGVsbG8gQ2VkYXI="}}
  ]}]
}

Add response · Accepted asynchronously (202)

success

boolean · optional · default true

The API success flag. Query task status for the result of an asynchronous Add.

data

object · required

The operation result object. Expand to inspect its response structure.

Show properties

Example response value · add.response.accepted.data

This JSON illustrates the value at this level. Actual response data may differ.

{
  "task_id": "22222222-2222-4222-8222-222222222222",
  "status": "accepted",
  "data": null,
  "balances": []
}
task_id

string · required

The server automatically generates the task ID; do not provide it in the Add request. Example: 22222222-2222-4222-8222-222222222222. Use data.task_id from an asynchronous Add response to query write status.

status

"accepted" · required

The response processing status. Allowed values are shown in the type declaration.

data

null · optional · default null

The asynchronous acceptance response returns null here. Query the task using task_id for its result.

balances

object[] · optional · default []

Quota and balance information returned for this operation, potentially empty.

Show properties

Example response value · add.response.accepted.data.balances

This JSON illustrates the value at this level. Actual response data may differ.

[
  {
    "product_code": "memory_api",
    "feature_code": "memory_write",
    "spec_key": "count",
    "quota_unit": "count",
    "quota_limit": 1000,
    "reserved": 1,
    "consumed": 20,
    "remaining": 979
  }
]
product_code

memory_api / chat_api / knowledge_base · required

The product associated with the balance, such as memory_api.

feature_code

memory_write / memory_search / chat_completion / knowledge_base · required

The feature associated with the balance, such as memory_write or memory_search.

spec_key

count / storage / calls / tokens · required

The quota dimension, such as count, storage, calls, or tokens. Interpret it together with quota_unit.

quota_unit

string · required

The measurement unit for quota values.

quota_limit

integer / null · optional · default null

The quota limit for this dimension. null indicates that the value was not provided.

reserved

integer · required · minimum 0

The nonnegative amount reserved, measured in quota_unit.

consumed

integer · required · minimum 0

The nonnegative amount consumed, measured in quota_unit.

remaining

integer / null · optional · default null

The remaining quota. null indicates that the value was not provided.

meta

object · required

Request tracing information for troubleshooting this call.

Show properties

Example response value · add.response.accepted.meta

This JSON illustrates the value at this level. Actual response data may differ.

{
  "request_id": "66666666-6666-4666-8666-666666666666",
  "timestamp": "2026-11-11T08:00:00Z"
}
request_id

string · required

The HTTP request trace identifier for correlation with service logs.

timestamp

string (date-time / ISO 8601 date-time) · required

The service response timestamp.

Add response · Completed synchronously (200)

success

boolean · optional · default true

The API success flag. Query task status for the result of an asynchronous Add.

data

object · required

The operation result object. Expand to inspect its response structure.

Show properties

Example response value · add.response.completed.data

This JSON illustrates the value at this level. Actual response data may differ.

{
  "task_id": "22222222-2222-4222-8222-222222222222",
  "status": "completed",
  "data": [
    {
      "id": "55555555-5555-4555-8555-555555555555",
      "event": "ADD",
      "data": {
        "memory": "Retry a failed callback at most 3 times."
      }
    }
  ],
  "balances": []
}
task_id

string · required

The server automatically generates the task ID; do not provide it in the Add request. Example: 22222222-2222-4222-8222-222222222222. Use data.task_id from an asynchronous Add response to query write status.

status

"completed" · required

The response processing status. Allowed values are shown in the type declaration.

data

object[] · required

Memory-change events produced by this synchronous write.

Show properties

Example response value · add.response.completed.data.data

This JSON illustrates the value at this level. Actual response data may differ.

[
  {
    "id": "55555555-5555-4555-8555-555555555555",
    "event": "ADD",
    "data": {
      "memory": "Retry a failed callback at most 3 times."
    }
  }
]
id

string · required

The identifier of the memory record affected by the change.

event

ADD / UPDATE / DELETE · required

The change action, ADD for creation, UPDATE for modification, or DELETE for removal.

data

object · required

The memory content associated with the event.

Show properties

Example response value · add.response.completed.data.data[].data

This JSON illustrates the value at this level. Actual response data may differ.

{
  "memory": "Retry a failed callback at most 3 times."
}
memory

string · required

The memory text available to the caller.

document_id

string / null · optional · default null

The stable document ID for a document event. It may be omitted for ordinary memories.

revision

integer / null · optional · default null

The document revision associated with the event, for subsequent update checks.

balances

object[] · optional · default []

Quota and balance information returned for this operation, potentially empty.

Show properties

Example response value · add.response.completed.data.balances

This JSON illustrates the value at this level. Actual response data may differ.

[
  {
    "product_code": "memory_api",
    "feature_code": "memory_write",
    "spec_key": "count",
    "quota_unit": "count",
    "quota_limit": 1000,
    "reserved": 1,
    "consumed": 20,
    "remaining": 979
  }
]
product_code

memory_api / chat_api / knowledge_base · required

The product associated with the balance, such as memory_api.

feature_code

memory_write / memory_search / chat_completion / knowledge_base · required

The feature associated with the balance, such as memory_write or memory_search.

spec_key

count / storage / calls / tokens · required

The quota dimension, such as count, storage, calls, or tokens. Interpret it together with quota_unit.

quota_unit

string · required

The measurement unit for quota values.

quota_limit

integer / null · optional · default null

The quota limit for this dimension. null indicates that the value was not provided.

reserved

integer · required · minimum 0

The nonnegative amount reserved, measured in quota_unit.

consumed

integer · required · minimum 0

The nonnegative amount consumed, measured in quota_unit.

remaining

integer / null · optional · default null

The remaining quota. null indicates that the value was not provided.

meta

object · required

Request tracing information for troubleshooting this call.

Show properties

Example response value · add.response.completed.meta

This JSON illustrates the value at this level. Actual response data may differ.

{
  "request_id": "66666666-6666-4666-8666-666666666666",
  "timestamp": "2026-11-11T08:00:00Z"
}
request_id

string · required

The HTTP request trace identifier for correlation with service logs.

timestamp

string (date-time / ISO 8601 date-time) · required

The service response timestamp.

Synchronous response JSON example
{
  "success": true,
  "data": {"task_id": "22222222-2222-4222-8222-222222222222", "status": "completed", "data": [{"id": "fact-demo", "event": "ADD", "data": {"memory": "Cedar callbacks allow at most three retries."}}], "balances": []},
  "meta": {"request_id": "request-demo", "timestamp": "2026-11-03T00:00:00Z"}
}

Asynchronous task status

GET /v1/memories/add/status/{task_id}

curl "$MEMORAX_BASE_URL/v1/memories/add/status/TASK_ID" \
  --header "Authorization: Token $MEMORAX_API_KEY"

A successful GET returns the task object directly. Top-level status is processing, success, or failed.

{"task_id":"22222222-2222-4222-8222-222222222222","status":"success","phase":"done","memory":{"total":1},"error":null}

The example above shows a successful ordinary task. Processing tasks may include kind. Document tasks may also provide kind, parser_record_id, parser_task_id, document_type, attempts, files, received_at, created_at, updated_at, and completed_at. files describes each file's parsing status and identifiers. Check every file in a multifile task. Ordinary task status is retained for 24 hours by default and may be removed earlier due to capacity. On 404, retain task_id and check visibility and retention.

files[].status describes an individual file’s parsing state; successful parsing does not mean the entire write task is complete. Continue querying while the top-level status=processing, and inspect errors if status=failed. Wait for top-level status=success before searching, and check each file’s result. Save the target file’s files[].parser_id for Search document_ids.

Example file status · one entry in files[]

{
  "parser_id": "22222222-2222-4222-8222-222222222222",
  "file_index": 0,
  "status": "success"
}
Field Purpose
task_id The write task ID returned by Add.
status processing, success, or failed, indicating whether the task has reached a final state.
phase The current processing phase, such as done on success. Use status to determine the task outcome.
kind The task type, when provided by the processing flow.
memory A write-result summary. For ordinary successful tasks, total is the number of write results.
error Failure details, usually null when there is no error.
parser_record_id The document parsing record identifier.
parser_task_id The parsing service task identifier.
document_type The document processing type.
attempts The recorded number of processing attempts.
files Per-file parsing results. file_index identifies the file, status describes its parsing state, and parser_id scopes document retrieval to that file.
received_at The task receipt time.
created_at The task record creation time.
updated_at The latest task status update time.
completed_at The completion time, potentially null while processing.

POST /v1/memories/search

Search stored memories within the user’s scope using fast direct retrieval. The output mode selects summaries, facts, or raw content.

Search examples

These examples store and retrieve callback requirements. Python uses requests, and JavaScript uses Node.js 18+.

cURL
curl --request POST "$MEMORAX_BASE_URL/v1/memories/search" \
  --header "Authorization: Token $MEMORAX_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "user_id": "demo-user",
  "query": "How should Cedar callbacks be retried?",
  "mode": "fast",
  "output_mode": "summary",
  "top_k": 5
}'
View request JSON
{
  "user_id": "demo-user",
  "query": "How should Cedar callbacks be retried?",
  "mode": "fast",
  "output_mode": "summary",
  "top_k": 5
}

Example response · HTTP 200, query completed

The following example illustrates the response structure.

{
  "success": true,
  "data": {
    "task_id": "33333333-3333-4333-8333-333333333333",
    "status": "completed",
    "data": [{
      "id": "summary-demo", "memory": "Cedar callbacks allow at most three retries.",
      "score": 0.82,
      "score_details": {"rank_method": "semantic_similarity", "rank_score": 0.82, "semantic_similarity": 0.82},
      "user_id": "demo-user", "content_type": "dialogue",
      "created_at": "2026-11-03T00:00:00Z", "updated_at": "2026-11-03T00:00:00Z",
      "metadata": {}, "categories": [], "immutable": false
    }],
    "balances": [], "buckets": null,
    "meta_info": {"mode": "fast", "pipeline_status": "fast_search", "recall_decision": null}
  },
  "meta": {"request_id": "request-demo", "timestamp": "2026-11-03T00:00:00Z"}
}

Search request body

application/json. Select “Show properties” beneath a compound field to inspect its children. Expanding an array shows the structure of one element.

user_id

string · required

Specify the user whose memories to retrieve. You can define user_id; use the same value as Add. The API key determines the account and project, and this field selects the memory subject within that authorized scope.

query

string / null · required for ordinary search · at most 1,024 characters

Describe the information to retrieve in natural language, such as callback retry rules. query must contain a non-whitespace character.

mode

string · optional · default fast · enum fast

fast directly retrieves stored memories. Results depend on the query and available memories.

output_mode

string · optional · deployment-defined default; default summary

Select result granularity. summary returns summaries, facts returns individual facts, raw requests original content. Document-only searches (sources=["document"]) default to facts when this field is omitted. See output modes and response structures below.

return_raw_text

boolean · optional · default false

Applies only to output_mode=summary; facts output ignores this parameter. When true, display original text when available. If it is missing, the service attempts to recover it from the original input; if still unavailable, it falls back to the summary and marks raw_text_missing. Returned content is subject to the server size limit, which defaults to 32 MiB. Exceeding the limit produces an error.

sources

string[] / null · optional · default null · 1–2 unique items when provided

Restrict retrieval by source, using dialogue and/or document. For documents only, use ["document"]. Omission uses the service's existing source scope.

Searching uploaded documents: Explicitly set sources: ["document"] to search content produced by file uploads. Document retrieval returns matching chunks: output_mode: "facts" returns original document chunks rather than extracted facts. Using summary, raw, or enabling return_raw_text does not guarantee the complete text of the entire document.

document_ids

string[] / null · optional · 1–100 items when provided

Restrict retrieval to specific documents and also set sources: ["document"]. For uploaded files, use the target file’s files[].parser_id from the task status as its document ID, not the Add task_id. Use the same project and user_id as the upload.

Document filter example · relevant Search request fields

{
  "sources": [
    "document"
  ],
  "document_ids": [
    "22222222-2222-4222-8222-222222222222"
  ]
}

filters

object / null · optional · default null

Filter by source Agent, application, session, memory type, or creation time. Combine supported operators in and and or arrays. Expand the properties below. Only documented filter fields are supported.

Show properties

Example field value · search.filters

This JSON shows the value at this level. Replace IDs, URLs, and content with your own data.

{
  "and": [
    {
      "session_id": {
        "eq": "callback-session-001"
      }
    },
    {
      "created_at": {
        "gte": "2026-11-01T00:00:00Z",
        "lt": "2026-12-01T00:00:00Z"
      }
    }
  ]
}
and

object[] / null · optional

Every condition in the array must match. Conflicting repeated identity values are rejected. Repeated time bounds are merged using the stricter bounds.

Show properties

Example field value · search.filters.and

This JSON shows the value at this level. Replace IDs, URLs, and content with your own data.

[
  {
    "session_id": {
      "eq": "callback-session-001"
    }
  },
  {
    "created_at": {
      "gte": "2026-11-01T00:00:00Z"
    }
  }
]
agent_id

object / null · optional

Restrict by source Agent.

Show properties

Example field value · search.filters.condition.agent_id

This JSON shows the value at this level. Replace IDs, URLs, and content with your own data.

{
  "eq": "agent-a"
}
eq

string · required when this condition is provided

Match the source ID exactly, using a nonempty string of at most 255 characters.

app_id

object / null · optional

Restrict by source application.

Show properties

Example field value · search.filters.condition.app_id

This JSON shows the value at this level. Replace IDs, URLs, and content with your own data.

{
  "eq": "demo-app"
}
eq

string · required when this condition is provided

Match the source ID exactly, using a nonempty string of at most 255 characters.

session_id

object / null · optional

Restrict by source session.

Show properties

Example field value · search.filters.condition.session_id

This JSON shows the value at this level. Replace IDs, URLs, and content with your own data.

{
  "eq": "callback-session-001"
}
eq

string · required when this condition is provided

Match the source ID exactly, using a nonempty string of at most 255 characters.

mem_type

object / null · optional

Restrict memory type using exactly one of eq or in. An and array allows at most one mem_type condition.

Show properties

Example field value · search.filters.condition.mem_type

This JSON shows the value at this level. Replace IDs, URLs, and content with your own data.Category names are illustrative; use categories present in your memories.

{
  "in": [
    "preference",
    "constraint"
  ]
}
eq

string · exactly one of this field and in

Specify one nonempty memory type.

in

string[] · exactly one of this field and eq

A nonempty collection of nonempty allowed types. Values are trimmed and deduplicated.

created_at

object / null · optional

Filter creation time using date strings.

Show properties

Example field value · search.filters.condition.created_at

This JSON shows the value at this level. Replace IDs, URLs, and content with your own data.

{
  "gte": "2026-11-01T00:00:00Z",
  "lt": "2026-12-01T00:00:00Z"
}
eq

string · optional

Equal to. Use an ISO date or timezone-aware date-time string.

gt

string · optional

Later than. Use an ISO date or timezone-aware date-time string.

gte

string · optional

At or after. Use an ISO date or timezone-aware date-time string.

lt

string · optional

Earlier than. Use an ISO date or timezone-aware date-time string.

lte

string · optional

At or before. Use an ISO date or timezone-aware date-time string.

or

object[] / null · optional

At least one condition must match. When and is also provided, both groups constrain retrieval.

Show properties

Example field value · search.filters.or

This JSON shows the value at this level. Replace IDs, URLs, and content with your own data.

[
  {
    "agent_id": {
      "eq": "agent-a"
    }
  },
  {
    "agent_id": {
      "eq": "agent-b"
    }
  }
]
agent_id

object / null · optional

Restrict by source Agent.

Show properties

Example field value · search.filters.condition.agent_id

This JSON shows the value at this level. Replace IDs, URLs, and content with your own data.

{
  "eq": "agent-a"
}
eq

string · required when this condition is provided

Match the source ID exactly, using a nonempty string of at most 255 characters.

app_id

object / null · optional

Restrict by source application.

Show properties

Example field value · search.filters.condition.app_id

This JSON shows the value at this level. Replace IDs, URLs, and content with your own data.

{
  "eq": "demo-app"
}
eq

string · required when this condition is provided

Match the source ID exactly, using a nonempty string of at most 255 characters.

session_id

object / null · optional

Restrict by source session.

Show properties

Example field value · search.filters.condition.session_id

This JSON shows the value at this level. Replace IDs, URLs, and content with your own data.

{
  "eq": "callback-session-001"
}
eq

string · required when this condition is provided

Match the source ID exactly, using a nonempty string of at most 255 characters.

mem_type

object / null · optional

Restrict memory type using exactly one of eq or in. An and array allows at most one mem_type condition.

Show properties

Example field value · search.filters.condition.mem_type

This JSON shows the value at this level. Replace IDs, URLs, and content with your own data.Category names are illustrative; use categories present in your memories.

{
  "in": [
    "preference",
    "constraint"
  ]
}
eq

string · exactly one of this field and in

Specify one nonempty memory type.

in

string[] · exactly one of this field and eq

A nonempty collection of nonempty allowed types. Values are trimmed and deduplicated.

created_at

object / null · optional

Filter creation time using date strings.

Show properties

Example field value · search.filters.condition.created_at

This JSON shows the value at this level. Replace IDs, URLs, and content with your own data.

{
  "gte": "2026-11-01T00:00:00Z",
  "lt": "2026-12-01T00:00:00Z"
}
eq

string · optional

Equal to. Use an ISO date or timezone-aware date-time string.

gt

string · optional

Later than. Use an ISO date or timezone-aware date-time string.

gte

string · optional

At or after. Use an ISO date or timezone-aware date-time string.

lt

string · optional

Earlier than. Use an ISO date or timezone-aware date-time string.

lte

string · optional

At or before. Use an ISO date or timezone-aware date-time string.

top_k

integer · optional · default 10 · 1–50

Provide the default candidate count for both dense and sparse retrieval. When neither k_dense nor k_sparse is specified, each uses top_k, yielding up to 2 × top_k candidates across the two channels. This does not cap the final results at top_k. For example, top_k=5 alone requests 5 from each channel, for up to 10 in total.

An explicit k_dense or k_sparse overrides only its own channel; an unspecified channel still uses top_k. The combined candidate limit is the effective k_dense + k_sparse. Deduplication, filtering, available candidates, and subsequent result processing may reduce the actual number returned; a full count is not guaranteed.

Example parametersDense candidatesSparse candidatesCombined candidate limit
{"top_k": 5}5510
{"top_k": 5, "k_dense": 3}358
{"k_dense": 3, "k_sparse": 2}325
{"top_k": 5, "k_sparse": 0}50 (disabled)5

k_dense

integer / null · optional · 0–50 · defaults to top_k

Set the dense retrieval candidate count to match similar meanings across different wording. If omitted, this uses top_k. An explicit value overrides only the dense channel and does not change k_sparse. Set 0 to disable dense retrieval. See top_k above for the relationship between the two channels and examples.

k_sparse

integer / null · optional · 0–50 · defaults to top_k

Set the sparse retrieval candidate count for keyword and terminology matches. If omitted, this uses top_k. An explicit value overrides only the sparse channel and does not change k_dense. Set 0 to disable sparse retrieval; for dense-only retrieval, set k_sparse to 0 and keep dense retrieval enabled. See top_k above for count relationships and examples.

min_semantic_similarity

number / null · optional · 0–1 · service threshold when omitted

Set the minimum semantic similarity for dense retrieval before fusion. A higher threshold may reduce irrelevant results and may also exclude useful memories.

window_context

object[] · optional · default []

Provide recent conversation context, including references to earlier discussion.

Show properties

Example field value · search.window_context

This JSON shows the value at this level. Replace IDs, URLs, and content with your own data.

[
  {
    "role": "user",
    "content": "We just discussed callback retries."
  }
]

Free-form recent conversation objects, commonly containing role and content, used for recall decisions and query rewriting.

Output modes and combinations

Mode Content Behavior
summary Summary text Summary-level results in data.data.
facts Individual facts Fine-grained results. Document-only searches default to facts when output_mode is omitted.
raw Original content Subject to content availability and the response-size limit.

return_raw_text=true applies to summary output. Document-only queries default to fast when mode is omitted.

Document search example
{
  "user_id": "demo-user",
  "query": "Callback retry rules",
  "sources": ["document"],
  "document_ids": ["cedar-design"],
  "mode": "fast",
  "output_mode": "facts"
}
Filter example
{
  "user_id": "demo-user", "query": "Callback retry rules",
  "filters": {"and": [
    {"session_id": {"eq": "coding-session-demo"}},
    {"created_at": {"gte": "2026-11-01T00:00:00Z"}}
  ]}
}

Search response · Ordinary results (200)

success

boolean · optional · default true

The processing result of this search request. true indicates a successful response.

data

object · required

The operation result object. Expand to inspect its response structure.

Show properties

Example response value · search.response.data

This JSON illustrates the value at this level. Actual response data may differ.

{
  "task_id": "33333333-3333-4333-8333-333333333333",
  "status": "completed",
  "data": [
    {
      "id": "55555555-5555-4555-8555-555555555555",
      "memory": "Retry a failed callback at most 3 times.",
      "score": 0.86,
      "score_details": {
        "rank_method": "semantic_similarity",
        "rank_score": 0.86,
        "semantic_similarity": 0.86
      },
      "user_id": "demo-user",
      "content_type": "dialogue",
      "created_at": "2026-11-11T08:00:00Z",
      "updated_at": "2026-11-11T08:00:00Z"
    }
  ],
  "balances": [],
  "meta_info": {
    "mode": "fast",
    "pipeline_status": "fast_search",
    "recall_decision": null
  }
}
task_id

string · required

The identifier used to trace this search request.

status

"completed" · required

The response processing status. Allowed values are shown in the type declaration.

data

object[] · required

The result array. An empty array indicates that this query returned no matching items.

Show properties

Example response value · search.response.data.data

This JSON illustrates the value at this level. Actual response data may differ.

[
  {
    "id": "55555555-5555-4555-8555-555555555555",
    "memory": "Retry a failed callback at most 3 times.",
    "score": 0.86,
    "score_details": {
      "rank_method": "semantic_similarity",
      "rank_score": 0.86,
      "semantic_similarity": 0.86
    },
    "user_id": "demo-user",
    "content_type": "dialogue",
    "created_at": "2026-11-11T08:00:00Z",
    "updated_at": "2026-11-11T08:00:00Z"
  }
]
id

string · required

The result identifier. Its granularity depends on the output mode.

memory

string · required

The memory text available to the caller.

score

number / null · optional · default null

The returned ranking score. score_details identifies its meaning.

score_details

object / null · optional · default null

Scores from retrieval and fusion stages. Expand for details.

Show properties
Score details

Example response value · search.response.data.data[].score_details

This JSON illustrates the value at this level. Actual response data may differ.

{
  "rank_method": "semantic_similarity",
  "rank_score": 0.86,
  "semantic_similarity": 0.86
}
rank_method

semantic_similarity / sparse_score / channel_rrf / query_rrf / null · optional · default null

The ranking method, semantic_similarity, sparse_score, channel_rrf, or query_rrf.

rank_score

number / null · optional · default null

The score produced by the current ranking method.

semantic_similarity

number / null · optional · default null

Semantic similarity from vector retrieval.

sparse_score

number / null · optional · default null

The match score from sparse retrieval.

channel_rrf

number / null · optional · default null

The rank-fusion score across retrieval channels.

query_rrf

number / null · optional · default null

The rank-fusion score across queries.

user_id

string · required

The user who owns the memory.

agent_id

string / null · optional · default null

The source Agent identifier.

app_id

string / null · optional · default null

The source application identifier.

session_id

string / null · optional · default null

The source session identifier.

project_id

string / null · optional · default null

The project associated with the result.

api_key_uuid

string / null · optional · default null

The source API key identifier.

content_type

dialogue / document / code / webpage · optional · default "dialogue"

The content category, dialogue, document, code, or webpage.

created_at

string (date-time / ISO 8601 date-time) · required

The record creation timestamp.

updated_at

string (date-time / ISO 8601 date-time) · required

The record's most recent update timestamp.

metadata

object · optional · default {}

Source information and other metadata. Supported search conditions are listed under filters.

categories

string[] · optional · default []

Memory category labels, potentially empty.

immutable

boolean · optional · default false

The immutable flag, default false.

balances

object[] · optional · default []

Quota and balance information returned for this operation, potentially empty.

Show properties

Example response value · search.response.data.balances

This JSON illustrates the value at this level. Actual response data may differ.

[
  {
    "product_code": "memory_api",
    "feature_code": "memory_search",
    "spec_key": "count",
    "quota_unit": "count",
    "quota_limit": 1000,
    "reserved": 0,
    "consumed": 21,
    "remaining": 979
  }
]
product_code

memory_api / chat_api / knowledge_base · required

The product associated with the balance, such as memory_api.

feature_code

memory_write / memory_search / chat_completion / knowledge_base · required

The feature associated with the balance, such as memory_write or memory_search.

spec_key

count / storage / calls / tokens · required

The quota dimension, such as count, storage, calls, or tokens. Interpret it together with quota_unit.

quota_unit

string · required

The measurement unit for quota values.

quota_limit

integer / null · optional · default null

The quota limit for this dimension. null indicates that the value was not provided.

reserved

integer · required · minimum 0

The nonnegative amount reserved, measured in quota_unit.

consumed

integer · required · minimum 0

The nonnegative amount consumed, measured in quota_unit.

remaining

integer / null · optional · default null

The remaining quota. null indicates that the value was not provided.

buckets

object / null · optional · default null

Optional compatible Bucket results, organized by type and canonical key.

meta_info

object / null · optional · default null

The search mode, processing state, and recall decision for this request.

Show properties
Retrieval information

Example response value · search.response.data.meta_info

This JSON illustrates the value at this level. Actual response data may differ.

{
  "mode": "fast",
  "pipeline_status": "fast_search",
  "recall_decision": null
}
mode

fast · required

The search mode is fast.

pipeline_status

stub / fast_search / query_rewrite_search / recall_bypassed · required

stub is a placeholder state, fast_search is direct retrieval, query_rewrite_search is rewritten-query retrieval, and recall_bypassed indicates skipped recall.

recall_decision

object / null · optional · default null

The recall-necessity decision. null indicates that it was not performed or not returned.

Show properties
Recall decision

Example response value · search.response.data.meta_info.recall_decision

This JSON illustrates the value at this level. Actual response data may differ.

{
  "needs_recall": true,
  "reason": "The question concerns previously stored callback requirements.",
  "confidence": 0.9
}
needs_recall

boolean · required

Whether the model considers memory retrieval necessary for this query.

reason

string · required

The model's reason for retrieving memories or skipping recall.

confidence

number · required · minimum 0 · maximum 1

Decision confidence from 0 to 1.

meta

object · required

Request tracing information for troubleshooting this call.

Show properties

Example response value · search.response.meta

This JSON illustrates the value at this level. Actual response data may differ.

{
  "request_id": "66666666-6666-4666-8666-666666666666",
  "timestamp": "2026-11-11T08:00:00Z"
}
request_id

string · required

The HTTP request trace identifier for correlation with service logs.

timestamp

string (date-time / ISO 8601 date-time) · required

The service response timestamp.

Error Handling

HTTP status Meaning Action
401 / 403 Authentication failure or insufficient permission Check the API key, Token prefix, and read/write permissions.
404 Task or resource unavailable, expired, or missing Check user_id, resource IDs, and retention. Retain task_id for troubleshooting.
413 Input exceeds size limits Adjust content or file size according to the relevant field limits.
415 Unsupported media type Use application/json.
422 Invalid field format or combination Check required fields, timestamps, enums, and combination constraints.
429 Rate limit or quota exceeded Check quota and response guidance, then back off according to service policy.
500 / 503 Processing error or temporary dependency failure Retain request_id and task_id and contact the service provider.

Error responses generally contain success=false, error, and meta. error may include code, reason, message, details, or hint. Inspect the actual response.

After Add returns HTTP 202, query task status until success. On failed, retain error and task_id. For empty Search results, check user_id, task completion, filters, and retrieval thresholds.

Version History

Documentation version Release date Included capabilities API path
0.1.0 2026-11-06 Dialogue and coding memory writes, asynchronous task status, Responses-style image and file input, fast search, filters, and summary, fact, and raw outputs. /v1