mission/control

REST API

Everything the CLI, MCP server and n8n nodes do goes through this API, so you can report from any agent or script. The machine readable spec is at /api/v1/openapi.json (OpenAPI 3.1).

Authentication

Create an API key in Settings, API keys, or a connection token in Settings, Connections. Send it as Authorization: Bearer <token> (or X-API-Key). Read keys can call the GET endpoints only. Connection tokens and write keys can call all of them. A key limited to one project only sees that project.

Check your token
curl https://mc.bregoraxhimusa.dev/api/v1/me -H "Authorization: Bearer $MC_TOKEN"

Errors, limits and retries

Errors always look like { "error": { "code": "validation_error", "message": "...", "issues": [...] } }. The code is stable; the message is for people.

Each key gets a request budget per minute. Every response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset; a 429 also has Retry-After. Bodies are capped at 256 KB.

Every POST accepts an Idempotency-Key header. Retrying with the same key and body within 24 hours returns the first response with Idempotent-Replayed: true. The same key with a different body is a 422.

Secrets in tool input, commands, log lines and event data (API keys, bearer tokens, private keys, values of variables named like secrets) are replaced with [REDACTED] before anything is stored.

How approvals work

Before a risky tool runs, POST it to /api/v1/approvals. Your workspace rules answer first: allow or deny come back at once. When a rule says ask, or no rule matches, a person gets the request on their phone and in the app. Send wait (up to 60 seconds) to hold the call until they decide, then keep polling GET /api/v1/approvals/{id}?wait=60 until the decision is not pending. Requests nobody answers expire and count as denied.

With onNoMatch: "default" nothing is stored when no rule matches, and the decision is default: let the tool ask locally as it normally would.

Account

GET/api/v1/meread scope

Who this token is

Returns the key or connection behind the token, its scope and workspace. Use it to check a token works.

Returns

200 The token's identity. Me

FieldTypeNotes
kind *"api_key" | "connection"
id *string, up to 64 chars
name *string
scope *"read" | "write"
tool *"claude_code" | "cursor" | "chatgpt" | "claude" | "codex" | "gemini_cli" | "n8n" | "other", nullable
workspace *object
project *object, nullableSet when the token is limited to one project.
Example
curl "https://mc.bregoraxhimusa.dev/api/v1/me" \
  -H "Authorization: Bearer $MC_TOKEN"

Agents

POST/api/v1/agentswrite scope

Register an agent

Creates the agent, or updates it when one with the same externalId exists. Counts as a heartbeat.

Body

FieldTypeNotes
externalId *string, up to 200 charsYour own stable id for this agent, for example a session id. Registering again with the same id updates the agent.
name *string, up to 120 chars
vendor"claude_code" | "cursor" | "chatgpt" | "claude" | "codex" | "gemini_cli" | "n8n" | "other"Defaults to the connection's tool, or other.
projectIdstring, up to 64 charsNeeded when the workspace has more than one project and the token is not limited to one.
machinestring, up to 120 chars
heartbeatTimeoutSecinteger 30 to 86400Mark the agent stuck and alert when no heartbeat or event arrives for this long.

Returns

200 An existing agent was updated. UpsertAgentResult

201 A new agent was created. UpsertAgentResult

FieldTypeNotes
agent *Agent
created *boolean
Example
curl -X POST "https://mc.bregoraxhimusa.dev/api/v1/agents" \
  -H "Authorization: Bearer $MC_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"externalId":"session-8f2c","name":"Refactor billing","vendor":"claude_code","heartbeatTimeoutSec":600}'
GET/api/v1/agents/{agent}read scope

Get an agent

  • agent The agent id, or "ext:" followed by the externalId you registered it with.

Returns

200 The agent. Agent

FieldTypeNotes
id *string, up to 64 chars
externalId *string, nullable
name *string
vendor *"claude_code" | "cursor" | "chatgpt" | "claude" | "codex" | "gemini_cli" | "n8n" | "other"The tool the agent runs in.
projectId *string, up to 64 chars
status *"idle" | "working" | "needs_you" | "stuck" | "done" | "archived"
currentStep *string, nullable
progressPct *integer -9007199254740991 to 9007199254740991, nullable
held *booleanTrue while the workspace is over its plan's agent limit. Events from a held agent are not stored.
lastHeartbeatAt *ISO date, nullable
heartbeatTimeoutSec *integer -9007199254740991 to 9007199254740991, nullable
Example
curl "https://mc.bregoraxhimusa.dev/api/v1/agents/ext:session-8f2c" \
  -H "Authorization: Bearer $MC_TOKEN"
POST/api/v1/agents/{agent}/heartbeatwrite scope

Send a heartbeat

Tells Mission Control the agent is alive. Without one (or an event) for heartbeatTimeoutSec the agent is marked stuck and an alert fires.

  • agent The agent id, or "ext:" followed by the externalId you registered it with.

Returns

200 The agent after the heartbeat. Agent

FieldTypeNotes
id *string, up to 64 chars
externalId *string, nullable
name *string
vendor *"claude_code" | "cursor" | "chatgpt" | "claude" | "codex" | "gemini_cli" | "n8n" | "other"The tool the agent runs in.
projectId *string, up to 64 chars
status *"idle" | "working" | "needs_you" | "stuck" | "done" | "archived"
currentStep *string, nullable
progressPct *integer -9007199254740991 to 9007199254740991, nullable
held *booleanTrue while the workspace is over its plan's agent limit. Events from a held agent are not stored.
lastHeartbeatAt *ISO date, nullable
heartbeatTimeoutSec *integer -9007199254740991 to 9007199254740991, nullable
Example
curl -X POST "https://mc.bregoraxhimusa.dev/api/v1/agents/ext:session-8f2c/heartbeat" \
  -H "Authorization: Bearer $MC_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)"

