How Sess works

The handful of ideas behind every integration with Sess. Terms in bold are used with exactly this meaning across the docs and the API.

On this page

Requests and Sessions

A request is one exchange with your agent: your agent asks, a person answers on a Sess link, over one or more rounds. In the API it is a Session. It has an ID such as ses_01JABCDEFGHJKMNPQRSTVWXYZ0, holds the current revision of what the person sees, and controls access and expiry. Every Session belongs to a workspace: a trial has its own, and owner-key Sessions belong to your workspace. Your agent creates a Session with POST /v1/sessions (API key) or POST /v1/trial/sessions (trial).

An interactive Session is active while it waits for an answer and responded once Sess accepted one. Your agent then either publishes the next revision, which makes it active again on the same ID and link, or completes it. completed is final: a completed Session never reopens. responded means one round was answered, not that the Session is finished.

A display Session (mode: display) only shows data and accepts no input.

With many people on one link, each person who starts gets their own Session, which by default completes when they answer. Your agent reads it like any other; see Ask a group.

Surface and immutable revisions

A Surface is what the person sees: a title (a short heading, about 40 characters; at most 60), an optional description, and components. Each Surface is stored as a numbered revision that never changes once written. Read any earlier revision exactly as stored with GET /v1/sessions/{id}/surfaces/{revision}.

Components are a small documented set: heading, text, read-only record (key/value pairs) and field (an input). Everything is shown as text: Sess never renders HTML, scripts, styles or remote content from your data, and an unknown component is rejected with UNKNOWN_COMPONENT rather than rendered approximately.

Owner reads carry an ETag. For an interactive Session it combines the revision and the number of Events, such as "2.3", so it changes whenever the person answers or your agent updates the Session. Updates and completion require it in If-Match.

How your page looks

Sess lays out your fields for the person, the same way on every screen:

  • Fields keep the order you send them in.
  • Consecutive fields share one group; a heading or a text starts a new one.
  • Each label sits beside its answer, or above it when the two do not fit, so keep it to a word or two (about 20 characters).
  • A field's help shows under that field; give it only when it is needed.
  • Keep choice labels short, and put any detail the decision needs in a text or record on the page: a phone's picker may cut a long choice short.
  • Nothing is truncated: rows grow to fit their text.

The same refund question on a phone, in light and in dark: the fields in one card, each label beside its answer, Decline and Approve at the bottom. The person’s device picks the scheme.

A text over its limit, such as a record's caption, is never shortened for you: it fails with 400 INVALID_SCHEMA, which names it.

Inputs, actions and submissions

A field is a labelled input described by a small subset of JSON Schema 2020-12: a string (a text box, or a list to choose from with enum), a number or integer with bounds, a boolean checkbox, or an array of enum IDs (selection checkboxes). A correction is a field with a proposed value. Any other schema keyword fails with INVALID_SCHEMA.

An action is a button you declare on a revision, with an ID, a label and an optional intent: submit, continue, approve, reject or request_change. A revision has up to 5 actions.

A rating is a field with rating and exactly the schema {type: integer, minimum: 1, maximum: N}, N from 2 to 10. low and high are optional words shown at the two ends of the scale.

The person's page submits exactly four things: a client event ID, the revision it was made against, the action ID and the field values. The browser can never choose where the result goes or change your policy: the server resolves the action from the exact stored revision and validates the values against that revision's schema. Submissions are accepted only from the page itself.

Events and typed results

When Sess accepts a submission it records an Event: a stable ID, its sequence within the Session, the time, the revision, the action and the validated input. The typed result is that input, valid against the response_schema Sess derived from your fields. Each revision accepts one response (response_policy: first); a second submission to the same revision, even from another device, is refused and does not replace it.

Your agent reads results by polling: the Session's responses list every accepted result with its revision, and GET /v1/sessions/{id}/events lists every Event in order (response.accepted, revision.published, session.completed). Events are append-only: earlier results stay listed after later revisions and completion. Repeated reads of an unchanged Session return identical bytes.

With an API key, your workspace can also register one HTTPS endpoint and receive each accepted response as a signed webhook (see Delivery). Trials never send webhooks.

Receipts

