// documentation

AgentRAM API Reference

Everything your AI agent needs to read and write persistent memory. All endpoints return JSON. Authentication is handled via an API key in the request header.

Quickstart

Three steps to give your agent a working memory.

Step 1: Register and get your API key

curl
curl -X POST https://api.agentram.dev/register \
  -H "Content-Type: application/json" \
  -d '{"email":"you@example.com"}'
response
{
  "success": true,
  "data": {
    "api_key": "agentram_7f3a9b2c...",
    "credits": 100
  }
}

Step 2: Store a memory

curl
curl -X POST https://api.agentram.dev/memory \
  -H "x-api-key: agentram_7f3a9b2c..." \
  -H "Content-Type: application/json" \
  -d '{"agent_id":"agent-01","key":"user_pref","value":"prefers short answers"}'

Step 3: Read it back in any later session

curl
curl https://api.agentram.dev/memory?agent_id=agent-01&key=user_pref \
  -H "x-api-key: agentram_7f3a9b2c..."
That's it. Your agent now has persistent memory that survives across sessions, devices, and restarts.

Authentication

Every request except /register requires your API key in the request header.

header
x-api-key: agentram_your_key_here

Requests without a valid API key return a 401 Unauthorized response. Keep your API key private. Treat it like a password.


Credits

AgentRAM uses a credit system. Each operation costs one credit. Credits are deducted only on success. If a request fails for any reason, your credit is returned automatically.

OperationCredit cost
POST /memory1 credit
GET /memory1 credit
GET /memories1 credit
GET /memory/search1 credit
DELETE /memory1 credit
POST /memory/shared1 credit
GET /memory/shared1 credit
GET /memories/shared1 credit
POST /namespace0 credits
GET /credits0 credits
POST /register0 credits
Running low? Check your balance with GET /credits at any time. Top up at agentram.dev/#pricing.

Endpoints

Register

POST /register

Creates a new account and returns an API key with 100 free credits. One account per email address.

Body paramTypeRequiredDescription
email string required Your email address. Used to identify your account.
response · 201
{
  "success": true,
  "data": {
    "email": "you@example.com",
    "api_key": "agentram_7f3a9b2c...",
    "credits": 100
  }
}

Write a memory

POST /memory

Stores a value under a key for a given agent. Writing to an existing key updates the value. No duplicates are created.

Body paramTypeRequiredDescription
agent_id string required A unique identifier for the agent. Max 100 characters.
key string required The memory label. Max 200 characters.
value string required What to remember. Max 5,000 characters.
ttl_days number optional Days until this memory expires automatically. Once expired, reads return 404 and the memory is excluded from lists and searches. Omit for memories that should not expire.
response · 200
{
  "success": true,
  "data": {
    "agent_id": "agent-01",
    "key": "user_pref",
    "credits_remaining": 99
  }
}

Read a memory

GET /memory

Retrieves a stored value by agent ID and key. Returns 404 if the memory does not exist, and refunds the credit.

Query paramTypeRequiredDescription
agent_id string required The agent identifier used when writing the memory.
key string required The memory label to retrieve.
response · 200
{
  "success": true,
  "data": {
    "agent_id": "agent-01",
    "key": "user_pref",
    "value": "prefers short answers",
    "created_at": "2026-05-09T18:00:00.000Z",
    "credits_remaining": 98
  }
}

Delete a memory

DELETE /memory

Permanently removes a stored memory. This cannot be undone.

Body paramTypeRequiredDescription
agent_idstringrequiredThe agent identifier.
keystringrequiredThe memory label to delete.
response · 200
{
  "success": true,
  "data": { "deleted": true, "credits_remaining": 97 }
}

Check credit balance

GET /credits

Returns the current credit balance for your account. This endpoint never deducts a credit. Safe to call as often as needed.

response · 200
{
  "success": true,
  "data": {
    "email": "you@example.com",
    "credits": 97
  }
}

List all memories for an agent

GET /memories

Returns all memories stored under a given agent ID, ordered by most recently written. Expired memories are silently excluded.

Query paramTypeRequiredDescription
agent_idstringrequiredThe agent identifier.
limitintegeroptionalMax results to return. Default 50, max 200.
response · 200
{
  "success": true,
  "data": [
    { "key": "user_lang", "value": "French", "created_at": "...", "expires_at": null },
    { "key": "tone", "value": "formal", "created_at": "...", "expires_at": null }
  ],
  "credits_remaining": 96
}
GET /memory/search

