1. Select a Space
List only Spaces readable through the caller's current Permits.
curl -sS \
-H "Authorization: Bearer $SWARM_TOKEN" \
"https://api.swarm.services/v1/spaces?limit=50&order=desc"HTTP API
Use the same Permit-authorized resources and actions consumed by Swarm clients. The hosted API origin is https://api.swarm.services.
Send bearer credentials in the Authorization header. A Credential authenticates an Identity; active Permits determine what that Identity can do for an Entity, Space, and resource.
Use a human session for management actions, a Connected Core credential for execution, and an exchanged Connect Chat credential only for /v1/chat/*. Never place credentials in prompts, Artifacts, logs, browser storage, or source control.
List only Spaces readable through the caller's current Permits.
curl -sS \
-H "Authorization: Bearer $SWARM_TOKEN" \
"https://api.swarm.services/v1/spaces?limit=50&order=desc"The Space Screen aggregate returns bounded conversation, unread, capability, and Available Action state.
curl -sS \
-H "Authorization: Bearer $SWARM_TOKEN" \
"https://api.swarm.services/v1/spaces/$SPACE_ID/screen/view?limit=50"Readiness is resolved before conversation or Run records are committed. Supply an explicit agent when more than one is available.
curl -sS -X POST \
-H "Authorization: Bearer $SWARM_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: request-2026-08-10-001" \
"https://api.swarm.services/v1/spaces/$SPACE_ID/agent-requests" \
-d '{
"body_text": "Compare the renewal options and publish a concise recommendation.",
"target_agent_id": "<agent-id>"
}'A signed-in human issues a short-lived, single-use pairing code. The client exchanges it for a Space-bound chat Credential and then uses /v1/chat/context-pack, /v1/chat/ask, and /v1/chat/session-digest.
# Issue a single-use pairing code from a human session.
curl -sS -X POST \
-H "Authorization: Bearer $SWARM_HUMAN_SESSION" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: chat-pair-001" \
"https://api.swarm.services/v1/me/connect-chat" \
--data-binary @- <<JSON
{
"profile_key": "generic_http_chat",
"chat_session": {"ttl_seconds": 14400},
"connection": {"space_id": "$SPACE_ID"}
}
JSON
# Exchange the returned code once. Store the resulting chat token securely.
curl -sS -X POST \
-H "Content-Type: application/json" \
"https://api.swarm.services/v1/chat-connect/exchange" \
-d '{"connect_code":"<single-use-code>"}'A Connected Core runner exchanges a one-time enrollment secret, heartbeats, claims assigned work, and controls the resulting lease. Runner Credentials cannot administer Spaces, access, or billing.
Renew before lease expiry and stop execution if renewal fails. A 204 claim response means no assigned Run is available.
POST /v1/core-runner/heartbeat
POST /v1/core-runner/runs/claim-next
POST /v1/core-runs/{runId}/leases/{leaseId}/start
POST /v1/core-runs/{runId}/leases/{leaseId}/renew
POST /v1/core-runs/{runId}/leases/{leaseId}/execute
POST /v1/core-runs/{runId}/leases/{leaseId}/complete
POST /v1/core-runs/{runId}/leases/{leaseId}/releaseGET/v1/meRead the authenticated user and active identity context.
GET/v1/spacesList Permit-visible Spaces with bounded cursor pagination.
GET/v1/me/work-inboxRead the caller's canonical Inbox projection.
GET/v1/spaces/{spaceId}/screen/viewLoad the bounded Space Screen aggregate.
GET/v1/spaces/{spaceId}/records/viewList authorized Artifact and evaluation summaries.
GET/v1/spaces/{spaceId}/runs/viewList Run Groups and Runs with keyset pagination.
GET/v1/spaces/{spaceId}/graphLoad the deterministic Space graph projection.
POST/v1/spaces/{spaceId}/agent-requestsCreate one agent request and its Run Group after readiness passes.
POST/v1/spaces/{spaceId}/artifacts/inlineCreate a bounded inline text Artifact.
POST/v1/spaces/{spaceId}/content-ingest-sessionsStart direct upload for larger files.
POST/v1/spaces/{spaceId}/context-linksAttach a canonical resource reference to active Space context.
POST/v1/core-runner/heartbeatPublish bounded Core liveness and capability state.
POST/v1/core-runner/runs/claim-nextClaim the next Run assigned to the authenticated Core.
POST/v1/core-runs/{runId}/acquireAcquire one already assigned Run by ID.
POST/v1/core-runs/{runId}/leases/{leaseId}/executeExecute through the canonical Model Gateway route.
Idempotency-Key for each logical mutation. Reuse it only when retrying that same operation.limit values and return the opaque cursor unchanged. Do not derive or inspect cursor contents.409 as a state or readiness conflict. Follow the repair action supplied by the canonical view when one is available.Retry-After on 429. Retry classified transient failures with bounded exponential backoff and jitter.403 when a Permit is absent or revoked. Do not use resource existence probes to infer inaccessible data.