Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.
openapi: 3.2.0
info:
title: Pondchat Signaling Room API
version: 1.0.0
description: WebSocket signaling for ephemeral WebRTC rooms. Video/audio are peer-to-peer; this API only relays SDP and ICE.
servers:
- url: wss://pondchat.com
description: Production signaling
tags:
- name: Room
paths:
/api/room/{roomId}:
get:
operationId: connectSignaling
summary: WebSocket signaling upgrade
description: Upgrade to WebSocket for room signaling. Admitted mesh cap is enforced at join (close 4009); a locked pond refuses newcomers with room-error 'locked' (close 4010) — rejoining occupants must echo the `resumeToken` issued in their join room-state (a bare userId is not membership proof). Claiming a live occupant's userId without its resumeToken is refused as room-error 'id-taken' (close 4011) — mint a fresh userId and rejoin; the occupant's own reconnect presents the token and replaces its old socket (close 4002). Accept allows handshake slack for reconnect overlap. The join payload may carry an optional self-reported client surface (web|mobile|telegram|extension) counted as joins_ in /api/stats; unknown values drop the join. Server may send signal-undelivered when targeted offer/answer has no live peer socket. The join room-state also carries `sessionId` — the room epoch, reminted after each wipe, for clients to drop locally persisted history. An admitted client may send `{"type":"leave"}` before closing to mark a deliberate exit; the emptied pond is wiped at once on any departure — leave or plain disconnect alike (no reconnect grace for stored content). See /docs/api/signaling.md for message types.
parameters:
- name: roomId
in: path
required: true
schema:
type: string
maxLength: 256
- name: Origin
in: header
required: true
description: 'CSWSH allowlist check (production). Browsers send it automatically; non-browser agents must set Origin: https://pondchat.com. Missing or non-allowlisted Origin returns 403.'
schema:
type: string
example: https://pondchat.com
responses:
'101':
description: Switching Protocols — WebSocket established
'403':
description: Origin not allowed
'426':
description: Upgrade Required
'410':
description: Room expired (Telegram TTL)
'429':
description: Handshake socket cap, per-IP connection limit, or HTTP signal rate limit
tags:
- Room
/api/room/{roomId}/signal:
post:
operationId: httpBackupSignaling
summary: HTTP backup for SDP/ICE when WebSocket is down
description: Forwards offer, answer, candidate, or candidates-batch to a connected peer in the same Durable Object as the room WebSocket. The Worker strips /signal before idFromName.
parameters:
- name: roomId
in: path
required: true
schema:
type: string
maxLength: 256
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- type
- target
- sender
- payload
properties:
type:
type: string
enum:
- offer
- answer
- candidate
- candidates-batch
target:
type: string
sender:
type: string
payload: true
resumeToken:
type: string
description: Resume credential issued to sender in the join room-state; verified server-side, never forwarded
responses:
'200':
description: Forwarded to the target WebSocket
'400':
description: Invalid body
'403':
description: Origin not allowed, sender has never joined this room, or resumeToken missing/invalid
'404':
description: Target peer not connected
'413':
description: Payload too large
'429':
description: Rate limited
tags:
- Room
/api/room/{roomId}/state:
get:
operationId: roomState
summary: Room liveness probe
description: Public read-only capacity/lock check. Use to tell "pond full" or "room locked" apart from a dead link before joining — a WebSocket upgrade over the cap only surfaces as close 1006 to browsers.
parameters:
- name: roomId
in: path
required: true
schema:
type: string
responses:
'200':
description: Room state
content:
application/json:
schema:
type: object
properties:
ok:
type: boolean
example: true
maxParticipants:
type: integer
example: 6
full:
type: boolean
example: false
moderated:
type: boolean
example: false
locked:
type: boolean
example: false
expired:
type: boolean
example: false
description: true = pond gone for good; do not retry joining
tags:
- Room