Skip to main content

Memory API

Memory Management API​

Canonical page

docs/api/memories.md is the canonical reference for the Memory API. This page is the route-by-route companion for the API reference and must be kept in sync with it. When the two disagree, memories.md wins; fix this page rather than the other one.

All routes below require authentication:

X-API-Key: $LANONASIS_API_KEY

or

Authorization: Bearer $LANONASIS_ACCESS_TOKEN

Route index​

#OperationMethod and routeNotes
1Create memoryPOST /api/v1/memories
2List memoriesGET /api/v1/memories/listSummary rows only
3Get memoryGET /api/v1/memories/{id}Full record
4Update memoryPOST /api/v1/memories/updateid in the body
5Delete memoryPOST /api/v1/memories/delete?id={id}Soft delete
6Search memoriesGET /api/v1/memories/searchQuery parameters
7Search memoriesPOST /api/v1/memories/searchJSON body
8Memory statisticsGET /api/v1/memories/stats
9Bulk deletePOST /api/v1/memories/bulk-deleteUp to 100 ids
—PUT /api/v1/memories/{id}Not a working writeRouted to the read endpoint
—DELETE /api/v1/memories/{id}Not a working writeRouted to the read endpoint

The last two rows are documented at the end of this page because clients still reach for them. They answer 200 and change nothing.


POST /api/v1/memories​

Create a memory entry with optional metadata, tags, and a generated vector embedding (MCP tool create_memory).

Request​

Headers​

HeaderTypeRequiredDescription
X-API-KeystringYesAPI key (or Authorization: Bearer)
Content-TypestringYesapplication/json

Body​

ParameterTypeRequiredDescription
titlestringYesMemory title (max 255 chars)
contentstringYesMemory content
memory_typestringNocontext, project, knowledge, reference, personal, workflow
typestringNoMCP-compatible alias for memory_type
tagsarrayNoTags for categorization and filtering
metadataobjectNoCustom metadata object
topic_idstringNoOptional topic UUID
{
"title": "Meeting Notes",
"content": "Meeting notes from Q4 planning",
"memory_type": "meeting",
"tags": ["planning", "q4"],
"metadata": {
"source": "notebook"
}
}

Response​

201 Created​

{
"success": true,
"data": {
"id": "4a4a675f-2e35-4598-ae7a-1c1f35730226",
"title": "Meeting Notes",
"content": "Meeting notes from Q4 planning",
"memory_type": "meeting",
"type": "meeting",
"tags": ["planning", "q4"],
"metadata": {
"source": "notebook"
},
"created_at": "2026-10-15T10:30:00Z",
"updated_at": "2026-10-15T10:30:00Z"
}
}

Errors​

StatusCodeMeaning
400VALIDATION_ERRORMissing or invalid field, e.g. empty content
401UNAUTHORIZEDInvalid or missing credentials
429RATE_LIMITEDAccount or plan limit reached
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Text field is required",
"details": [
{ "field": "content", "message": "Required" }
],
"request_id": "req_123",
"timestamp": "2026-10-15T10:30:00Z"
}
}

Example​

curl -X POST https://api.lanonasis.com/api/v1/memories \
-H "X-API-Key: $LANONASIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Meeting Notes",
"content": "Meeting notes from Q4 planning",
"memory_type": "meeting",
"tags": ["planning", "q4"],
"metadata": { "source": "notebook" }
}'
import { createMemoryClient } from '@lanonasis/memory-client/core';

const client = createMemoryClient({
apiUrl: 'https://api.lanonasis.com',
apiKey: process.env.LANONASIS_API_KEY!,
});

const created = await client.createMemory({
title: 'Meeting Notes',
content: 'Meeting notes from Q4 planning',
memory_type: 'meeting',
tags: ['planning', 'q4'],
metadata: { source: 'notebook' },
});

console.log(created.data?.id);

Webhooks​

This endpoint triggers memory.created and embedding.generated.


GET /api/v1/memories/list​

List memory summaries with filtering and pagination (MCP tool list_memories). content and metadata are omitted from list rows; call GET /api/v1/memories/{id} for the full record, or pass include_preview=true for a bounded content_preview (max 200 chars).

