REST APIMemories

Get memory

Get a memory.

GET/v1/agents/:agentId/memories/:memoryId

Overview

Memories are short notes an agent keeps between sessions, such as a user's preferences. Each belongs to one agent, and its userId cannot change. Use these endpoints to add, search, read, edit, and remove memories. Reading through the API does not change lastAccessedAt; the agent's own use does, and that decides which memory is removed first when the agent is full.

Endpoints

List memoriesGET/v1/agents/:agentId/memories

List an agent's memories.

Lists or searches an agent's memories, newest first, one page at a time. Pass nextCursor back as cursor for the next page. Reading memories here does not change their lastAccessedAt.

Request

Requires bearer authentication.

FieldTypeLocationRequiredDescription
agentIdstringpathrequiredID of the agent.
userIdstringqueryReturn only memories for this end user. Send an empty string for general memories, or leave it out for all memories.
searchstringqueryReturn only memories whose text matches these words.
cursorstringquerynextCursor from the previous page. Leave it out for the first page.
limitintegerqueryMaximum number of memories to return. 1–100. Defaults to 50.

Response

The memory.

Memoryobjectrequired

The memory.

Returns 200 OK as application/json. A page of memories.

Response schema: MemoryList.

{
  "data": [
    {
      "id": "mem_6Jd2Pq8LzR4wYk1C",
      "tenantId": "ten_8Hq2Zr5WcY1bJt6D",
      "agentId": "ag_4kP9sT2vXq7LmN3a",
      "userId": "user_42",
      "text": "Prefers concise answers.",
      "createdAt": "2026-07-10T10:00:00.000Z",
      "updatedAt": "2026-07-10T10:00:00.000Z",
      "lastAccessedAt": "2026-07-10T10:00:00.000Z"
    }
  ],
  "nextCursor": null
}

Errors

StatusCodesDescription
400validation_failed, invalid_cursorThe request is invalid
401unauthorizedThe credential is missing or invalid
402subscription_requiredAn active subscription or usage credit is required
404not_foundThe resource was not found

See REST errors for the error envelope and shared codes.

cURL

curl "$BLAZING_AGENTS_BASE_URL/v1/agents/ag_1234567890ABCDEF/memories" \
  --header "Authorization: Bearer $BLAZING_AGENTS_API_KEY"

Create memoryPOST/v1/agents/:agentId/memories

Create a memory.

Adds a memory to an agent. An agent keeps up to 500 memories; when it is full, the least recently used memory is removed to make room. The Location header points to the new memory.

Request

Requires bearer authentication and a JSON body.

FieldTypeLocationRequiredDescription
agentIdstringpathrequiredID of the agent.
textstringbodyrequiredThe note to remember, up to 10 KiB.
userIdstringbodyThe end user this memory belongs to. Only turns that pass the same userId see it. Leave it out or send an empty string for a general memory that every turn of the agent sees. It cannot change after creation. Defaults to "".

Response

The memory.

Memoryobjectrequired

The memory.

Returns 201 Created as application/json. The created memory. Sets Location: URL of the created memory.

Response schema: Memory.

{
  "memory": {
    "id": "mem_6Jd2Pq8LzR4wYk1C",
    "tenantId": "ten_8Hq2Zr5WcY1bJt6D",
    "agentId": "ag_4kP9sT2vXq7LmN3a",
    "userId": "user_42",
    "text": "Prefers concise answers.",
    "createdAt": "2026-07-10T10:00:00.000Z",
    "updatedAt": "2026-07-10T10:00:00.000Z",
    "lastAccessedAt": "2026-07-10T10:00:00.000Z"
  }
}

Errors

StatusCodesDescription
400validation_failedThe request is invalid
401unauthorizedThe credential is missing or invalid
402subscription_requiredAn active subscription or usage credit is required
404not_foundThe resource was not found

See REST errors for the error envelope and shared codes.

cURL

curl --request POST "$BLAZING_AGENTS_BASE_URL/v1/agents/ag_1234567890ABCDEF/memories" \
  --header "Authorization: Bearer $BLAZING_AGENTS_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{"text":"Prefers concise answers.","userId":"user_42"}'

