Origins and authentication#

crossfire serves coordination routes at the configured application origin. The request Host must match that exact origin. When an Origin header is present it must equal the application origin; a related subdomain, report origin or null origin is not accepted.

Catalog audiencecrossfire admission
publicNo bearer accepted; boundary-specific public checks still apply
humanActive human session cookie; mutations require same-origin CSRF
agentAgent bearer identity; the payload cannot select another actor
eitherA human session or agent bearer, with current domain authority
fleetFleet-scoped controller credential, or permitted human session; current generation/object checks still apply

Never mix a Cookie header with Authorization. Human login exchanges a native Matrix token through POST /api/sessions, requiring same-origin Origin. It returns the human projection, permission codes and csrfSecret, and sets a host-only __Host-crossfire cookie. The cookie is Secure, HttpOnly, SameSite=Strict and Path=/; its lifetime is eight hours.

Human mutations include X-Crossfire-CSRF: <csrfSecret> and the exact Origin. GET /api/sessions/current supplies the current session projection. Opening a review link is read-only; only explicit authenticated submission records a human decision.

fleetd is different: use its private Unix socket with Host: localhost, exactly one Authorization: Bearer <authenticationKey>, no browser Origin and no cookie. Its catalog audience is controller. fleet reads the key from the same private OS-native ctlflow/fleetd.json file initialized by fleetd. All operations, including status, require this credential. Missing or invalid credentials return 401; browser headers are rejected even when empty. See controller authentication for paths, SSH and recovery.

Success and failure#

After a client sends an HTTP request, the service returns a JSON response. The following is an illustrative success response, not a request body or a message to type in a room. The service supplies data and the request ID; the actual fields inside data depend on the operation:

{
  "data": { "recorded": true },
  "meta": { "requestId": "00000000-0000-0000-0000-000000000001" }
}

If the operation fails, the service returns an error response instead. This example shows a request rejected because the record changed:

{
  "error": { "code": "stale_revision", "message": "The record changed" },
  "meta": { "requestId": "00000000-0000-0000-0000-000000000001" }
}

The operation’s output schema applies to data. Application IDs and request IDs are UUIDs; backend user IDs, room/event IDs, cursors and native session identifiers retain their own opaque formats. Backend adapters validate their native identifiers. Strings/keys must be well-formed Unicode. Malformed UTF-8 and unpaired UTF-16 surrogates are rejected, not replaced silently.

CodeHTTP status
invalid400
unauthorized401
forbidden403
missing404
method_not_allowed405
conflict, stale_revision, name_collision, capacity409
limit, body_too_large413
rate_limit429
native502
unavailable503

HTTP 202 means the request was accepted for processing. Inspect the affected resource’s application state or the returned operation outcome for completion. Message delivery confirmation means the input reached the runtime, not that the agent finished its task. Owner answers are recorded before they are sent to the runtime.

Request and response bounds#

BoundaryDefault / explicit bound
crossfire JSON request2 MiB unless the operation declares another bound
crossfire JSON response32 MiB
Native human-decision creation16 MiB operation request bound; separate review constraints still apply
Publication file upload8 MiB; raw application/octet-stream with exact canonical Content-Length
fleetd private request1 MiB; not the server’s 2 MiB default
Complete inline model envelopeInstance policy; default 65536 UTF-8 bytes

The model-inline limit includes provenance, directory and instructions. Large input becomes complete private files with a compact manifest; it is not truncated. That policy is independent of HTTP body limits, native patches, approval reviews, report uploads and terminal output.

GET operations have no client JSON body: use their declared query parameters. The request-size default does not require a body on a GET request.

Pagination and queries#

For paginated collections, page and pageSize are canonical positive ASCII decimal text. Unless the operation declares a smaller bound, their defaults are 1 and 20; page is at most 100000 and page size is at most 100. Fleet message receipt history defaults to 10 items and permits at most 10. Leading zeroes, signs, whitespace, fractions, exponent/hex forms and duplicate/unknown query parameters fail.

For example, a client’s list request with ?page=1&pageSize=20 can receive the empty result below. The service calculates the pagination metadata; the client does not send this JSON as a request:

{
  "data": [],
  "meta": {
    "requestId": "00000000-0000-0000-0000-000000000001",
    "page": 1, "pageSize": 20, "totalItems": 0, "totalPages": 1
  }
}

totalPages is at least one, including an empty collection. Beyond-last pages may be empty. The server checks access, filters, counts and sorts before selecting a page and loading its related records. A list-valued output is not automatically a paginated collection: consult the operation’s collection fact.

Directory/fleet/wake-rule/publication search uses bound SQLite LIKE patterns. ASCII case is insensitive; non-ASCII case remains exact. % and _ retain SQLite wildcard behavior. Do not lowercase query text in client code; pass the intended search unchanged.

Concurrency and retries#

Use the original expected revision, applicable admission generation and idempotency key for the exact input. Conflicting key reuse fails. A lost response is not permission to create a new identity, silently overwrite state, advance a cursor or repeat a native effect under a different ID.

On revision conflict retain the user’s draft and explicitly reload/reconcile; do not auto-apply it to a new record. GET requests do not approve, start, acknowledge or change state.

Rate limits and proxy attribution#

Public mutations use process-local 60-second budgets: 120 per client, 4096 aggregate and at most 4096 retained client buckets. A 429 includes Retry-After: 60. These are not token or chat quotas.

Socket peer is the default client identity. Only explicitly configured literal immediate-proxy addresses may supply exactly one overwritten X-Forwarded-For client IP. Chained, missing or malformed trusted-proxy headers fail. This does not grant authentication or room authority.