Request​

GET /api/v1/memories/list

POST /api/v1/memories/list with the same fields in a JSON body is also accepted. A bare GET /api/v1/memories is not the list route — it is the create endpoint — so use /list explicitly.

Query parameters​

ParameterTypeRequiredDescription
limitintegerNoRows per page (1–50, default 20). Larger values are clamped to 50
offsetintegerNoOffset (default 0). Ignored in cursor mode
typestringNoFilter by memory type
tagsstringNoComma-separated tags
sortBystringNocreated_at, updated_at, or title (default updated_at)
sortOrderstringNoasc or desc (default desc)
include_previewbooleanNoAttach content_preview to each row
paginationstringNocursor to opt into keyset pagination
cursorstringNonext_cursor from the previous page; must reuse the same sortBy/sortOrder or the request is rejected with 400

Response​

{
"data": [
{
"id": "4a4a675f-2e35-4598-ae7a-1c1f35730226",
"title": "Project Requirements",
"memory_type": "project",
"tags": ["project", "requirements"],
"content_preview": "The new feature should include user authentication…",
"created_at": "2026-10-15T10:30:00Z",
"updated_at": "2026-10-16T14:22:00Z",
"access_count": 3
}
],
"pagination": {
"total": 25,
"limit": 10,
"offset": 0,
"page": 1,
"total_pages": 3,
"has_next": true,
"has_prev": false
}
}

Every response carries an ETag. Send it back as If-None-Match; unchanged results return 304 Not Modified with an empty body. In cursor mode the pagination object returns mode: "cursor", next_cursor, and no total.

Example​

curl -G https://api.lanonasis.com/api/v1/memories/list \
-H "X-API-Key: $LANONASIS_API_KEY" \
--data-urlencode "limit=10" \
--data-urlencode "type=project" \
--data-urlencode "sortBy=updated_at" \
--data-urlencode "sortOrder=desc" \
--data-urlencode "include_preview=true"

To include soft-deleted rows, add include_deleted=true.


GET /api/v1/memories/{id}​

Retrieve one memory by full UUID or an unambiguous UUID prefix of at least 8 characters (MCP tool get_memory).

Path parameters​

ParameterTypeRequiredDescription
idstringYesFull UUID or an unambiguous prefix of 8+ characters

Too-short prefixes are rejected; ambiguous prefixes return an error without leaking records outside the caller's scope. Query parameter include_deleted=true also returns a soft-deleted row.

Response​

{
"success": true,
"data": {
"id": "4a4a675f-2e35-4598-ae7a-1c1f35730226",
"title": "Project Requirements",
"content": "The new feature should include user authentication...",
"memory_type": "project",
"type": "project",
"tags": ["project", "requirements", "high-priority"],
"metadata": {
"project_id": "proj_123",
"author": "john.doe@company.com"
},
"topic_id": "3f5d2b3c-9d24-4f92-9b7a-3d2d95b9a1a1",
"created_at": "2026-10-15T10:30:00Z",
"updated_at": "2026-10-16T14:22:00Z",
"access_count": 5,
"last_accessed": "2026-10-16T09:15:00Z"
}
}

Example​

curl https://api.lanonasis.com/api/v1/memories/4a4a675f \
-H "X-API-Key: $LANONASIS_API_KEY"

Errors: 404 MEMORY_NOT_FOUND, 401 UNAUTHORIZED.


POST /api/v1/memories/update​

Update an existing memory's title, content, tags, or metadata (MCP tool update_memory). The id goes in the body.

Request​

POST /api/v1/memories/update
Use /update, not PUT /memories/{id}

Every method on /api/v1/memories/{id} is routed to the read endpoint, so PUT /api/v1/memories/{id} returns the memory unchanged and still answers 200. Send updates to /api/v1/memories/update with the id in the body.

Parameters​

ParameterTypeRequiredDescription
idstringYesID of the memory to update
titlestringNoUpdated title
contentstringNoUpdated content
tagsarrayNoReplacement tags array
metadataobjectNoReplacement metadata object

Example request​

