Quickstart: Memory
Give your AI agent a memory that survives across sessions, projects, and tools. In this walkthrough you write one memory, wait for it to be ready, then search it back - about five minutes.
Get your API key
Memory uses a per-user key. Sign in at app.ragionex.com to receive yours - it starts with rgx_memory_. It is free, no credit card.
Keep the key server-side. Do not expose it in client-side code or public repositories.
Write a memory
Send a POST to /v1/memory/write with the fact in content and an organizational label in project. A new project name is created automatically on first write.
import requests response = requests.post( "https://api.ragionex.com/v1/memory/write", headers={"X-API-Key": "rgx_memory_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}, json={ "content": "User prefers TypeScript over JavaScript. Always use strict mode.", "project": "acme-app" } ) data = response.json() print(f"Memory ID: {data['id']} (status: {data['status']})")
const res = await fetch("https://api.ragionex.com/v1/memory/write", { method: "POST", headers: { "Content-Type": "application/json", "X-API-Key": "rgx_memory_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, body: JSON.stringify({ content: "User prefers TypeScript over JavaScript. Always use strict mode.", project: "acme-app" }) }); const data = await res.json();
curl -X POST https://api.ragionex.com/v1/memory/write \ -H "Content-Type: application/json" \ -H "X-API-Key: rgx_memory_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \ -d '{ "content": "User prefers TypeScript over JavaScript. Always use strict mode.", "project": "acme-app" }'
The response returns the memory id and a status of processing - the content is being prepared in the background and is not searchable yet.
{
"success": true,
"id": "mem_K7X2P9Q4R1",
"status": "processing",
"project": "acme-app"
} Wait until it is ready
Poll /v1/memory/status/{id} until status flips from processing to ready. Only ready memories appear in search results.
import requests, time while True: r = requests.get( "https://api.ragionex.com/v1/memory/status/mem_K7X2P9Q4R1", headers={"X-API-Key": "rgx_memory_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"} ).json() if r["status"] == "ready": break time.sleep(2)
const res = await fetch("https://api.ragionex.com/v1/memory/status/mem_K7X2P9Q4R1", { headers: { "X-API-Key": "rgx_memory_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" } }); const data = await res.json();
curl -X GET https://api.ragionex.com/v1/memory/status/mem_K7X2P9Q4R1 \
-H "X-API-Key: rgx_memory_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" {
"success": true,
"id": "mem_K7X2P9Q4R1",
"status": "ready"
} Search it back
Now POST to /v1/memory/search with a queries array of 1-5 natural-language questions (one question = a one-element array). Set project to keep the search scoped to one project, or omit it to search across every project at once.
import requests response = requests.post( "https://api.ragionex.com/v1/memory/search", headers={"X-API-Key": "rgx_memory_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}, json={ "queries": ["What programming language does the user prefer?"], "project": "acme-app" } ) data = response.json()
const res = await fetch("https://api.ragionex.com/v1/memory/search", { method: "POST", headers: { "Content-Type": "application/json", "X-API-Key": "rgx_memory_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }, body: JSON.stringify({ queries: ["What programming language does the user prefer?"], project: "acme-app" }) }); const data = await res.json();
curl -X POST https://api.ragionex.com/v1/memory/search \ -H "Content-Type: application/json" \ -H "X-API-Key: rgx_memory_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \ -d '{ "queries": ["What programming language does the user prefer?"], "project": "acme-app" }'
{
"success": true,
"results": [
{
"id": "mem_K7X2P9Q4R1",
"content": "User prefers TypeScript over JavaScript. Always use strict mode.",
"project": "acme-app"
}
]
} That is the full loop: write once, recall anywhere - in a new session next week, or from a different tool entirely.
You usually do not call these endpoints by hand. The Memory MCP server lets your AI agent save and recall memories automatically across Claude Code, Cursor, ChatGPT, and 500+ other clients with one config block.
Not sure which product you need? See Knowledge vs Memory. For every parameter, project operation, and error case, read the full Memory API reference.