Skip to content

Authentication

OpenBrain SaaS uses Laravel Sanctum personal access tokens for the REST API and MCP (/mcp).

Token abilities

AbilityRESTMCP tools
memory:ingestPOST /api/memories, PUT /api/memories, POST /api/memories/batchmemory_ingest
memory:searchPOST /api/memories/search, GET /api/memories/{id}memory_search, memory_get
memory:adminPATCH /api/memories/{id}, DELETE /api/memories/{id}memory_update, memory_delete
organization:{uuid}Binds the token to one tenantSame

The wildcard ability * grants all scopes (intended for local development only).

Organization context

  • Prefer embedding the org in the token: organization:{uuid}.
  • Optionally send X-Organization-Id — it must match the token’s organization: ability when both are present.

Creating tokens

php
$user->createToken('agent-ingest', [
    'organization:'.$organizationId,
    'memory:ingest',
    'memory:search',
]);

Issue separate tokens for search-only automation vs ingest-heavy agents vs admin (update/delete) workflows.

Organization roles (OBS-106)

RoleDashboard (/app)API keysBilling
ownerFull tenant accessCreate tokens with any abilitiesYes
memberMemories + API keysCreate tokens (ability checkboxes)No
readonlyView/search UICreate search-only tokensNo

Owners invite teammates from the Team page; accept via signed /invitations/accept/{token} (email must match).

Audit log (OB-047)

Successful ingest, upsert, update, delete, and batch operations write org-scoped rows to memory_audit_events (actor user/token, action, thought id, metadata such as outcome/dedupe — never raw content). Owners can review events in the dashboard Audit log.

REST requests

http
Authorization: Bearer {token}
X-Organization-Id: {uuid}   # optional when token includes organization:{uuid}
Content-Type: application/json

MCP

  • Production: Bearer token required on every /mcp request.
  • Local: Unauthenticated MCP is allowed only when APP_ENV=local and OPENBRAIN_DEFAULT_ORGANIZATION_ID is set.

Rate limits

Per organization + token (requests per minute, configurable via .env):

VariableDefaultApplies to
OPENBRAIN_RATE_LIMIT_INGEST60ingest, upsert, batch
OPENBRAIN_RATE_LIMIT_SEARCH120search, get
OPENBRAIN_RATE_LIMIT_ADMIN30update, delete
OPENBRAIN_RATE_LIMIT_MCP90/mcp endpoint

Exceeded limits return HTTP 429 with Retry-After.