Case-insensitive text search across both the key and value fields for a given agent. Returns matching memories ordered by most recent. No embeddings or configuration required.

Query paramTypeRequiredDescription
agent_idstringrequiredThe agent identifier.
qstringrequiredThe search term. Matched against key and value fields.
response · 200
{
  "success": true,
  "data": [
    { "key": "user_lang", "value": "French", "created_at": "..." }
  ],
  "credits_remaining": 95
}

Shared memory

Shared namespaces allow multiple agents or API key holders to read and write to a common memory pool. Create a namespace first, then share the namespace_key with any agent that needs access.

Create a namespace

POST /namespace

Creates a new shared namespace and returns a unique namespace key. Free — costs no credits. Any agent with a valid API key and the namespace key can then read and write to that namespace.

Body paramTypeRequiredDescription
labelstringoptionalA human-readable name for the namespace. Max 100 characters.
response · 201
{
  "success": true,
  "data": { "namespace_key": "ns_a1b2c3d4...", "label": "team-alpha" }
}

Write a shared memory

POST /memory/shared

Writes a value to a shared namespace. Any API key holder who knows the namespace key can write. Supports optional TTL.

Body paramTypeRequiredDescription
namespace_keystringrequiredThe namespace key returned from POST /namespace.
keystringrequiredThe memory label. Max 200 characters.
valuestringrequiredWhat to store. Max 5,000 characters.
ttl_daysnumberoptionalDays until this memory expires automatically.

Read a shared memory

GET /memory/shared

Retrieves a value from a shared namespace by key.

Query paramTypeRequiredDescription
namespace_keystringrequiredThe namespace key.
keystringrequiredThe memory label to retrieve.

List all shared memories

GET /memories/shared

Returns all memories in a shared namespace, ordered by most recent. Expired memories are silently excluded.

Query paramTypeRequiredDescription
namespace_keystringrequiredThe namespace key.
limitintegeroptionalMax results. Default 50, max 200.

Error codes

All errors return a consistent shape with a success: false flag and a plain-language message.

StatusMeaningCommon cause
200SuccessRequest completed, memory read or written.
201CreatedNew account registered successfully.
400Bad requestMissing or invalid body parameters.
401UnauthorizedMissing or invalid API key.
402Payment requiredCredit balance is zero. Top up to continue.
404Not foundMemory does not exist. Credit refunded.
429Rate limitedToo many requests. Slow down and retry.
500Server errorSomething went wrong on our end. Try again shortly.
error shape
{
  "success": false,
  "error": "Insufficient credits"
}

Rate limits

EndpointLimitWindow
POST /register10 requestsPer hour, per IP
POST /memory60 requestsPer hour, per API key
GET /memory120 requestsPer hour, per API key
GET /memories120 requestsPer hour, per API key
GET /memory/search120 requestsPer hour, per API key
DELETE /memory60 requestsPer hour, per API key
POST /namespace20 requestsPer hour, per API key
POST /memory/shared60 requestsPer hour, per API key
GET /memory/shared120 requestsPer hour, per API key
GET /memories/shared120 requestsPer hour, per API key
GET /credits120 requestsPer hour, per API key
Global fallback60 requestsPer minute, per API key

Rate-limited requests return a 429 status. Credits are not deducted for rate-limited requests.


Code examples

Python

python
# pip install requests
import requests

API_KEY = "agentram_your_key_here"
BASE = "https://api.agentram.dev"
HEADERS = {"x-api-key": API_KEY, "Content-Type": "application/json"}

# Write a memory
requests.post(f"{BASE}/memory", json={
    "agent_id": "agent-01",
    "key": "user_language",
    "value": "French"
}, headers=HEADERS)

# Read it back
res = requests.get(f"{BASE}/memory",
    params={"agent_id": "agent-01", "key": "user_language"},
    headers=HEADERS)
print(res.json()["data"]["value"])  # → "French"

JavaScript / Node

javascript
const API_KEY = "agentram_your_key_here";
const BASE = "https://api.agentram.dev";
const headers = { "x-api-key": API_KEY, "Content-Type": "application/json" };

// Write a memory
await fetch(`${BASE}/memory`, {
  method: "POST", headers,
  body: JSON.stringify({ agent_id: "agent-01", key: "tone", value: "formal" })
});

// Read it back
const res = await fetch(`${BASE}/memory?agent_id=agent-01&key=tone`, { headers });
const { data } = await res.json();
console.log(data.value); // → "formal"
Need help? Email hello@agentram.dev and we'll get back to you within one business day.

© 2026 AgentRAM. All rights reserved.