Pair a code and talk in about ten lines. Then make it yours: your own tenant and tokens, devices and keys, webhooks, relay recipes, receipts you can verify offline, and your own server.
Someone joins the same call from the home page or a phone with the code you print. A pairing code is 8 characters, works for 30 minutes and lets up to 4 people in; the server allows 10 new calls and 30 joins per client every 10 minutes.
Make it yours
Your tenant and tokens
The operator makes your tenant and a tenant-admin token; it mints sender tokens for your services. A token is shown once; the server keeps its SHA-256, and revoking it stops even a request already in flight.
POST /admin/v1/tenants · POST /tenants/:t/tokens · POST /tenants/:t/tokens/:id/revoke
Devices and keys
A phone or program enrols with its own P-256 public key and signs every request; its id comes from the key. Revoke or replace a device at once.
POST /tenants/:t/devices · …/devices/:id/revoke · …/devices/:id/replace
Webhooks
The workflow engine writes every event to a per-tenant outbox and delivers it to your endpoints in order, at least once, with back-off, a dead-letter range and replay. Events hold ids, states and hashes, never content.
Signed with your tenant's key; see the workflow routes.
Relay recipes
A recipe is data: a source, steps and a sink, run with a sealed step per hop. The first: a mail reply, cut to an excerpt, translated by x-talk, sent on Telegram.
Every step is a receipt on a SHA-256 chain, signed with Ed25519. Fetch the keys, then verify a chain in the SDK or an audit export on the command line.
Hold-to-talk in the browser, with invites and babel-fish.
On the pre-production server
Start a call and you get a pairing code to share; the other person types it on a phone or opens your link. An invite link (it ends in #invite=…) works too. Open it in two browsers or on two phones, pick a name and the language you listen in, then hold the button and talk.
Without a code or a link, the page offers Start a call and Join with a code. You can also start one on the home page.
What you will see
Your browser makes its own device key; it never leaves the browser.
Hold to talk: the others hear you as you speak. Let go, and the floor is free.
Speak, or type what you said; each listener gets it in their own language and hears it read aloud.
No microphone? Tick "Test tone" and the browser sends a tone instead.
Run it on your own machine
Node 22 and pnpm. Nothing here is a real secret: the demo makes a development key and an admin token for the run and throws them away.
pnpm install
pnpm --filter @tin-phone/server-node build
node packages/server-node/scripts/ptt-demo.mjs
# prints an invite link for http://127.0.0.1:8788; open it in two browsers
# options: --port 8788 --host 0.0.0.0 (phones on the same network) --xtalk <x-talk URL>
Without --xtalk, a local stand-in answers each translation as [lang] words, so babel-fish can be seen without x-talk. In one browser, add ?as=bob to the address to be a second person in another tab.
API playground
Pick a call and fill in the blanks; copy the command. Calls that need no token can be sent from here.
Command
Choose a call.
The token stays a placeholder, $TIN_PHONE_TOKEN: set it in your own shell. This page never asks for it.
Answer
Nothing sent yet.
Verify a receipt chain
The conformance vectors, verified with WebCrypto in your browser.
Contract version 1.0.0, checked by the conformance vectors.
import { NoticesClient } from "@tin-phone/sdk";
const notices = new NoticesClient({ baseUrl, tenantId, token, trustedKeys });
const sent = await notices.send({ to: [deviceId], content: { type: "text", body: "Gate 4 is open" } });
await notices.get(sent.id); // per-device states
await notices.waitFor(sent.id, (s) => s.deliveries.every((d) => d.state === "acknowledged"));
const { events, check } = await notices.verifiedReceipts(sent.id); // throws unless the chain verifies
await notices.revoke(sent.id);
NoticesClient
Method
Does
send(input)
sends a notice: to, content, actions, ttlSeconds or expiresAt, followUp
get(id)
the notice and each delivery's state
revoke(id)
takes it back from every device that has not acknowledged
receipts(id)
the sealed chain, as the server gives it
verifiedReceipts(id, keys?)
the chain, verified against the keys you pinned
waitFor(id, done, options)
polls until done(status) is true or the wait runs out
verifyReceiptChain(events, keys, id?)
the verifier on its own: {ok, count, head} or the first failure's seq and code
Errors are NoticeApiError with a kind (invalid, unauthorised, forbidden, not-found, conflict, unavailable, server, unexpected), ReceiptVerificationError and NoticeWaitTimeoutError.
Push-to-talk: PttClient and PttSession
import { PttClient, webCryptoDeviceSigner } from "@tin-phone/sdk";
const signer = await webCryptoDeviceSigner(privateKey, publicKeyDer); // Pillion's request signing
const ptt = new PttClient({ apiUrl, signer });
const [first] = await ptt.channels();
const talk = await ptt.connect(first.id);
talk.on("audio", (f) => player.play(f.payload));
talk.on("floor", (f) => {
// press() only asks; send once the server grants the floor to this device
if (f.state === "granted" && f.holder === talk.me) startSending();
});
talk.press();
// while talking (talk.talking is true), every 20 ms: talk.sendAudio(packet)
// when the key is let go: talk.release()
The session checks each sealed digest against what it heard and confirms a replay as heard only when they match. ptt.iceServers() gives STUN and TURN for WebRTC.
WebRTC: PttRtcMesh
import { PttRtcMesh } from "@tin-phone/sdk";
const mesh = new PttRtcMesh(talk, { // the connected PttSession, then the options
RTCPeerConnection, // the platform's
iceServers: () => ptt.iceServers(), // refreshed before the TURN credential runs out
localStream: () => navigator.mediaDevices.getUserMedia({ audio: true }),
onRemoteStream: (from, stream) => play(stream),
});
Writing an adapter
Create packages/adapters/<name>/ with its package.json and tsconfig.json.
Implement the Adapter interface from @tin-phone/core.
Declare its capabilities: realtime, bidirectional, richContent, presence, typing.
send() for outbound delivery; parse() for inbound events; verify() for webhook signatures, if it has them.
Tests in src/__tests__/.
Writing a provider
packages/providers/<name>/, exporting . and ./fake.
A classifier for the provider's error bodies, and a class implementing TextSink (or a narrower API) that passes its secrets in for redaction.
A fake built on FakeProvider, with the provider's real request checks and error bodies.
Tests of the adapter against its fake, including each refusal and each error kind.
API reference
tin-phone public notices API: Send a notice to enrolled devices of a tenant and read its delivery and acknowledgement receipts. Contract version 1.0.0, OpenAPI 3.1.0.
Authentication
A tenant API credential: 20 to 128 characters of [A-Za-z0-9_-], issued once by the tenant's admin (role sender) or the operator. The server keeps only its SHA-256. The operator's own token is accepted too but is not part of this contract.
The base address is the operator's: a self-hosted server answers on http://127.0.0.1:8787 by default.
Send a notice to enrolled devicesBearer tenant token
Role sender only. Every addressee must be an enrolled, unrevoked device of this tenant; otherwise 403 with the same answer for an unknown, another tenant's or a revoked device, so a sender learns nothing about devices outside its tenant. The notice and one queued receipt per device commit together.
tenantIdpath, required
The tenant. personal is never a tenant: every route refuses it (403).
201 The notice was queued for every addressee. (SentNotice)
400 The request is malformed or breaks a limit. (Error)
401 No credential, or one the server does not know. (Error)
403 The credential is of another tenant, its role may not do this, an addressee is not an enrolled device of this tenant, or the tenant is personal. (Error)
404 No such tenant or notice (or it is another tenant's). (Error)
503 Notice delivery is not configured on this server. (Error)
Roles sender and tenant-admin. Overdue deliveries are expired before the answer. A notice of another tenant is 404.
tenantIdpath, required
The tenant. personal is never a tenant: every route refuses it (403).
noticeIdpath, required
200 The notice and one delivery per addressee. (NoticeStatus)
401 No credential, or one the server does not know. (Error)
403 The credential is of another tenant, its role may not do this, an addressee is not an enrolled device of this tenant, or the tenant is personal. (Error)
404 No such tenant or notice (or it is another tenant's). (Error)
503 Notice delivery is not configured on this server. (Error)
Role sender only. Every open delivery (queued or delivered) becomes revoked, sealed; acknowledged and expired deliveries keep their state. Idempotent.
tenantIdpath, required
The tenant. personal is never a tenant: every route refuses it (403).
noticeIdpath, required
200 The deliveries after the revocation. (RevokedNotice)
401 No credential, or one the server does not know. (Error)
403 The credential is of another tenant, its role may not do this, an addressee is not an enrolled device of this tenant, or the tenant is personal. (Error)
404 No such tenant or notice (or it is another tenant's). (Error)
503 Notice delivery is not configured on this server. (Error)
The sealed receipt chain of a noticeBearer tenant token
Roles sender and tenant-admin. events is the whole chain, oldest first. check is the server's own check and is informative only: a client verifies events itself against the seal keys it pinned. A receipt never carries the notice's content, only its digest.
tenantIdpath, required
The tenant. personal is never a tenant: every route refuses it (403).
noticeIdpath, required
200 The chain and the server's check of it. (NoticeReceipts)
401 No credential, or one the server does not know. (Error)
403 The credential is of another tenant, its role may not do this, an addressee is not an enrolled device of this tenant, or the tenant is personal. (Error)
404 No such tenant or notice (or it is another tenant's). (Error)
503 Notice delivery is not configured on this server. (Error)
One sealed step. hash = lowercase hex SHA-256 of the UTF-8 canonical JSON of {lineId, seq, at, who, what, text, data, prev} (keys sorted by UTF-16 code unit at every depth); sig = base64 Ed25519 over the UTF-8 bytes of the 64-character hash; keyId = first 16 hex of SHA-256 over the seal key's SPKI DER. The shape of @contextual/seal.
Outside the versioned notices contract; they may change between versions.
Routes by area
Area
Who
Routes
Channels and messages
Bearer: operator or tenant token
GET /health · GET /adapters · POST /channels · GET /channels/:id · DELETE /channels/:id · POST /channels/:id/messages · GET /channels/:id/messages · POST /webhooks/:adapterId
Operator
Bearer: admin token
POST /admin/v1/tenants · POST /admin/v1/tenants/:t/tokens · POST /admin/v1/devices · POST /admin/v1/devices/import · POST /admin/v1/devices/:id/revoke · GET /admin/v1/tenants/:t/devices · POST /admin/v1/tenants/:t/tokens/:id/revoke · POST /admin/v1/tenants/:t/workflow-credentials/:id/revoke
Tenant admin
Bearer: tenant-admin token, or the operator
POST /tenants/:t/tokens · POST /tenants/:t/tokens/:id/revoke · POST /tenants/:t/devices · POST /tenants/:t/devices/:id/revoke · POST /tenants/:t/devices/:id/replace · GET /tenants/:t/devices · GET /tenants/:t/audit?format=json|csv&from=&to=
Devices
Signed by the device (X-Pillion-*)
GET /devices/v1/self · GET /devices/v1/notices · GET /devices/v1/notices/stream (SSE) · GET /devices/v1/notices/socket (WebSocket) · POST /devices/v1/notices/:id/received · POST /devices/v1/notices/:id/ack
Receipt keys
None; rate limited, cacheable
GET /receipts/v1/keys
Push-to-talk
Tenant admin or operator; devices sign
POST /ptt/v1/tenants/:t/channels · GET /ptt/v1/tenants/:t/channels/:id · GET /ptt/v1/tenants/:t/channels/:id/receipts · GET /ptt/v1/device/channels · POST /ptt/v1/device/channels/:id/ticket · POST /ptt/v1/device/channels/:id/spurts/:spurtId/heard · GET /ptt/v1/device/ice · GET /ptt/v1/socket?ticket=…
Relay
Tenant admin; postmaster signs its events
POST /relay/v1/tenants/:t/telegram/links · PUT /relay/v1/tenants/:t/sources/postmaster · POST /relay/v1/postmaster/:tenantId · POST /relay/v1/telegram/webhook
Pillion Fleet
Bearer: operator token of the tenant
POST /fleet/v1/admin/tenants/:t/operator-tokens · GET /fleet/v1/tenants/:t/jobs · POST /fleet/v1/tenants/:t/jobs · GET /fleet/v1/tenants/:t/jobs/:id · the console at /fleet