Get memoryGET/v1/agents/:agentId/memories/:memoryId

Get a memory.

Retrieves one memory. Reading it here does not change its lastAccessedAt.

Request

Requires bearer authentication.

FieldTypeLocationRequiredDescription
agentIdstringpathrequiredID of the agent that owns the memory.
memoryIdstringpathrequiredID of the memory.

Response

The memory.

Memoryobjectrequired

The memory.

Returns 200 OK as application/json. The memory.

Response schema: Memory.

{
  "memory": {
    "id": "mem_6Jd2Pq8LzR4wYk1C",
    "tenantId": "ten_8Hq2Zr5WcY1bJt6D",
    "agentId": "ag_4kP9sT2vXq7LmN3a",
    "userId": "user_42",
    "text": "Prefers concise answers.",
    "createdAt": "2026-07-10T10:00:00.000Z",
    "updatedAt": "2026-07-10T10:00:00.000Z",
    "lastAccessedAt": "2026-07-10T10:00:00.000Z"
  }
}

Errors

StatusCodesDescription
400validation_failedThe request is invalid
401unauthorizedThe credential is missing or invalid
402subscription_requiredAn active subscription or usage credit is required
404not_foundThe resource was not found

See REST errors for the error envelope and shared codes.

cURL

curl "$BLAZING_AGENTS_BASE_URL/v1/agents/ag_1234567890ABCDEF/memories/mem_1234567890ABCDEF" \
  --header "Authorization: Bearer $BLAZING_AGENTS_API_KEY"

Update memoryPATCH/v1/agents/:agentId/memories/:memoryId

Update a memory.

Replaces a memory's text and marks it as used now, which moves it to the back of the line for removal when the agent is full. Its userId cannot change.

Request

Requires bearer authentication and a JSON body.

FieldTypeLocationRequiredDescription
agentIdstringpathrequiredID of the agent that owns the memory.
memoryIdstringpathrequiredID of the memory.
textstringbodyrequiredReplacement text for the memory, up to 10 KiB.

Response

The memory.

Memoryobjectrequired

The memory.

Returns 200 OK as application/json. The updated memory.

Response schema: Memory.

{
  "memory": {
    "id": "mem_6Jd2Pq8LzR4wYk1C",
    "tenantId": "ten_8Hq2Zr5WcY1bJt6D",
    "agentId": "ag_4kP9sT2vXq7LmN3a",
    "userId": "user_42",
    "text": "Prefers answers under five lines.",
    "createdAt": "2026-07-10T10:00:00.000Z",
    "updatedAt": "2026-07-10T10:15:00.000Z",
    "lastAccessedAt": "2026-07-10T10:15:00.000Z"
  }
}

Errors

StatusCodesDescription
400validation_failedThe request is invalid
401unauthorizedThe credential is missing or invalid
402subscription_requiredAn active subscription or usage credit is required
404not_foundThe resource was not found

See REST errors for the error envelope and shared codes.

cURL

curl --request PATCH "$BLAZING_AGENTS_BASE_URL/v1/agents/ag_1234567890ABCDEF/memories/mem_1234567890ABCDEF" \
  --header "Authorization: Bearer $BLAZING_AGENTS_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{"text":"Prefers answers under five lines."}'

Delete memoryDELETE/v1/agents/:agentId/memories/:memoryId

Delete a memory.

Permanently deletes a memory.

Request

Requires bearer authentication.

FieldTypeLocationRequiredDescription
agentIdstringpathrequiredID of the agent that owns the memory.
memoryIdstringpathrequiredID of the memory.

Response

The memory.

Memoryobjectrequired

The memory.

Returns 204 No Content. The memory was deleted.

Errors

StatusCodesDescription
400validation_failedThe request is invalid
401unauthorizedThe credential is missing or invalid
402subscription_requiredAn active subscription or usage credit is required
404not_foundThe resource was not found

See REST errors for the error envelope and shared codes.

cURL

curl --request DELETE "$BLAZING_AGENTS_BASE_URL/v1/agents/ag_1234567890ABCDEF/memories/mem_1234567890ABCDEF" \
  --header "Authorization: Bearer $BLAZING_AGENTS_API_KEY"

Next