Synq
Skip to content
[ synq / docs ]Synq home

API reference

The Synq v3 app API: authentication, idempotency, errors and every route.

The Synq app API (contract version 3.0.0) is the one backend used by the iOS app, the web hub and the channel bots. This reference is generated from the Zod schemas in packages/contracts, so it cannot drift from the code. There are 50 routes: 49 marked IMPLEMENTED and 1 PLANNED in the contract.

Base URL#

Production clients call https://synqlabs.world/api/v3/.... The web app rewrites /api/v3/* to the API service's /v3/*, so the paths in this reference (which start with /v3) are appended to https://synqlabs.world/api. The older /api/v1 and /api/v2 paths are rewritten the same way; /v2 still hosts the sign-in challenge.

Authentication#

ModeHowUsed by
Native bearerAuthorization: Bearer <64 hex chars>iOS app and any client that wants refresh
Web cookie__Host-synq_workspace cookie, Secure, host-onlyThe web hub
  • A native device session is created by exchanging a signed login challenge (POST /v3/auth/device-session) or a one-time code made by a signed-in web session (POST /v3/auth/device-session/code).
  • The access token lives 15 minutes. The refresh token lives 30 days and rotates on every use.
  • Reusing a refresh token that was already rotated revokes the session (SESSION_REVOKED).
  • A malformed bearer header is 401 UNAUTHENTICATED. If both a bearer header and a cookie are sent, the bearer header wins. Duplicate cookies are refused.
  • Cookie sessions that mutate state must also send an Origin header equal to the configured web origin, otherwise 403 ORIGIN_MISMATCH. Bearer sessions are not subject to the Origin check, since they are not sent automatically by a browser.
  • Auth column in the route tables: None (open), Session (any valid session), Session + Idempotency-Key (a mutation).
  • Workspace routes also require membership with the listed role. A non-member, or a request for another tenant's id, gets 404.

Idempotency#

Every mutation under /v3 that requires a session must carry an Idempotency-Key header containing a UUID. A missing or malformed key is 400 IDEMPOTENCY_KEY_REQUIRED. Lead messages use the key as the delivery key, so a retry with the same key is stored and answered once. Use a fresh key per user action and reuse it only when retrying that same action.

Rate limits#

Limits are fixed one-minute windows stored in Postgres. Exceeding one returns 429 RATE_LIMITED.

BucketLimit per minute
Unauthenticated auth routes, per client address (hashed)20
Each authenticated principal120
Each workspace (workspace routes and circles)240
Lead invitations, per workspace30
Redeeming a lead invite, per principal10
Client lead messages, per principal30
Escrow prepare and submit, per principal30

Errors#

Every non-2xx response has the same body, ApiError:

json
{ "error": "VERSION_CONFLICT", "message": "version conflict" }

error is a stable machine code; message is human readable and never contains request data. Responses carry cache-control: no-store.

StatusCodesMeaning
400INVALID_REQUEST, IDEMPOTENCY_KEY_REQUIRED, INVALID_CURSOR, PRIVATE_DATA_REFUSEDBody, query or header failed validation
401UNAUTHENTICATED, SESSION_REVOKED, INVALID_NATIVE_CODE, NATIVE_CHALLENGE_REQUIREDNo valid session; refresh, then sign in
403FORBIDDEN, ORIGIN_MISMATCH, OWNER_REQUIRED, NATIVE_SESSION_REQUIRED, signature errorsAuthenticated but not allowed, or a signature was not accepted
404NOT_FOUND and entity-specific codesMissing, or not yours
409VERSION_CONFLICT, OFFER_STALE, TAKEOVER_REQUIRED, AGREEMENT_ALREADY_FUNDEDState changed; reload and retry
422POLICY_BLOCKED family, LEASE_NOT_LIVE, CLIENT_WALLET_IS_MEMBERUnderstood but refused by policy
429RATE_LIMITEDSlow down
503NOT_CONFIGURED, UNSUPPORTED, AGREEMENT_ESCROW_UNAVAILABLE, AMANE_NOT_CONFIGUREDFeature not available on this server
500WORKSPACE_UNAVAILABLEUnexpected failure; details are never returned

A channel-identity or wallet-signature failure surfaces as 403 with the identity error code. The optional retryable flag tells a client whether retrying can help.

Status values#

Each route in the contract carries a status. IMPLEMENTED routes are served. PLANNED routes are in the contract so clients can build against them but the server does not register them. GET /v3/meta reports the live status of every route, so a client should hide anything not IMPLEMENTED there. Optional modules (approvals, leads, offers, events, notifications, Amane, agreements) register their routes only when configured, so a route marked IMPLEMENTED in the contract can still report PLANNED from a server without that module.

Responses also use shared vocabularies: ProofLevel (how strongly a fact is proven) and CapabilityStatus (whether a feature can be used). Money is an integer count of token base units in a decimal string, never a float; times are UTC ISO-8601.

Pagination#

List routes take cursor and limit (1 to 100) and return items and nextCursor (null on the last page). Cursors are opaque; pass them back unchanged.

Real-time#

GET /v3/events streams server-sent events and GET /v3/events/since polls the same feed. See Events.

Pages#

The machine-readable contract is packages/contracts/generated/openapi.json.

Service routes#

GET /v3/meta#

Contract version and which routes this server implements.

Route idmeta
AuthNone
Who may callanyone
StatusIMPLEMENTED

Response (Meta)

FieldTypeRequiredNotes
contractVersionstringyes
routesMetaRoute[]yes

Example response (synthetic fixture):

json
{
  "contractVersion": "3.0.0",
  "routes": [
    {
      "id": "me.contexts",
      "status": "IMPLEMENTED"
    },
    {
      "id": "workspace.inbox",
      "status": "PLANNED"
    }
  ]
}

Edit this page on GitHub