curl -X POST https://api.lanonasis.com/api/v1/memories/update \
-H "X-API-Key: $LANONASIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"id": "4a4a675f-2e35-4598-ae7a-1c1f35730226",
"tags": ["project", "requirements", "reviewed"],
"metadata": { "status": "approved" }
}'

Example response​

{
"success": true,
"data": {
"id": "4a4a675f-2e35-4598-ae7a-1c1f35730226",
"title": "Project Requirements",
"tags": ["project", "requirements", "reviewed"],
"metadata": { "status": "approved" },
"updated_at": "2026-10-16T14:22:00Z"
}
}

Errors: 404 MEMORY_NOT_FOUND, 401 UNAUTHORIZED.


POST /api/v1/memories/delete?id={id}​

Soft-delete a memory (MCP tool delete_memory). The row is kept with deleted_at set, drops out of lists, search, and reads, and can be restored. Deleting an already-deleted memory succeeds again without changing it.

Request​

POST /api/v1/memories/delete?id={id}

DELETE with the same query string also works, as does {"id": "..."} in a POST body.

Use /delete, not DELETE /memories/{id}

DELETE /api/v1/memories/{id} reaches the read endpoint: it returns the memory and deletes nothing.

Parameters​

ParameterTypeRequiredDescription
idstringYesMemory ID to delete (query string or JSON body)

Example request​

curl -X POST "https://api.lanonasis.com/api/v1/memories/delete?id=4a4a675f-2e35-4598-ae7a-1c1f35730226" \
-H "X-API-Key: $LANONASIS_API_KEY"

Example response​

{
"success": true,
"message": "Memory 4a4a675f-2e35-4598-ae7a-1c1f35730226 deleted successfully",
"deleted_id": "4a4a675f-2e35-4598-ae7a-1c1f35730226"
}

Finding, restoring and purging deleted memories​

  • Find: GET /api/v1/memories/list?include_deleted=true returns deleted rows alongside live ones, and GET /api/v1/memories/{id}?include_deleted=true reads one. The MCP tool list_deleted_memories lists only deleted ones.
  • Restore: use the MCP tool restore_memory. There is no REST restore route.
  • Remove for good: the admin-only MCP tool purge_deleted_memories physically deletes soft-deleted rows, after a dry_run and a confirmation token.

GET /api/v1/memories/search​

Semantic vector search via query parameters (MCP tool search_memories).

Query parameters​

ParameterTypeRequiredDescription
querystringYesSearch text (alias: q)
typestringNoFilter by memory type (alias: memory_type)
thresholdnumberNoSimilarity threshold, 0–1 (default 0.55)
limitintegerNoMax results, 1–100 (default 10)
tagsstringNoComma-separated tags to filter by

Example​

curl -G https://api.lanonasis.com/api/v1/memories/search \
-H "X-API-Key: $LANONASIS_API_KEY" \
--data-urlencode "query=deployment checklist" \
--data-urlencode "limit=5" \
--data-urlencode "threshold=0.6"

Response​

{
"success": true,
"data": {
"results": [
{
"id": "4a4a675f-2e35-4598-ae7a-1c1f35730226",
"title": "Release decision",
"content": "Deploy only after the production smoke test passes.",
"memory_type": "context",
"similarity_score": 0.82
}
],
"total": 1,
"query": "deployment checklist",
"threshold": 0.6
}
}

POST /api/v1/memories/search​

The same semantic search with a JSON body. Prefer this form when the query contains characters that need escaping in a URL.

Body​

ParameterTypeRequiredDescription
querystringYesSearch text
typestringNoFilter by memory type
thresholdnumberNoSimilarity threshold, 0–1 (default 0.55)
limitintegerNoMax results, 1–100 (default 10)

Example​

curl -X POST https://api.lanonasis.com/api/v1/memories/search \
-H "X-API-Key: $LANONASIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "production smoke test", "limit": 5}'

The response shape is identical to the GET form. Errors: 400 VALIDATION_ERROR, 401 UNAUTHORIZED.


GET /api/v1/memories/stats​

Aggregate counts and usage statistics for the caller's memory scope (MCP tool memory_stats).

Response​