A receipt is a signed statement of what Sess accepted, issued once when the response is accepted and never re-signed. It is a compact JWS (Ed25519, alg EdDSA, typ sess-receipt-2+jwt) whose claims include the workspace, Session, Event and step IDs, the revision with a hash of its normalized content, the exact action ID, label and summary, a hash of the validated input, the responder's assurance and a workspace-scoped subject, the acceptance time, an expiry, and the return binding.

Verify it with the key named by its kid from GET /.well-known/sess-receipt-keys.json: the issuer is the API origin, the scheme and host you send API calls to, wherever Sess links are served and the audience is the Session's workspace. The key set keeps older keys during a rotation. See Verify the signed receipt. Export any accepted response as a bundle. Anyone can check a bundle with POST /v1/receipts/verify, no key: valid is true or false, with a reason when it is false. Verifying offline keeps the receipt on your side.

A receipt does not prove that the person understood every field, that their device displayed the page correctly, or that your agent or any other system then did the work. It records what the server accepted. In the invoice example, Sess records the choice; it does not pay the invoice or verify the person’s identity (the responder's assurance is link_holder: whoever held the link).

A receipt's expiry (exp) is at least 720 hours after acceptance. For an owner-key Session that is purged automatically, it is no earlier than the Session's latest possible purge: its Sess link's expiry plus its retention after it ends. A response's receipt is null only when the response was accepted before receipts existed.

A bundle is at most 1 MiB in canonical form, nested at most 32 deep, with at most 1,000 items in an array or members in an object, and 100,000 values in all.

With many people on one link, each person gets their own receipt.

Credentials and audiences

Sess uses separate credentials for separate audiences. They are never interchangeable, and none ever goes in a URL except the Sess link itself.

Credential kinds
CredentialWho holds itWhat it allows
API key (owner credential)Your agent or backendCreate, read, update and complete Sessions, read Events and revisions, and manage the webhook endpoint, sent as Authorization: Bearer …. Created and revoked in your developer account. The deployment's own operator key is held by the Sess team and never issued to developers.
Trial management credential (sess_mg_…)Whoever started a trialReturned once, when the trial is created. Reads that trial's Sessions and results until their retrieval deadline and creates more Sessions in the trial. It cannot publish revisions, complete Sessions or configure webhooks, and it is not an API key. Anything else it is used for answers a generic 404 NOT_FOUND.
Sess linkThe person you send it toOpen the page of that one request and submit its declared actions. It can never call the owner or trial API, read your private metadata or change where results go.

A Sess link carries a random token of at least 128 bits. Sess stores only a hash of the token and finds the Session by that hash; the token itself is never stored. Trial management credentials are random secrets too, stored only as hashes. The deployment’s operator key is a secret held by the Sess team and compared in constant time. API keys are random secrets with at least 128 bits of entropy, stored only as hashes. A wrong, expired or revoked Sess link shows the same generic page as a link that never existed, headed "This link is unavailable": "This link has expired or is not valid. Ask the agent for a new one."

Signing in to your account (with an email link) proves who you are as a developer; it says nothing about the person who opens a Sess link. A trial can be claimed into an account with its management credential, never with the Sess link.

Idempotency and retries

Reads are always safe to repeat.

Updates (PATCH) and completion accept an Idempotency-Key header, scoped to your credential, the operation and the Session. The same key with the same API call (body and If-Match) returns the original result; the same key with a different API call fails with 409 IDEMPOTENCY_CONFLICT. Sess never deduplicates by comparing content.

Creates refuse an Idempotency-Key header, because a replay would have to return the Sess link again and Sess keeps only its hash. If a create times out, a retry may create a second Session.

A person's repeated click carries the same client event ID and is accepted once, with the same result and receipt.

Revision conflicts

If your agent publishes revision 2 while the person still has revision 1 open, their submission names revision 1 and is refused with SESSION_REVISION_CONFLICT. It is never silently applied to revision 2: the page shows the new revision with the person's safe draft values filled in and asks them to submit again.

Your agent's own updates are protected the same way. PATCH and complete need the current ETag in If-Match: a stale one fails with 412 SESSION_REVISION_CONFLICT, a missing one with 428 PRECONDITION_REQUIRED, and a weak ETag (W/"…") never matches.

Delivery and uncertain outcomes

An accepted response, its Event, its receipt and, when your workspace has a verified webhook endpoint, its delivery job are written in one database transaction, so a crash cannot lose an accepted answer or its pending delivery, and polling always returns it.

Webhook delivery is at least once. Transient failures (5xx, 429, 408, 425, timeouts and disconnects) are retried with jitter, up to 12 attempts within 24 hours, always with the same body and receipt; other 3xx and 4xx answers end the delivery as failed. Your receiver should deduplicate on webhook-id, which is the Event ID. Every attempt is listed in GET /v1/sessions/{id}/deliveries, and any accepted Event can be redelivered. A 2xx means your endpoint accepted the delivery; a webhook signature proves the delivery came from Sess. Neither proves that any upstream work happened. A timeout or dropped connection is never recorded as delivered. See Receive results by webhook.

Errors

Every API error has the same JSON shape. Branch on code; the message is for people and may change. Errors on the person's page are HTML pages instead.

Error body
{
  "error": {
    "code": "SESSION_NOT_FOUND",
    "message": "Session not found.",
    "request_id": "req_00000000-0000-4000-8000-000000000000"
  }
}

The API reference lists every code, and the quickstart explains the common ones.

A request body that does not match the schema answers 400 with field, a JSON pointer to its first failing value. Other schema errors (malformed JSON, path and query values) carry no field, limit, length, expected or actual. A 401 for a create sent with no Authorization header also names the no-signup trial, POST /v1/trial/sessions.

Gateway errors and unseen outcomes

Not every error comes from Sess. The hosting platform’s gateway may answer 502 or 504 with an HTML page instead of the JSON error above, and it may turn a 503 from Sess into an HTML 504. Treat any 5xx response whose body is not JSON as retryable. A gateway error, a timeout or a dropped connection does not tell you whether Sess acted, so treat the outcome as unknown, not as failed:

  • Updates and completion: send an Idempotency-Key on every update and completion, and retry with the same key, body and If-Match. If the first attempt took effect, the retry returns its original result instead of acting twice. Without a key, a retry after an applied first attempt answers 412 (update) or 409 SESSION_COMPLETED (completion), which does not mean your first attempt failed; read the Session to see its current revision, status and ETag.
  • Creates take no Idempotency-Key, so a retry creates a new Session. A Session made by the unseen attempt cannot be looked up, because its ID and Sess link were only in the lost response; nobody receives its link, and it expires as described below.
  • The person's page: the form carries a client event ID, so submitting the same form again is accepted at most once, with the same result and receipt. Your agent reads the Session to learn whether an answer was accepted.

Webhook setup: the signing secret appears only in the response that created it. If the response to your first PUT /v1/webhook is lost, a retry answers with signing_secret: null; rotate the secret (POST /v1/webhook/secrets/rotate) to get one you can see. A retried rotation rotates again, and the newest secret is the one returned.

Expiry and revocation

For a Session created with your API key on Free, the link expires 7 days after the Session is created. A Sess link for an operator-key Session expires 30 days after the Session is created. A trial’s Sess link accepts answers for 1 hour (action_expires_at), and its result stays readable for 24 hours after that (result_available_until). Reading a Session with GET /v1/sessions/{id} returns its Sess link’s expiry as action_expires_at, the same name the trial uses; reading it never extends the link. Expiry stops new input; it never discards a response that was already accepted. Sess can revoke a single Session’s link immediately; after expiry or revocation the link shows the generic "This link is unavailable" page and nothing else.

Advanced: to keep a link open for less time, set expires_in when you create the Session: seconds from 30 up to your plan's link lifetime. An expires_in out of range fails with 400 INVALID_SCHEMA, and its message names both bounds. action_expires_at is when the link ends. It is set when the Session is created and is never null. Finishing the Session doesn't change it. link_state is live while the link opens and accepts answers, and expired once it will never accept an answer.

Every Session gets documented deadlines for new input, for delivering an accepted result, and for deleting the data. See Retention and deletion.

Was this page useful?

Tell us more

Thanks for telling us.

You’ve sent a lot of answers in the last hour. Please try again later.

This couldn’t be sent right now. Please try again later.

That didn’t go through. Keep your note under 280 characters and send it again.

No account needed. We keep your answer, your note and this page’s address for a year, with a one-way code of your network address to stop abuse. Please leave out personal details.