REST API Reference
This page is for people who want to connect MeMesh to their own systems. It covers the APIs for workspaces, execution controls, approvals, memory, and team-related flows.
https://api.memesh.ai/v1Not sure whether you need this page?
If you are just trying MeMesh for the first time, start with the docs overview or Setup first. Come back here when you need to automate, integrate, or call the runtime from your own systems.
Authentication Header
x-api-key: mk_your_api_key_hereAll requests need a valid API key. Create one from Setup > Agent Access Keys.
Agent Workspace
Workspace-scoped dispatch targets and target-level governance truth.
/agents/dispatch-targetsList local and remote dispatch targets for this workspace, including eligibility, runtime policy, control state, and compatibility summaries.
Query: search?, targetKind? (LOCAL_AGENT|REMOTE_A2A), state?, limit?, offset?
/agents/dispatch-targets/:idGet one dispatch target with remote control capability or local runtime summary.
/agents/dispatch-targets/:id/governanceView governance details such as runtime policy, review state, incident handoff, recent runs, recent audit, impacted work, and timeline.
/agents/dispatch-targets/:id/holdPlace a manual hold on a dispatch target. Requires the latest runtime CAS token.
Body: { reason, releaseAfter?, expectedRuntimeUpdatedAt }
/agents/dispatch-targets/:id/releaseRelease a manual hold and recompute effective policy in one CAS-protected mutation.
Body: { note?, expectedRuntimeUpdatedAt }
/agents/dispatch-targets/:id/review/acknowledgeAcknowledge the active governance review for the current policy epoch.
Body: { note?, expectedRuntimeUpdatedAt }
/agents/dispatch-targets/:id/incident/handoffRecord provider-incident handoff for the active incident epoch.
Body: { externalIncidentId, owner, note?, expectedRuntimeUpdatedAt }
Memory
Store and search memories with semantic search support.
/memory/writeWrite one memory item with optional metadata.
Body: { content, space?, summary?, tags?, sensitivity?, source? }
/memory/searchSearch memories with a natural-language query over GET.
Query: query (required), spaces?, limit?
/memory/searchSearch memories with a structured POST body. Useful when the query is more complex.
Body: { query, spaces?, limit? }
/memory/countGet the total memory count for the authenticated user.
/memory/batchWrite up to 100 memories in one request with transactional or partial-success mode.
Body: { memories[], transactional? }
/memory/batch/searchRun up to 50 memory searches in parallel with optional deduplication.
Body: { queries[], deduplicate? }
/memory/spacesList all memory spaces for the authenticated user.
/memory/queryRun a hybrid memory query with semantic, tag, and temporal filters.
Body: { query, limit?, offset?, similarityThreshold? }
/memory/context-windowSelect memories for an LLM context window within a token budget.
Body: { query, tokenBudget }
/memory/stream/exportStream a memory export through Server-Sent Events for large exports.
Query: spaces?
Orchestrator Runtime
Persisted runs, control truth, reconcile, retry-cancel, and runtime health.
/orchestrator/runsList recent runs with target kind, control truth, approval links, and operator guidance.
/orchestrator/runs/:idGet run detail with events, approvals, remote control state, and suggested operator action.
/orchestrator/runs/:id/controlReturn control capability truth, block reasons, and operator guidance for one run.
/orchestrator/runs/:id/reconcileForce-poll remote state and reconcile late terminal truth.
/orchestrator/runs/:id/retry-cancelRetry a remote cancel after timeout or transient failure.
/orchestrator/runs/:id/resolve-remotePerform guarded operator resolution for remote runs after recovery is exhausted.
/orchestrator/runtime-healthView operator health across local compatibility, remote escalation, target governance, and attention backlog.
Local Agent Execution
Claim-token based local execution queue with leases, heartbeats, recovery, and cancel acknowledgement.
/agents/executionsList pending local executions available to the current agent.
/agents/executions/:id/claimClaim a local execution with a caller-supplied claim token.
Body: { claimToken, workerId? }
/agents/executions/:id/heartbeatExtend the active lease and optionally report progress.
Body: { claimToken, progressMessage? }
/agents/executions/:id/completeComplete the claimed execution.
Body: { claimToken, result?, idempotencyKey? }
/agents/executions/:id/ack-cancelAcknowledge a cancel after the runtime requests local interruption.
Body: { claimToken, note? }
Team
Team member management, invitations, and role-based access control.
/team/membersList all team members for the current tenant.
/team/members/inviteInvite a new team member by email. Requires OWNER or ADMIN role.
Body: { email, role? }
/team/members/:userId/roleChange a team member's role.
Body: { role }
/team/members/:userIdRemove a member from the team.
Audit
Audit log access for security review and compliance workflows.
/audit/logsQuery audit logs with optional filters for action, resource, date range, and limit.
Query: action?, resource?, startDate?, endDate?, limit? (default: 100)
Billing & Usage
Subscription plans, usage statistics, and quota visibility.
/billing/planGet the current user's subscription plan.
/usage/summaryGet usage statistics for memory, API keys, agents, seats, and rate limits.
API Keys
Create, list, and revoke API keys for programmatic access.
/keysCreate a new API key. The raw value is only shown once in the response.
Body: { name }
/keysList all API keys for the current user. Values are masked.
/keys/:idPermanently revoke an API key.
Device Authorization
OAuth 2.0 Device Authorization flow for CLI and MCP clients.
/auth/deviceStart the device authorization flow. Returns device_code, user_code, and verification_uri.
Body: { client_id, scope? }
/auth/device/tokenPoll for a token after the user authorizes the device.
Body: { grant_type: "urn:ietf:params:oauth:grant-type:device_code", device_code }
Example Requests
curl "https://api.memesh.ai/v1/agents/dispatch-targets?targetKind=REMOTE_A2A&limit=10" \
-H "x-api-key: mk_your_api_key"curl -X POST https://api.memesh.ai/v1/orchestrator/runs/run_123/reconcile \
-H "x-api-key: mk_your_api_key" \
-H "Content-Type: application/json"curl -X POST https://api.memesh.ai/v1/agents/dispatch-targets/{targetId}/hold \
-H "x-api-key: mk_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"reason": "provider maintenance",
"releaseAfter": "2026-03-22T09:00:00.000Z",
"expectedRuntimeUpdatedAt": "2026-03-20T09:00:00.000Z"
}'HTTP Status Codes
| Code | Description |
|---|---|
| 200 | Success |
| 201 | Created (resource created) |
| 400 | Bad Request (validation error, invalid Agent Card) |
| 401 | Unauthorized (invalid or missing API key) |
| 403 | Forbidden (self-review blocked, insufficient permissions) |
| 404 | Not Found (agent or resource does not exist) |
| 409 | Conflict (stale policy epoch, stale runtime snapshot, duplicate claim) |
| 429 | Too Many Requests (rate limit exceeded) |