Docs / Agents, CLI and API

REST API

Read and update community records through HTTP with scoped API keys.

Overview

Datum’s native API uses /v1 on your instance. It shares capability definitions with the CLI and MCP server.

The tool reference lists routes and parameters. /openapi.json provides a machine-readable description without authentication.

Datum also supports Common Room-compatible routes at separate addresses.

Configure

Create an API key

  1. Open Settings → Access as an owner.
  2. Select Create API key.
  3. Enter its name.
  4. Select its access level.
  5. Create the key.
  6. Store the secret securely.

Datum displays the secret only once.

Access Permissions
Read Search members, read reviews, and export members.
Read and write Also decide reviews, merge members, and change tags, segments, and custom fields.
Admin Also undo pinned merges, erase people, and manage destinations, sinks, and routing.

Each level includes the preceding level’s permissions. Keys record their creator. Revoke immediately stops access while preserving the key record.

Create a key from the instance terminal if preferred:

ocmgr apikey create --scopes read,write --name "warehouse loader" --json

API keys cannot create other keys. API-based creation requires a signed-in owner session.

Make a request

Send the key as a bearer token:

curl "$OCMGR_URL/v1/members?limit=25" -H "Authorization: Bearer $OCMGR_API_KEY"

Keys contain the prefix ocmgr_live_, an ID, and a secret. Each key identifies one workspace, so requests need no separate workspace ID.

Request GET /healthz to check availability without a key.

Basics

Errors

Errors use this structure:

{ "error": { "code": "NOT_FOUND", "message": "…", "hint": "…" } }

The hint explains the corrective action.

Code Status Meaning
USAGE 400 The parameter or request body is invalid.
UNAUTHENTICATED 401 The key is missing or invalid.
PAYMENT_REQUIRED 402 The hosted plan no longer permits writes. Reads remain available.
FORBIDDEN 403 The key lacks permission for the route.
NOT_FOUND 404 The resource does not exist in this workspace.
CONFLICT 409 The request conflicts with existing state, such as erasure or a separation decision.
PAYLOAD_TOO_LARGE 413 The request body exceeds the limit.
RATE_LIMITED 429 The key exceeded its request limit.
CONFIG / INTERNAL 500 The instance encountered a configuration error or bug.
NOT_IMPLEMENTED 501 Datum does not support the route.
CONNECTOR 502 A source rejected the request or timed out.
DATABASE 503 The database is unavailable.

Plan expiry never blocks erasure or API key routes.

Rate limits

The default limit is 600 requests per minute per key. Responses include X-RateLimit-Limit and X-RateLimit-Remaining.

A 429 response also includes X-RateLimit-Reset and Retry-After. Retry-After specifies how many seconds the client must wait before another request. Self-hosted operators can change limits when starting the server.

Paging

Paged lists accept limit and return nextCursor when more results exist. Pass the returned cursor unchanged to request the next page. Never construct cursors yourself. Keep filters, search text, and sort unchanged between pages; you can change limit.

Most paged lists default to 25 rows and allow up to 200. The event and intake logs default to 50 rows and allow up to 500.

Connections, reports, destinations, API keys, and custom fields return their full matching lists without cursors. These routes do not support limit. Check each route’s parameters in the tool reference before paging.

What reads leave out

Search omits email addresses. Member reads require explicit fields to return addresses. The review queue masks addresses by default.

Graph records never contain message text. Raw webhook and push payloads can contain it in the 30-day intake log. GET /v1/inbound/{id} withholds these payloads unless you turn on Include personal data in events under Settings → Destinations.

From your terminal or agent

These examples perform the same search:

ocmgr members search ada --json

FAQ

Can I use an API key with the MCP server?

Yes. The workspace MCP address accepts keys with the same permissions. Audit records identify the key rather than a person.

Is there an SDK?

No. Generate a client from /openapi.json or call the routes directly.

Does the API cover everything in the app?

Community operations have REST routes. Browser sign-in requires a person. Creating API keys and inviting people, cancelling invitations, removing users, or changing roles require a signed-in session or the operator terminal. An API key cannot perform these access changes.Only the original author can edit or delete a note. For a note that an API key wrote, use the same API key. For the note of a person, use the session or OAuth connection of that person.Some diagnostics, such as a sink’s live vendor check, require the terminal.

Workspace access

Read workspace users, roles, and pending invitations with read scope. An API key has no user identity: callerId is null, and every isCaller value is false.

Read connected agents to see their owners, scopes, and subscription counts. Owners see every connection. Members see their own. Admin API keys see every connection; other keys return an empty list. Disconnecting an agent through REST requires admin scope. Use the returned clientId and userId as client_id and user_id in the disconnect body.

Inviting people, cancelling invitations, removing users and changing roles require a signed-in human session or the operator terminal. An agent must not grant access.

ocmgr admin user list --json
ocmgr admin agent list --json
ocmgr admin agent disconnect --client-id <clientId> --user-id <userId> --json