CoworkkitDocs
Sign inCreate account
© 2026 CoworkkitTerms of ServiceRefund PolicyData Processing AddendumPrivacy PolicyCookie PolicyData & Security

Start here

  • Getting started
  • The setup prompt
  • How it works

Declaring your app

  • Actions, surfaces & elements
  • Hand mode
  • Control & confirmation
  • Show while it talks
  • Patterns & best practices

Integrate

  • Backends
  • Usage, quotas & webhooks
  • Multiple coworkers
  • Connect your coding agent

Polish & operate

  • Appearance
  • Languages
  • Typing and reading
  • The Watch panel
  • Development mode

Reference

  • Advanced
  • Configuration
  • Browser & framework support
  • Network requirements
  • Regions
  • Browser storage
  • Troubleshooting & FAQ
  • Error codes
All docs

Docs

Usage, quotas & webhooks

After every session your backend learns what it consumed, for which user, and why it ended — by the sessions API (pull) and signed webhooks (push), on every plan. Plus Quotas: fixed on Free, adjustable on Starter, programmable per session on Growth.

After every voice session your backend can learn what it consumed — how many minutes, for which of your users, and how it ended — two ways: pull (a sessions API you call when you like) and push (a signed webhook we send the moment a session ends). Both ship on every plan, Free included — you wire and test the integration before you pay. You are billed in minutes, so you get minutes: no tokens, no provider names, no per-minute cost.

The session id

The mint response now carries a sessionId — an opaque ses_… handle. Store it against your user; it is the one identifier for the session everywhere you can see it (the mint response, the record, the API, the webhook).

the mint response
{ token, serverUrl, cloudUrl, language, supportedLanguages,
  sessionId: "ses_01J9…",              // store this
  session: { budgetMinutes: 7, closing: "cut", region: "europe" } }  // what actually applied

The record

Both the pull API and the push webhook return the same object:

the session record
{ sessionId, userId, startedAt, endedAt, billedMinutes, turns,
  endReason: "complete" | "user_away" | "out_of_credit"
           | "session_limit" | "daily_limit" | "budget_limit" | "error",
  region, status: "recorded" | "unrecorded",
  session: { budgetMinutes?, closing?, region? } }

billedMinutes is null (never 0) for a session that appears in the transport log but never wrote a record (status: "unrecorded").

A session nobody joined is one of these. For example, a person taps the button and then leaves at the browser’s microphone prompt. That session shows as unrecorded with no billed minutes, costs nothing, and sends no session.ended.

Pull: the sessions API

Server-to-server, on the same secret x-api-key as /session (never from the browser). Fetch one session, or list them:

GET /sessions
GET {base}/sessions/{sessionId}       → the record above
GET {base}/sessions?userId=&from=&to=&cursor=&limit=
    → { sessions: [ …records… ], nextCursor: "…" | null }
      newest first · limit 1–100 (default 50) · from/to are ISO-8601 instants on startedAt

Push: webhooks

Configure one endpoint per account under Settings → Webhooks (every plan). One endpoint receives events for all your coworkers; every event carries a top-level coworker ({ id, name }, a sibling of data) naming the coworker it came from, so one receiver can serve several. The endpoint must be a public https URL — localhost and private-network addresses are refused at delivery time, so use a tunnel or a deployed route while developing. We POST a signed event the moment a session ends (session.ended, data = the record; a session nobody joined has no record and sends none), when your balance runs low (credits.low), and, for an Interviewer, when a person sends their answers (interview.completed, below). Failed deliveries retry with backoff (1 min, 5 min, 30 min, 2 h, 12 h); five consecutive failed events auto-disable the endpoint (we email you, re-enable in the portal). Verify the signature with verifyWebhook — read the raw body:

app/api/coworkkit/webhook/route.ts
import { verifyWebhook, WEBHOOK_MAX_BODY_BYTES } from "@coworkkit/server";

export async function POST(req: Request) {
  // A public route: refuse an oversized body BEFORE reading it (see "Body size" below).
  if (Number(req.headers.get("content-length")) > WEBHOOK_MAX_BODY_BYTES) {
    return new Response("too large", { status: 413 });
  }
  const raw = await req.text(); // the RAW bytes — a re-serialised body won't match
  const event = verifyWebhook(raw, req.headers.get("coworkkit-signature"), process.env.COWORKKIT_WEBHOOK_SECRET!);
  // event.coworker = { id, name } — which coworker this event is for (one endpoint per account)
  if (event.type === "session.ended") {
    // idempotent on event.id / sessionId — deliveries are at-least-once
    await db.deductMinutes(event.data.userId, event.data.billedMinutes, event.data.sessionId, event.coworker.id);
  }
  return new Response("ok"); // acknowledge within 10 s; do slow work after
}