{
"data": {
"total_memories": 128,
"by_type": {
"context": 54,
"project": 41,
"knowledge": 33
},
"with_embeddings": 128,
"without_embeddings": 0,
"recent_activity": {
"created_last_24h": 3,
"updated_last_24h": 1,
"accessed_last_24h": 22
},
"top_tags": [
{ "tag": "project", "count": 41 },
{ "tag": "release", "count": 9 }
],
"storage": {
"embedding_dimension": 1536,
"model": "text-embedding-ada-002"
}
},
"organization_id": "6f1f3f56-6f0e-4f3a-9a4b-4f5d2b3c9d24",
"generated_at": "2026-10-16T14:30:00Z"
}

Example​

curl https://api.lanonasis.com/api/v1/memories/stats \
-H "X-API-Key: $LANONASIS_API_KEY"

Errors: 401 UNAUTHORIZED.


POST /api/v1/memories/bulk-delete​

Delete up to 100 memories in one request (MCP tool memory_bulk_delete). The nginx layer also accepts /memory/bulk/delete and the singular /memory/ prefix.

Body​

ParameterTypeRequiredDescription
idsarrayYes1–100 memory UUIDs
curl -X POST https://api.lanonasis.com/api/v1/memories/bulk-delete \
-H "X-API-Key: $LANONASIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"ids": ["4a4a675f-2e35-4598-ae7a-1c1f35730226", "9b2c1d4e-7f80-4a11-b2c3-d4e5f6071829"]}'

Response​

{
"success": true,
"message": "Deleted 2 memories",
"deleted_count": 2,
"deleted_ids": [
"4a4a675f-2e35-4598-ae7a-1c1f35730226",
"9b2c1d4e-7f80-4a11-b2c3-d4e5f6071829"
],
"not_found": [],
"not_authorized": []
}

not_found and not_authorized list ids that were skipped, so a partially successful request is still a 200. Errors: 400 VALIDATION_ERROR, 401 UNAUTHORIZED.


PUT /api/v1/memories/{id} — not a write​

Use /update, not PUT /memories/{id}

Every method on /api/v1/memories/{id} is routed to the read endpoint, so PUT /api/v1/memories/{id} returns the memory unchanged and still answers 200. Send updates to /api/v1/memories/update with the id in the body.

PUT on this path reaches the read function, not an update function. The response body is the current memory, updated_at does not move, and no write occurs. Any request body you send is ignored.

Use POST /api/v1/memories/update with id in the body instead:

curl -X POST https://api.lanonasis.com/api/v1/memories/update \
-H "X-API-Key: $LANONASIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"id": "4a4a675f-2e35-4598-ae7a-1c1f35730226", "title": "Updated title"}'

The singular legacy alias /api/v1/memory/{id} behaves the same way.


DELETE /api/v1/memories/{id} — not a delete​

Use /delete, not DELETE /memories/{id}

DELETE /api/v1/memories/{id} reaches the read endpoint: it returns the memory and deletes nothing.

DELETE on this path also reaches the read function. It answers 200 with the memory body, deleted_at is never set, and the record stays visible in lists and search. This is the failure mode worth knowing about: the call looks successful, so a client that trusts the status code will report a delete that never happened.

Use POST /api/v1/memories/delete?id={id} instead:

curl -X POST "https://api.lanonasis.com/api/v1/memories/delete?id=4a4a675f-2e35-4598-ae7a-1c1f35730226" \
-H "X-API-Key: $LANONASIS_API_KEY"

Verify a delete by re-reading with GET /api/v1/memories/{id} and expecting a 404, or by checking deleted_at with include_deleted=true.


Error codes​

CodeHTTP StatusDescription
MEMORY_NOT_FOUND404Memory with the specified ID does not exist
VALIDATION_ERROR400Invalid request parameters
CONTENT_TOO_LARGE413Memory content exceeds the size limit
QUOTA_EXCEEDED429Storage or rate limit exceeded
UNAUTHORIZED401Invalid or missing credentials

Request limits follow the account policy in effect; honor rate-limit response headers and retry only after the indicated interval rather than relying on hardcoded documentation values.


See also​