Events

POST/api/v1/agents/{agent}/eventswrite scope

Report events

Up to 100 events in one call: progress, step, file_changed, log, done, stuck or error. Secrets in messages and data are redacted before storing.

  • agent The agent id, or "ext:" followed by the externalId you registered it with.

Body

FieldTypeNotes
events *Event[], up to 100

Returns

200 How many events were stored. EventBatchResult

FieldTypeNotes
stored *integer -9007199254740991 to 9007199254740991
held *boolean
Example
curl -X POST "https://mc.bregoraxhimusa.dev/api/v1/agents/ext:session-8f2c/events" \
  -H "Authorization: Bearer $MC_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"events":[{"type":"step","step":"Running tests"},{"type":"progress","progressPct":60},{"type":"file_changed","files":["src/billing.ts"]}]}'

Costs

POST/api/v1/agents/{agent}/costswrite scope

Log a cost

Token usage for one model call or a batch of them. Priced from the model price table unless amountUsd is sent.

  • agent The agent id, or "ext:" followed by the externalId you registered it with.

Body

FieldTypeNotes
model *string, up to 100 chars
tokensIninteger 0 to 1000000000
tokensOutinteger 0 to 1000000000
cacheReadTokensinteger 0 to 1000000000
cacheWriteTokensinteger 0 to 1000000000Cache writes with the 5 minute TTL, or with no TTL split.
cacheWrite1hTokensinteger 0 to 1000000000Cache writes with the 1 hour TTL.
amountUsdnumber 0 to 10000The exact amount. When set, the token counts are stored but not priced.

Returns

200 What was added. CostResult

FieldTypeNotes
micros *integer -9007199254740991 to 9007199254740991Cost in millionths of a US dollar.
cents *integer -9007199254740991 to 9007199254740991Cents added to the agent's spend now. Sub-cent amounts carry over to the next call.
priced *booleanFalse when the model has no known price and amountUsd was not sent.
Example
curl -X POST "https://mc.bregoraxhimusa.dev/api/v1/agents/ext:session-8f2c/costs" \
  -H "Authorization: Bearer $MC_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"model":"claude-sonnet-5-5","tokensIn":12000,"tokensOut":1800}'

Approvals

POST/api/v1/approvalswrite scope

Ask before a tool runs

Workspace rules decide first: allow and deny answer at once. Otherwise a pending approval is created for a person, unless onNoMatch is default. With wait, the call holds until a decision or the wait ends.

Body

FieldTypeNotes
agent *string, up to 210 charsThe agent id, or "ext:" followed by its externalId.
toolName *string, up to 200 charsFor example Bash, Edit or an MCP tool name.
toolInputobjectThe tool's arguments. Secrets are redacted before anything is stored.
titlestring, up to 200 chars
detailstring, up to 5000 chars
risk"low" | "medium" | "high"
onNoMatch"ask" | "default"When no rule matches: "ask" waits for a person, "default" returns decision default and stores nothing, so the tool asks locally. Default "ask".
waitinteger 0 to 60Seconds to wait for a person's decision before answering, 0 to 60.

Returns

200 Decided by a rule, or no rule matched with onNoMatch default, or decided during the wait. AskApprovalResult

201 A pending approval was created and is still pending. AskApprovalResult

FieldTypeNotes
decision *"allow" | "deny" | "pending" | "default"
approval *Approval, nullable
rule *object, nullable
Example
curl -X POST "https://mc.bregoraxhimusa.dev/api/v1/approvals" \
  -H "Authorization: Bearer $MC_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"agent":"ext:session-8f2c","toolName":"Bash","toolInput":{"command":"pnpm deploy --prod"},"wait":55}'
GET/api/v1/approvals/{id}read scope

Get an approval, optionally waiting

With wait=N (up to 60) the call returns as soon as a person decides, or after N seconds with the approval still pending.

  • id The approval id.
  • wait Seconds to wait for a decision, 0 to 60. Default 0.

Returns

200 The approval. Approval

FieldTypeNotes
id *string, up to 64 chars
status *"pending" | "approved" | "rejected" | "expired" | "by_rule"
decision *"allow" | "deny" | "pending"
title *string
command *string, nullable
ruleId *string, nullable
expiresAt *ISO date
decidedAt *ISO date, nullable
messages *object[]Replies from the approver, oldest first.
Example
curl "https://mc.bregoraxhimusa.dev/api/v1/approvals/APPROVAL_ID?wait=55" \
  -H "Authorization: Bearer $MC_TOKEN"

Messages

GET/api/v1/agents/{agent}/messagesread scope

Read the agent's inbox

Messages people sent from the agent page that the agent has not acknowledged. Reading marks them delivered; ack them once handled.

  • agent The agent id, or "ext:" followed by the externalId you registered it with.

Returns

200 Unacknowledged messages, oldest first. Messages

FieldTypeNotes
messages *Message[]
Example
curl "https://mc.bregoraxhimusa.dev/api/v1/agents/ext:session-8f2c/messages" \
  -H "Authorization: Bearer $MC_TOKEN"
POST/api/v1/agents/{agent}/messages/ackwrite scope

Acknowledge messages

  • agent The agent id, or "ext:" followed by the externalId you registered it with.

Body

FieldTypeNotes
ids *string, up to 64 chars[], up to 100

Returns

200 How many were acknowledged. Unknown ids and ids from other agents are ignored. AckResult

FieldTypeNotes
acked *integer -9007199254740991 to 9007199254740991
Example
curl -X POST "https://mc.bregoraxhimusa.dev/api/v1/agents/ext:session-8f2c/messages/ack" \
  -H "Authorization: Bearer $MC_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"ids":["msg_id"]}'