Skip to content

API Reference

The Botmem REST API is served by a NestJS application on port 12412 (configurable via the PORT environment variable). All endpoints are prefixed with /api.

Base URL: http://localhost:12412/api

Interactive API Explorer

The full OpenAPI spec is auto-generated from source code. Try the Swagger UI for interactive exploration (available when your instance is running), or see the OpenAPI Schema page for type generation.

Authentication

All API endpoints require authentication (except GET /api/version). Include a Bearer token in the Authorization header:

bash
curl -H "Authorization: Bearer YOUR_TOKEN" http://localhost:12412/api/memories

Tokens can be:

  • Access tokens — obtained from POST /api/user-auth/login (15-minute lifetime)
  • API keys — created via POST /api/api-keys (no expiry, format: bm_sk_...)

See Authentication for full details on signup, login, token refresh, and recovery keys.

Response Format

All endpoints return JSON. Error responses follow this format:

json
{
  "error": "Description of the error"
}

Successful responses vary by endpoint — see the individual reference pages.

Endpoints Overview

User Auth

MethodPathDescription
POST/api/user-auth/registerCreate a new account
POST/api/user-auth/loginLogin with email/password
POST/api/user-auth/refreshRefresh access token (uses cookie)
POST/api/user-auth/recovery-keySubmit recovery key for decryption
POST/api/user-auth/logoutLogout (clears refresh cookie)
GET/api/meGet current user profile
PATCH/api/meUpdate user profile

API Keys

MethodPathDescription
GET/api/api-keysList API keys
POST/api/api-keysCreate an API key
DELETE/api/api-keys/:idRevoke an API key

Memories

MethodPathDescription
POST/api/memories/searchSemantic search across memories
GET/api/memoriesList memories with pagination
GET/api/memories/statsGet memory statistics
GET/api/memories/graphGet the relationship graph
GET/api/memories/:idGet a single memory
POST/api/memoriesCreate a manual memory
DELETE/api/memories/:idDelete a memory
POST/api/memories/retry-failedRetry failed embeddings

Full reference

Contacts

MethodPathDescription
GET/api/contactsList contacts
GET/api/contacts/suggestionsGet merge suggestions
GET/api/contacts/:idGet a contact
GET/api/contacts/:id/memoriesGet memories for a contact
PATCH/api/contacts/:idUpdate a contact
DELETE/api/contacts/:idDelete a contact
POST/api/contacts/searchSearch contacts
POST/api/contacts/:id/mergeMerge two contacts
POST/api/contacts/normalizeNormalize all contacts
POST/api/contacts/suggestions/dismissDismiss a merge suggestion

Full reference

Connectors

MethodPathDescription
GET/api/connectorsList all registered connectors
GET/api/connectors/:type/schemaGet config schema for a connector
GET/api/connectors/:type/statusGet connector status

Full reference

Accounts

MethodPathDescription
GET/api/accountsList all accounts
GET/api/accounts/:idGet a single account
POST/api/accountsCreate an account
PATCH/api/accounts/:idUpdate an account
DELETE/api/accounts/:idDelete an account

Auth (Connector OAuth)

MethodPathDescription
GET/api/auth/:type/has-credentialsCheck if credentials exist
POST/api/auth/:type/initiateStart auth flow
GET/api/auth/:type/callbackOAuth callback handler
POST/api/auth/:type/completeComplete auth flow

Jobs

MethodPathDescription
GET/api/jobsList all jobs
GET/api/jobs/queuesGet queue statistics
GET/api/jobs/:idGet a single job
POST/api/jobs/sync/:accountIdTrigger a sync
DELETE/api/jobs/:idCancel a job

Full reference

Agent API

MethodPathDescription
POST/api/agent/askAsk a question (AI-powered)
POST/api/agent/timelineBuild a timeline for a topic
POST/api/agent/contextGet context for a conversation
POST/api/agent/rememberStore a new memory
GET/api/agent/entitiesList extracted entities

Memory Banks

MethodPathDescription
GET/api/memory-banksList memory banks
POST/api/memory-banksCreate a memory bank
PATCH/api/memory-banks/:idUpdate a memory bank
DELETE/api/memory-banks/:idDelete a memory bank

Billing (Managed tier only)

MethodPathDescription
GET/api/billing/infoGet subscription status + memory quota
GET/api/billing/quotaGet memory quota usage (used, limit, remaining)
POST/api/billing/checkoutCreate Stripe checkout session
POST/api/billing/portalCreate Stripe customer portal link

Free plan: 500 memories total across all connectors. Pro plan: unlimited. Self-hosted: unlimited. Contacts are not counted toward the limit.

Settings

MethodPathDescription
GET/api/settingsGet all settings
PATCH/api/settingsUpdate settings

Logs

MethodPathDescription
GET/api/logsQuery NDJSON logs from data/logs.ndjson

WebSocket

PathDescription
ws://localhost:12412/eventsReal-time event gateway

Full reference

Version

MethodPathDescription
GET/api/versionGet server version (no auth required)

Your memories. Your agents. Your control.