The signature, spelled out

verifyWebhook is about forty lines of node:crypto and nothing else — no logging, no network, no storage (read it in the published package). The scheme is the Stripe-style one, so you can verify by hand, in any language, without the SDK:

  • The header is one line: coworkkit-signature: t=<unix seconds>,v1=<hex>. t is the send time; v1 is the signature. Ignore any other scheme.
  • The signed string is <t>.<raw body> — the timestamp, a dot, the exact request bytes. The signature is HMAC-SHA256 of that string, keyed with your endpoint secret (whsec_…), hex-encoded.
  • Compare in constant time, and reject when |now − t| is over 300 seconds (the replay window — never set it to 0; keep your clock on NTP).
  • Every attempt of one event carries the same coworkkit-event-id (= event.id) with a fresh t and signature. Dedupe on the id.

Body size

Every Coworkkit webhook body is under 64 KB (WEBHOOK_MAX_BODY_BYTES, 65,536 bytes; a session.ended is about half a kilobyte) — we refuse to send anything larger, so you can refuse to receive it. The route is public, so cap request bodies at that size before reading them: the content-length check above, express.raw({ limit: "64kb" }), or your edge's body-size limit. verifyWebhook also rejects anything over its maxBodyBytes (default 64 KB) before doing any cryptographic work — the backstop for a chunked body with no length, not the guard. Respond 2xx within 10 seconds (our delivery timeout); a slower or failed response is retried on the schedule above.

interview.completed

An Interviewer co-worker also sends interview.completed each time a person presses Send on their interview link: the same envelope (id, type, createdAt, coworker), signed and retried the same way. data carries the link, who it was for, and the answers:

interview.completed
{
  "id": "evt_01JC…",
  "type": "interview.completed",
  "createdAt": "2026-11-07T12:42:51.000Z",
  "coworker": { "id": "feedback-a1b2", "name": "Feedback" },
  "data": {
    "linkId": "lnk_7k2m4q4wtz6x3c6v5bhn",
    "ref": "user_123",
    "version": 3,
    "person": { "name": "Ana", "email": "ana@example.com" },
    "inputs": { "plan": "Pro" },
    "submittedAt": "2026-11-07T12:42:51.000Z",
    "minutes": 9,
    "answers": { "role": "Founder", "verdict": "8" },
    "consents": { "contact": true }
  }
}
  • ref, person.name and person.email are null when the link had none. version is the published version the person answered.
  • minutes counts the minutes recorded for this link by the time of Send. The call still running when the person pressed Send is recorded when it ends, and arrives in its own session.ended (its userId is the link id).
  • The answers ride whether or not the interview keeps them in the portal. If the event would be over 64 KB, answers and consents are dropped and "answersOmitted": true is set; read them with the links API while they're kept.

Quotas — keep one user from draining your balance

A quota is a standing per-user wall; a budget is what your code hands one session. Three depths, one per tier:

  • Fixed (Free) — 30 min per session, 60 min per user per day. We protect; you can't change them.
  • Adjustable (Starter) — tune both walls (or switch them off) in the coworker's Quotas card. One allowance for every user.
  • Programmable (Growth) — pass session.budgetMinutes at mint from your own code, so different users get different allowances.

The layers stack; the tightest wins. When a wall is hit the user hears a short goodbye (or a clean cut, per session.closing) — never "out of credit"; the record's endReason says which wall it was, and a refused mint returns reason: "daily_limit".

The session container echoes what applied

Read the response's session to know what will actually govern the session: budgetMinutes is the ceiling that will bind (absent when unbounded), closing is "goodbye" (default) or "cut", and region is the basin honoured (present only when a preference was). On Free and Starter the plan's wall is echoed whatever you requested — nothing is refused, the response just tells you what applies.

PreviousBackendsNextMultiple coworkers

Machine-readable: this page as Markdown · all docs (llms.txt) · everything in one file (llms-full.txt)