Skip to main content

API Overview

The MemoryRelay API provides persistent memory storage and retrieval for AI agents. All endpoints follow RESTful conventions and return JSON responses.

Base URL

https://api.memoryrelay.net

All endpoints are versioned under the /v1/ prefix (or /v2/ for async operations).

Content Type

All requests must include the Content-Type: application/json header. All responses are returned as application/json.

Authentication

Every request (except GET /v1/health) must include an API key using one of two methods:

MethodHeaderExample
Bearer tokenAuthorizationAuthorization: Bearer mem_prod_abc123...
API key headerX-API-KeyX-API-Key: mem_prod_abc123...

Both methods are equivalent. Use whichever fits your application. See API Keys for key management.

tip

API keys are prefixed with mem_prod_ and should be stored securely. The full key is only shown once at creation time.

Error Responses

All errors return a consistent JSON structure:

{
"type": "not_found",
"message": "Memory not found",
"code": 404,
"request_id": "req_a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
FieldTypeDescription
typestringMachine-readable error type (validation_error, not_found, unauthorized, rate_limit_exceeded, internal_error)
messagestringHuman-readable error description
codeintegerHTTP status code
request_idstringUnique request identifier for debugging

Validation errors include field-level details:

{
"type": "validation_error",
"message": "Request validation failed",
"code": 422,
"request_id": "req_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"details": [
{
"field": "content",
"message": "Content cannot be empty or whitespace"
}
]
}

Common HTTP Status Codes

CodeMeaning
200Success
201Resource created
202Accepted (async processing)
204Deleted (no content)
400Bad request
401Unauthorized (missing or invalid API key)
403Forbidden (insufficient scopes)
404Resource not found
422Validation error
429Rate limit exceeded
500Internal server error

Pagination

List endpoints support cursor-based pagination:

ParameterTypeDefaultDescription
limitinteger20Number of results per page (1-100)
offsetinteger0Number of results to skip

Paginated responses include metadata:

{
"object": "list",
"data": [...],
"has_more": true,
"next_cursor": "cursor_abc123",
"total_count": 142
}

Rate Limiting

The API enforces rate limits per API key. Rate limit status is returned in response headers:

HeaderDescription
X-RateLimit-LimitMaximum requests allowed per window
X-RateLimit-RemainingRequests remaining in current window
X-RateLimit-ResetUnix timestamp when the window resets

The default rate limit is 100 requests per minute. When exceeded, the API returns a 429 status code:

{
"type": "rate_limit_exceeded",
"message": "Rate limit exceeded. Try again in 42 seconds.",
"code": 429,
"request_id": "req_a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}

Request IDs

Every response includes an X-Request-ID header. You can also provide your own request ID for distributed tracing:

curl https://api.memoryrelay.net/v1/memories \
-H "Authorization: Bearer $MEMORYRELAY_API_KEY" \
-H "X-Request-ID: my-trace-id-12345"

The server will use your provided ID (or generate one if omitted). Include the request ID when contacting support for faster debugging.

Resources

ResourceDescription
MemoriesStore, search, and manage agent memories
AgentsCreate and manage agent namespaces
EntitiesKnowledge graph nodes and relationships
SessionsGroup memories by work sessions
DecisionsRecord and track architectural decisions
PatternsReusable coding patterns across projects
ProjectsRegister and scope work to projects
API KeysManage authentication keys
WebhooksEvent-driven notifications
v2 AsyncAsynchronous memory processing