Skip to content

API ​

Orbit has three doors onto the same commands and queries: GraphQL, MCP and the CLI. They run the same handlers with the same authorisation and audit. The reference lists the operations by module.

DoorEndpointForToken
GraphQLPOST /graphqlthe web app, integrationssidecar JWT
MCPPOST /mcpAI agents and MCP clientsMCP token from POST /mcp/token
CLIthe orbit binaryscripts and adminssidecar JWT, via orbit login
SCIM 2.0/scim/v2identity providersSCIM token from an owner
FilesPOST /files/<module>/<purpose>uploads (receipts, CVs, policy PDFs)sidecar JWT

Authentication ​

Every request needs a bearer token from the auth sidecar:

Authorization: Bearer <token>
  1. Sign in to the sidecar (POST /api/auth/sign-in/email, or OIDC single sign-on). This sets a session cookie.
  2. Choose the organisation to act in (POST /api/auth/organization/set-active).
  3. Get a token with GET /api/auth/token. It returns { "token": "..." }.

In the self-hosted stack the sidecar is reached on the same origin as Orbit, under /api/auth. Open email sign-up is off there: accounts come from deploy/bootstrap.sh, an operator or the optional OIDC provider.

The token lasts 15 minutes. Get a new one before it expires. The organisation must have been provisioned as an Orbit tenant by an operator (orbit tenant provision), or every request is refused as UNAUTHENTICATED. Your role in the organisation (owner, admin or member) is read from the token on each request. The sidecar's endpoints are listed in services/auth/README.md.

GraphQL ​

POST /graphql with a JSON body { "query": "...", "variables": { ... } }. Each command is a mutation and each query is a query field. Each field takes one input argument and returns a JSON value.

graphql
mutation { helloGreetingPost(input: { text: "Hello" }) }

MCP ​

POST /mcp: an MCP server over Streamable HTTP. It is stateless, answers with JSON (no server-sent events) and takes one JSON-RPC message per request. Requests that carry an Origin header are refused. tools/list shows only the tools of modules your tenant has enabled. A successful tool call returns { "result": <output> } as structured content.

/mcp takes an MCP token, not a sidecar token. A person signed in to the web app gets one for their agent with POST /mcp/token and their sidecar token as the bearer; it returns { "token", "expiresAt", "agent" } and lasts one hour. MCP tokens work on /mcp only: /graphql and the CLI refuse them. POST /mcp/token/revoke (same bearer) revokes every MCP token the person holds in the tenant and returns { "revokedAt" }.

A tool marked sensitive does nothing on its first call. It asks the person the agent acts for to approve that exact call and returns { "status": "approval_required", "tool", "confirmation_id", "expiresInSeconds": 1800, "message" }. The person approves or rejects it in the web app's approval queue. Then call the tool again, within 30 minutes of the first call, with exactly the same arguments plus "confirm": true and the confirmation_id. It works once, with the same token. Before the approval it is refused with CONFLICT and reason: "not_approved"; other reasons are rejected, expired, used and mismatch. See Security model.

CLI ​

The CLI is part of the orbit binary. It calls /graphql and never connects to the database.

bash
printf '%s' "$TOKEN" | orbit login --server http://127.0.0.1:8080
orbit hello greeting post --text "Hello"
orbit hello greeting list --json
orbit logout

orbit login reads the token from standard input and never prints it. It is stored in credentials.json under $ORBIT_CONFIG_DIR, else $XDG_CONFIG_HOME/orbit, else $HOME/.config/orbit. Each command also takes --server <URL> and --input-json <JSON> (field flags override its fields). With --json, standard output carries exactly one JSON document: {"ok": true, "data": ...} or {"ok": false, "error": {"code", "message", "requestId"}}.

SCIM ​

/scim/v2 serves SCIM 2.0 Users and Groups (the two roles, admin and member) for identity providers, with a bearer token an owner creates (Provisioning, ADR 0010). It is served only when the operator has set ORBIT_AUTH_PROVISION_SECRET and the sidecar upstream.

Files ​

Uploads go through the files door as bus commands: POST /files/<module>/<purpose> returns an upload id that a later command consumes once. Downloads use single-use, short-lived links (ADR 0009).

Request ids ​

Every HTTP response carries an x-request-id header with a fresh id. Errors repeat it as requestId. The server log records the full reason for a refusal under that id, so quote it when you report a problem.

Error codes ​

Every door reports the same six codes. Each has one fixed message. The reason behind a refusal is never sent to the caller.

CodeMessageMeaningHTTP status (before the operation runs)CLI exit code
UNAUTHENTICATEDauthentication requiredNo token, a bad or expired token, or an organisation that is not a provisioned tenant4013
FORBIDDENnot allowedA policy denied it, the module is not enabled for the tenant, or the caller made too many rejected attempts403 (429 when the caller has too many requests in flight)4
NOT_FOUNDnot foundA record that does not exist, or that you may not see4045
INVALIDinvalid inputInput does not match the schema or the module's rules400 (413 for a body over 1 MiB, 408 for a body sent too slowly)6
CONFLICTconflictThe change conflicts with the current state4097
INTERNALinternal errorAnything else. Details are in the server log only5008

The CLI also exits with 0 on success, 1 when it could not finish (for example, the server is unreachable) and 2 for a usage error.

How each door reports them:

  • GraphQL. An error inside an operation comes back with HTTP 200 in the errors array, with extensions.code and extensions.requestId. A request refused before the schema runs (authentication, a body that is too large or not JSON) gets the HTTP status above and the same errors shape.
  • MCP. A refused tool call returns a tool error whose structured content is { "code", "message", "requestId" }. A request refused at authentication gets HTTP 401 (with WWW-Authenticate: Bearer) or 403 and the same JSON object.
  • CLI. The exit code in the table, and the error on standard error (or in the --json document).

Limits ​

  • 20 fields per GraphQL request. Each selected field counts as 1, aliases included. Fields run at the same time and each can dispatch a command, so this stops one request from turning into many attempts. A request over the limit is refused before anything runs, with an error whose message says the query is too complex. Query depth is limited to 16.
  • 20 rejected attempts per caller per minute. Denials and failed commands count. After that, requests are refused with FORBIDDEN until the minute passes.
  • 32 requests in flight per caller, on GraphQL and MCP together. More are refused at once with HTTP 429 and FORBIDDEN.
  • 20 open agent requests per person, and 10 MCP tokens per person per hour.
  • 1 MiB request body, read only after the token is accepted. It must arrive within 5 seconds, or the request is refused with HTTP 408.
  • 30 seconds per request, then HTTP 503. A command that was already dispatched still completes and is audited.

Generated files ​

The schema, the tool list and the CLI help are generated from the command registry. Tests in crates/orbit-bin compare them with these committed snapshots and fail if they drift:

FileBuild
schema.all-modules.graphqlEvery module (--features hello)
mcp-tools.all-modules.jsonEvery module
cli-help.all-modules.txtEvery module
schema.graphql, mcp-tools.json, cli-help.txtNo optional modules

After a deliberate change, regenerate them with UPDATE_SNAPSHOTS=1 cargo test -p orbit and UPDATE_SNAPSHOTS=1 cargo test -p orbit --all-features, and commit the files.

Orbit by SkySync Tech. Licensed under AGPL-3.0.