Skip to content

The server API is for your backend and your tools: it reads and changes your account, your apps and their keys, and it removes users from rooms. The base URL is https://api.jsflow.com; staging is https://api.staging.jsflow.com.

Send the credential as a bearer token: Authorization: Bearer <credential>.

  • An app’s secret key (sk_…) works for that app’s routes, from your own backend. Keep it on the server: never in a page, a repository or a chat.
  • An account access token (jft_…) works for the routes of its scopes, for a tool or an agent acting as a person. Create one in the dashboard or with the CLI; see which credential for which job and the scopes.

Errors have one shape, { "err": "<code>", "message": "…" }, and the codes are the ones on the error codes page. Any route can answer bad_request, unauthorized, forbidden, not_found, rate, unavailable, internal; each route below lists only its own. Every response carries x-jf-build, the build that answered, which is worth quoting in a bug report. Lists are paged with limit and cursor: pass the next of one page as the cursor of the next.

A first call, from your own backend:

Terminal window
curl -s https://api.jsflow.com/v1/apps/APP_ID/rooms \
-H "Authorization: Bearer $JSFLOW_TOKEN"
Method Path What it does
GET /.well-known/oauth-authorization-server Authorization server metadata (RFC 8414)
POST /oauth/device_authorization Start a device login (RFC 8628 §3.1)
POST /oauth/token Poll for the token (RFC 8628 §3.4); device grant only at 1.0
GET /v1/accounts/{acct} One account
GET /v1/accounts/{acct}/apps The account’s apps
POST /v1/accounts/{acct}/apps Create an app
GET /v1/accounts/{acct}/audit Audit log (sign-ins, keys, members, plan, limits)
GET /v1/accounts/{acct}/billing Plan, status, period, spend cap, cap state
POST /v1/accounts/{acct}/billing/preview What a plan or cap change would cost (proration preview)
GET /v1/accounts/{acct}/billing/quote What a plan costs a month, with tax, before the contract
GET /v1/accounts/{acct}/invoices Invoices
GET /v1/accounts/{acct}/notices Current notices (the dashboard’s banners; the same shape as the emails)
GET /v1/accounts/{acct}/usage The billing period so far (invoice preview)
GET /v1/apps/{app} One app
PATCH /v1/apps/{app} Change name, origins, limits, tickets, region, link beacon, App Attest IDs
GET /v1/apps/{app}/blocklist The app’s blocklist
POST /v1/apps/{app}/blocklist Block a user or peer
DELETE /v1/apps/{app}/blocklist/{entry} Unblock
GET /v1/apps/{app}/keys The app’s keys (active and revoked)
POST /v1/apps/{app}/keys Create a key
DELETE /v1/apps/{app}/keys/{key} Revoke a key
GET /v1/apps/{app}/live Live totals now, per region
GET /v1/apps/{app}/records The recent-records log
GET /v1/apps/{app}/rooms Live rooms, now
GET /v1/apps/{app}/rooms/{room} One live room with its peers
POST /v1/apps/{app}/rooms/{room}/evict Evict a user or peer from a room
GET /v1/apps/{app}/usage Usage over time (from the aggregates)
GET /v1/apps/{app}/usage/concurrency Concurrent peers and rooms over time
GET /v1/apps/{app}/usage/export Raw records for one day
GET /v1/apps/{app}/usage/room-sizes How big the day’s rooms got
GET /v1/apps/{app}/usage/rooms Top rooms for one day
GET /v1/me The token’s user, its account, and the token itself
GET /v1/tokens This user’s tokens in this account (metadata; never values)
DELETE /v1/tokens/{token} Revoke one of this user’s tokens; current is the calling token (logout)

The account, its billing, invoices, notices and audit log.

The account’s name, plan, status and limits.

Authorisation: an account access token (jft_…) with the scope usage:read.

Parameters

Name In Type Required Description
acct path string yes The account’s id (acct_…).

Response 200: OK (application/json)

Field Type Required Description
id string yes The account’s id (acct_…).
name string yes The account’s name.
plan "free" | "pro" | "scale" | "enterprise" yes The current plan.
status "active" | "past_due" | "canceled" | "closing" yes active: in good standing; past_due: a payment failed and is being retried; canceled: a paid subscription has ended; closing: the account is being closed.
created string (date-time) yes When the account was created.
limits AccountLimits (object) yes What the plan allows.
limits.apps integer yes Apps the plan allows.
limits.seats integer yes Members the plan allows (the dashboard calls them members).

Who did what in the account: sign-ins, keys created and revoked, app changes, members and roles, plan and spend-cap changes.

Authorisation: an account access token (jft_…) with the scope audit:read.

Parameters

Name In Type Required Description
acct path string yes The account’s id (acct_…).
cursor query string The next of the previous page.
limit query integer (default 50) Items per page, 1 to 200.

Response 200: OK (application/json)

Field Type Required Description
items array of AuditEntry (object)
items[].time string (date-time) When it happened.
items[].actor object Who did it.
items[].via string | null The agent that acted under a token, as it named itself in the X-JF-Actor header the caller sends; untrusted text, display it escaped.
items[].action string e.g. signin, key.create, key.revoke, app.update, member.add, plan.change, cap.change
items[].target string What it was done to: an app, key, user or the account, by id.
items[].detail object More about the change, depending on the action (for example which fields of an app changed).
items[].ipPrefix string | null /24 or /48
next string | null Pass as cursor to get the next page; null on the last page.

The account’s plan, billing period, spend cap and what the cap is doing now. For the amounts so far this period, use usage.

Authorisation: an account access token (jft_…) with the scope usage:read.

Parameters

Name In Type Required Description
acct path string yes The account’s id (acct_…).

Response 200: OK (application/json)

Field Type Required Description
plan "free" | "pro" | "scale" | "enterprise" yes The current plan.
status "active" | "past_due" | "canceled" | "closing" yes As the account’s status.
currency "eur" | "usd" | null yes The currency the account is billed in; null before the first purchase.
periodStart string (date-time) yes The start of the current billing period.
periodEnd string (date-time) yes The end of the current billing period.
cancelAtPeriodEnd boolean yes The paid plan ends at periodEnd and the account returns to Free.
scheduledPlan "free" | "pro" | "scale" | "enterprise" | null yes A downgrade taking effect at period end.
spendCap Money (object) | null yes The most the account may spend in a period, or null for no cap.
capState "ok" | "warned" | "reached" | "suspended" yes ok: under half the cap, or no cap set; warned: past 50% or 80% of it; reached: new joins are refused, rooms already open keep running; suspended: new joins and token refreshes are refused.
relayUnlocked boolean yes Free only: relay after a GitHub/Google sign-in or 7 days
internal boolean yes Never invoiced
buyer "individual" | "company" | null GET billing only: who bought, from the latest purchase (checkout or an upgrade); null if the account never bought.
country string | null GET billing only: the purchase’s country (ISO 3166-1 alpha-2), as declared at checkout.
withdrawal null | object yes The consumer withdrawal right of the latest purchase (EU, Norway); null for companies, other countries, or no purchase. until never moves.

Nothing changes. For a plan change: Stripe’s invoice preview with proration (an upgrade takes effect at once and is prorated; a downgrade at period end, so its preview is the next renewal), plus the new allowance and what the period’s usage so far would cost under it. For a cap: whether joins would resume.

Authorisation: an account access token (jft_…) with the scope usage:read.

Parameters

Name In Type Required Description
acct path string yes The account’s id (acct_…).

Request body (application/json, required)

Field Type Required Description
plan "free" | "pro" | "scale" The plan to change to.
cap Money (object) | null A new spend cap to preview instead of a plan, or null for none.

Response 200: OK (application/json)

Field Type Required Description
plan "free" | "pro" | "scale" | "enterprise" yes The plan after the change.
effective "now" | "period-end" yes Whether the change applies at once or at the end of the period.
dueNow Money (object) yes What would be charged now, with tax.
dueNow.amount integer yes minor units
dueNow.currency "eur" | "usd" yes The currency.
nextInvoice Money (object) yes The next regular invoice after the change, with tax.
nextInvoice.amount integer yes minor units
nextInvoice.currency "eur" | "usd" yes The currency.
lines array of object yes The charges that make up dueNow.
lines[].description string yes What the line is for.
lines[].amount Money (object) yes The line’s amount.
periodSoFar PeriodUsage (object) yes The current period’s usage and charges, for comparison.
periodSoFar.periodStart string (date-time) yes The period’s start.
periodSoFar.periodEnd string (date-time) yes The period’s end.
periodSoFar.plan "free" | "pro" | "scale" | "enterprise" yes The plan in the period.
periodSoFar.hardCap boolean yes The allowance is a hard limit (Free), not a threshold for overage.
periodSoFar.totals UsageTotals (object) yes The account’s usage in the period.
periodSoFar.apps array of object yes Each app’s share of the period (the account’s apps, including deleted ones that used something this period).
periodSoFar.allowance object yes What the plan includes in a period.
periodSoFar.overage array of object yes Usage beyond the allowance and its price.
periodSoFar.fee Money (object) yes The plan’s fee for the period.
periodSoFar.total Money (object) yes Fee and overage so far, before tax.
periodSoFar.spendCap Money (object) | null yes The spend cap, or null for none.
periodSoFar.asOf string (date-time) | null yes The newest record counted; null before the first.
joinsResume boolean For a cap change.

Errors: csrf, cap_below_fee, plan.

Consumers see the total with VAT before they are bound (Consumer Rights Directive Art. 6(1)(e)): Stripe Tax’s calculation for the country, the engine Checkout uses (cached 6 hours). Companies get net with taxAtCheckout: vat-number (VAT, or reverse charge with a verified EU VAT number). US consumers get net with taxAtCheckout: address (sales tax depends on state and ZIP code). Amounts in minor units of currency.

Authorisation: an account access token (jft_…) with the scope usage:read.

Parameters

Name In Type Required Description
acct path string yes The account’s id (acct_…).
plan query "pro" | "scale" yes The plan to price.
country query string yes The buyer’s country (ISO 3166-1 alpha-2, upper case), which decides the tax.
buyer query "individual" | "company" (default "individual") A consumer (individual) or a business (company).
currency query "eur" | "usd" (default "eur") The currency to price in.

Response 200: OK (application/json)

Field Type Required Description
plan string yes The plan priced.
currency string yes The currency of every amount.
country string yes The country priced for.
buyer string yes The buyer type priced for.
net integer yes The monthly fee before tax, in minor units.
tax integer | null yes The tax on it, in minor units; null when it is worked out at checkout.
rate number | null yes Percent, e.g. 25
label string | null yes “VAT 25%”, “GST 10%”; null when no tax applies
total integer | null yes The fee with tax, in minor units; null when the tax is worked out at checkout.
taxAtCheckout "vat-number" | "address" | null yes Why the tax is not known yet: it depends on a VAT number (vat-number) or on the billing address (address); null when it is included above.

The account’s invoices, newest first, with links to view and download each.

Authorisation: an account access token (jft_…) with the scope usage:read.

Parameters

Name In Type Required Description
acct path string yes The account’s id (acct_…).
cursor query string The next of the previous page.
limit query integer (default 50) Items per page, 1 to 200.

Response 200: OK (application/json)

Field Type Required Description
items array of Invoice (object)
items[].id string yes Stripe’s invoice id
items[].number string | null The invoice number (one series, no gaps)
items[].periodStart string (date-time) yes The start of the period invoiced.
items[].periodEnd string (date-time) yes The end of the period invoiced.
items[].status "draft" | "open" | "paid" | "uncollectible" | "void" yes draft (not final yet), open (awaiting payment), paid, uncollectible, or void (cancelled).
items[].total Money (object) yes The total with tax.
items[].tax Money (object) yes The tax in the total.
items[].amountDue Money (object) What remains to be paid.
items[].amountPaid Money (object) What has been paid.
items[].finalizedAt string (date-time) | null When it became final; null while a draft.
items[].paidAt string (date-time) | null When it was paid; null if not.
items[].hostedUrl string (uri) yes A page to view and pay the invoice.
items[].pdfUrl string (uri) yes The invoice as a PDF.
items[].lines array of object yes What the invoice charges for.
next string | null Pass as cursor to get the next page; null on the last page.

What needs the account’s attention now, such as a spend cap nearly reached or a payment that failed: the same notices the dashboard shows as banners and sends by email.

Authorisation: an account access token (jft_…) with the scope usage:read.

Parameters

Name In Type Required Description
acct path string yes The account’s id (acct_…).

Response 200: OK (application/json)

Field Type Required Description
items array of Notice (object)
items[].id string yes The notice’s id.
items[].kind "cap50" | "cap80" | "cap-reached" | "allowance" | "free-quota" | "relay-off" | "past-due" | "suspended" | "payment-action" | "maintenance" yes cap50, cap80, cap-reached: the spend cap is half used, 80% used, reached; allowance: the plan’s allowance is used up; free-quota: Free’s monthly quota is used up; relay-off: the relay is off (Free’s relay is used up or not yet unlocked, or the spend cap is reached); past-due: a payment failed; suspended: the account is suspended; payment-action: a payment needs your action, such as confirming it with your bank; maintenance: planned maintenance.
items[].severity "info" | "warning" | "critical" yes How urgent it is.
items[].app string | null yes Set when the notice concerns one app.
items[].since string (date-time) yes When it started.
items[].until string (date-time) | null yes Maintenance windows; free-quota: when the month’s allowance resets (03:00 UTC on the 1st); otherwise until resolved
items[].meters array of "peerMinutes" | "relayGB" free-quota only: the meters used up this month (the usage page marks them).
items[].title string yes A short title; the email’s subject.
items[].body string yes The banner line (one sentence). The email carries the full text, with the same title as its subject.
items[].action "raise-cap" | "upgrade" | "portal" | "usage" | "set-cap" | "confirm-payment" | null yes The primary action (the first of actions).
items[].url string (uri) | null For confirm-payment: the payment page where the card holder confirms the payment.
items[].actions array of "raise-cap" | "upgrade" | "portal" | "usage" | "set-cap" | "confirm-payment" Every action the notice offers, primary first: confirm-payment opens url; upgrade when the 7-day forecast would cost less on the next plan; set-cap when the account has no spend cap; usage the usage page.
items[].emailed boolean yes Whether the owners were emailed about it.
next string | null Pass as cursor to get the next page; null on the last page.

Create and change apps, and their keys.

Every app in the account.

Authorisation: an account access token (jft_…) with the scope apps:read.

Parameters

Name In Type Required Description
acct path string yes The account’s id (acct_…).

Response 200: OK (application/json)

Field Type Required Description
items array of App (object)
items[].id string yes The app’s id, used by the SDK; never reused.
items[].account string yes The account the app belongs to.
items[].name string yes The app’s name.
items[].origins array of string yes The web origins whose pages may join with the app’s publishable key.
items[].limits object yes The limits in effect (the app’s, or the plan’s where the app sets none).
items[].requireTickets boolean yes Joins need a ticket signed with a secret key.
items[].region object | object yes Where the app’s rooms live.
items[].linkBeacon boolean The SDK reports how each peer’s links run (direct or relayed); on by default.
items[].sandbox boolean A development app set up by jsflow: non-browser platforms may join with the key alone, at low limits. Not settable through the API.
items[].appAttest array of object The iOS App IDs whose App Attest joins the app accepts.
items[].capState "ok" | "warned" | "reached" | "suspended" yes reached: new joins are refused (402 quota), peers already in rooms keep their links. suspended: joins and token refreshes are refused (403 suspended), so peers drop within one refresh period.
items[].relay "on" | "off" yes off: relay credentials are STUN-only (free relay used up, not yet unlocked, the global free budget, or capState reached or suspended)
items[].created string (date-time) yes When the app was created.
items[].updated string (date-time) When its settings last changed.
next string | null Pass as cursor to get the next page; null on the last page.

Creates the app and its first publishable key in one step (the onboarding page shows both). 409 app_id_taken if any account has or had that id. 402 apps past the plan’s app limit. Joins work within 30 s of the response.

Authorisation: an account access token (jft_…) with the scope apps:write.

Parameters

Name In Type Required Description
acct path string yes The account’s id (acct_…).

Request body (application/json, required)

Field Type Required Description
id string yes The app’s id: the SDK names the app by it, and it can never be reused.
name string yes A name to show in the dashboard.
origins array of string yes The web origins whose pages may join, such as https://example.com.

Response 201: Created (application/json)

Field Type Required Description
app App (object) yes The new app.
app.id string yes The app’s id, used by the SDK; never reused.
app.account string yes The account the app belongs to.
app.name string yes The app’s name.
app.origins array of string yes The web origins whose pages may join with the app’s publishable key.
app.limits object yes The limits in effect (the app’s, or the plan’s where the app sets none).
app.requireTickets boolean yes Joins need a ticket signed with a secret key.
app.region object | object yes Where the app’s rooms live.
app.linkBeacon boolean The SDK reports how each peer’s links run (direct or relayed); on by default.
app.sandbox boolean A development app set up by jsflow: non-browser platforms may join with the key alone, at low limits. Not settable through the API.
app.appAttest array of object The iOS App IDs whose App Attest joins the app accepts.
app.capState "ok" | "warned" | "reached" | "suspended" yes reached: new joins are refused (402 quota), peers already in rooms keep their links. suspended: joins and token refreshes are refused (403 suspended), so peers drop within one refresh period.
app.relay "on" | "off" yes off: relay credentials are STUN-only (free relay used up, not yet unlocked, the global free budget, or capState reached or suspended)
app.created string (date-time) yes When the app was created.
app.updated string (date-time) When its settings last changed.
key object yes Its first publishable key.

Errors: csrf, app_id_taken, apps.

One app’s settings, limits and state.

Authorisation: an account access token (jft_…) with the scope apps:read.

Parameters

Name In Type Required Description
app path string yes The app’s id.

Response 200: OK (application/json)

Field Type Required Description
id string yes The app’s id, used by the SDK; never reused.
account string yes The account the app belongs to.
name string yes The app’s name.
origins array of string yes The web origins whose pages may join with the app’s publishable key.
limits object yes The limits in effect (the app’s, or the plan’s where the app sets none).
requireTickets boolean yes Joins need a ticket signed with a secret key.
region object | object yes Where the app’s rooms live.
linkBeacon boolean The SDK reports how each peer’s links run (direct or relayed); on by default.
sandbox boolean A development app set up by jsflow: non-browser platforms may join with the key alone, at low limits. Not settable through the API.
appAttest array of object The iOS App IDs whose App Attest joins the app accepts.
appAttest[].appId string yes .
appAttest[].development boolean Also accept that App ID’s development-signed builds.
capState "ok" | "warned" | "reached" | "suspended" yes reached: new joins are refused (402 quota), peers already in rooms keep their links. suspended: joins and token refreshes are refused (403 suspended), so peers drop within one refresh period.
relay "on" | "off" yes off: relay credentials are STUN-only (free relay used up, not yet unlocked, the global free budget, or capState reached or suspended)
created string (date-time) yes When the app was created.
updated string (date-time) When its settings last changed.

Limits can be lowered below the plan’s, never raised above (402 limit). Turning requireTickets on with no active secret key is 409 no_secret_key. region.mode = pinned is Scale only.

Authorisation: an account access token (jft_…) with the scope apps:write.

Parameters

Name In Type Required Description
app path string yes The app’s id.

Request body (application/json, required)

Field Type Required Description
name string A new name.
origins array of string The whole list of allowed origins, replacing the app’s.
limits AppLimits (object) Lower limits for this app; absent ones stay as they are.
limits.maxPeers integer Peers allowed in one room.
limits.maxRooms integer Rooms open at once.
limits.joinPerMin integer Joins per minute per IP address for this app. Absent: the default, 60 per IP per minute (not a plan limit).
requireTickets boolean Require a ticket signed with a secret key for every join.
region object | object Where the app’s rooms live; pinning is Scale only.
linkBeacon boolean The SDK’s link-type beacon; on by default.
appAttest array of object The whole list of accepted iOS App IDs, replacing the app’s.
appAttest[].appId string yes .
appAttest[].development boolean Also accept that App ID’s development-signed builds.

Response 200: OK (application/json)

Field Type Required Description
id string yes The app’s id, used by the SDK; never reused.
account string yes The account the app belongs to.
name string yes The app’s name.
origins array of string yes The web origins whose pages may join with the app’s publishable key.
limits object yes The limits in effect (the app’s, or the plan’s where the app sets none).
requireTickets boolean yes Joins need a ticket signed with a secret key.
region object | object yes Where the app’s rooms live.
linkBeacon boolean The SDK reports how each peer’s links run (direct or relayed); on by default.
sandbox boolean A development app set up by jsflow: non-browser platforms may join with the key alone, at low limits. Not settable through the API.
appAttest array of object The iOS App IDs whose App Attest joins the app accepts.
appAttest[].appId string yes .
appAttest[].development boolean Also accept that App ID’s development-signed builds.
capState "ok" | "warned" | "reached" | "suspended" yes reached: new joins are refused (402 quota), peers already in rooms keep their links. suspended: joins and token refreshes are refused (403 suspended), so peers drop within one refresh period.
relay "on" | "off" yes off: relay credentials are STUN-only (free relay used up, not yet unlocked, the global free budget, or capState reached or suspended)
created string (date-time) yes When the app was created.
updated string (date-time) When its settings last changed.

Errors: csrf, limit, no_secret_key, plan.

The app’s publishable and secret keys, active and revoked. A secret key’s value is never shown again after it is created.

Authorisation: an account access token (jft_…) with the scope apps:read.

Parameters

Name In Type Required Description
app path string yes The app’s id.

Response 200: OK (application/json)

Field Type Required Description
items array of Key (object)
items[].id string yes The key’s id; not the key itself.
items[].kind "publishable" | "secret" yes Publishable (for the SDK) or secret (for your server).
items[].name string The key’s name.
items[].prefix "pk_" | "sk_" yes pk_ for a publishable key, sk_ for a secret one.
items[].last4 string yes The key’s last four characters, to recognise it.
items[].value string Publishable keys only (public by design).
items[].created string (date-time) yes When it was created.
items[].lastUsed string (date-time) | null Hourly resolution.
items[].revoked string (date-time) | null When it was revoked; null while active.
next string | null Pass as cursor to get the next page; null on the last page.

At most two active keys per kind (409 key_limit). A secret key’s value is in this response only. Creating a secret key needs a fresh sign-in and emails the account’s owners.

Authorisation: an account access token (jft_…) with the scope apps:write | secrets:write.

Parameters

Name In Type Required Description
app path string yes The app’s id.

Request body (application/json, required)

Field Type Required Description
kind "publishable" | "secret" yes A publishable key for the SDK, or a secret key for your server.
name string A name to tell keys apart.

Response 201: Created (application/json)

object

Errors: reauth, csrf, key_limit.

Fails within 30 s in every region (the server API at once). Emails the owners. Revoking the last active publishable key needs ?confirm=last. Revoking the last secret key of an app that requires tickets leaves requireTickets on, so every join fails until a new secret key exists: create the new key first to rotate without a gap (two may be active).

Authorisation: an account access token (jft_…) with the scope apps:write | secrets:write.

Parameters

Name In Type Required Description
app path string yes The app’s id.
key path string yes The key’s id.
confirm query "last" last to confirm revoking the app’s last active publishable key; without it that call is refused.

Response 204: Revoked.

Errors: reauth, csrf, last_key.

Live rooms and peers now, and removing a user or a peer.

The users and peers kept out of the app’s rooms, newest first; ended entries are left out.

Authorisation: an app’s secret key (sk_…) or an account access token (jft_…) with the scope records:read.

Parameters

Name In Type Required Description
app path string yes The app’s id.
cursor query string The next of the previous page.
limit query integer (default 50) Items per page, 1 to 200.

Response 200: OK (application/json)

Field Type Required Description
items array of BlockEntry (object) yes
items[].id string yes The entry’s id, to remove it.
items[].kind "user" | "peer" yes Whether value is a user id or a peer id.
items[].value string yes The blocked user id, or the peer id in digits.
items[].room string | null yes The one room it applies to; null for every room of the app.
items[].until string (date-time) | null yes When the block ends; null for no end.
items[].reason string | null yes The reason given when blocking or evicting, for your records.
items[].created string (date-time) yes When the entry was added.
items[].source "block" | "evict" yes Whether it was added to the blocklist or made by an eviction.
next string | null yes Pass as cursor to get the next page; null on the last page.

Errors: insufficient_scope.

Keeps a user out of every room of the app, or of one room, until until or until you remove the entry. It does not cut off anyone already connected; evict does that. A peer is blocked in one room, for at most 30 days. Peer ids are per join, so someone who joins later can be given the same id and be kept out too. To keep a person out, block their user id.

Authorisation: an app’s secret key (sk_…) or an account access token (jft_…) with the scope rooms:write.

Parameters

Name In Type Required Description
app path string yes The app’s id.

Request body (application/json, required)

Field Type Required Description
kind "user" | "peer" yes Whether value is a user id (from join tickets) or a peer id.
value string yes The user id (the sub in their join ticket), or the peer id in digits (0 to 65534).
room string | null The one room the block applies to; required for a peer. Leave it out, or null, to cover every room of the app (users only).
until string (date-time) | null When the block ends, at least a minute ahead. Null or left out: no end (a user only; a peer needs it, at most 30 days ahead).
reason string A note for your own records; never shown to the blocked user.

Response 201: Blocked (application/json)

Field Type Required Description
id string yes The entry’s id, to remove it.
kind "user" | "peer" yes Whether value is a user id or a peer id.
value string yes The blocked user id, or the peer id in digits.
room string | null yes The one room it applies to; null for every room of the app.
until string (date-time) | null yes When the block ends; null for no end.
reason string | null yes The reason given when blocking or evicting, for your records.
created string (date-time) yes When the entry was added.
source "block" | "evict" yes Whether it was added to the blocklist or made by an eviction.

Errors: insufficient_scope, idempotency_conflict, blocklist_full.

Removes one entry: that user or peer may join again within about 30 seconds. For an eviction’s entry, each region is also told at once; a region that cannot be reached keeps the person out until the eviction’s until (at most 30 days).

Authorisation: an app’s secret key (sk_…) or an account access token (jft_…) with the scope rooms:write.

Parameters

Name In Type Required Description
app path string yes The app’s id.
entry path string yes The entry’s id, from the blocklist.

Response 204: Removed.

Errors: insufficient_scope.

Counted now in every region; never stored. The answer is cached 3 s per app, so many open tabs cost one count. Poll at most every 5 s; faster polling gets the cached answer, and sustained polling well beyond that gets 429 rate (back off). For the chart over time use usage/concurrency. A peer counts as relayed if at least one of its links runs through our relay at that moment (that is what costs relay); direct = peers − relayedPeers.

Authorisation: an account access token (jft_…) with the scope usage:read.

Parameters

Name In Type Required Description
app path string yes The app’s id.

Response 200: OK (application/json)

Field Type Required Description
peers integer yes Peers in the app’s rooms now.
rooms integer yes Rooms open now.
relayedPeers integer yes Peers with at least one link through the relay.
regions array of object yes The same counts per region.
regions[].region string yes The region.
regions[].peers integer yes Peers in the region’s rooms.
regions[].rooms integer yes Rooms open in the region.
unreachable array of string yes Regions that did not answer in time; their rooms are missing from the counts.
at string (date-time) yes When the counts were taken.

Counted now in every region; never stored. Paged (limit, cursor) so 10,000 live rooms stay a small response. Pages come from one snapshot taken for the first page and kept 60 s: within it no room repeats and none is skipped, and at says when it was taken. A cursor older than that is 410 cursor_expired: start again. total is the snapshot’s room count. Poll the first page at most every 5 s (the snapshot is shared per app for 3 s). A region that does not answer in 2 s is listed in unreachable. One room by its exact name: /api/apps/{app}/rooms/{room}.

Authorisation: an account access token (jft_…) with the scope records:read.

Parameters

Name In Type Required Description
app path string yes The app’s id.
cursor query string The next of the previous page.
limit query integer (default 50) Items per page, 1 to 200.
sort query "peers" | "opened" (default "peers") peers: largest first; opened: newest first

Response 200: OK (application/json)

Field Type Required Description
items array of LiveRoom (object) yes
items[].room string yes The room’s name.
items[].region string yes The region the room lives in.
items[].peers integer yes Peers in the room now.
items[].opened string (date-time) yes When the room opened.
items[].relayedLinks integer | null yes Links through the relay, counted from the peers’ link-type beacons (each link once). Approximate when a peer sends no beacon (the iOS SDK today, or an app with the beacon off); null where a region does not report it yet.
items[].directLinks integer | null yes Direct links, as relayedLinks.
next string | null yes Pass as cursor to get the next page; null on the last page.
total integer yes Rooms in the snapshot, across all pages.
at string (date-time) yes When the snapshot was taken.
unreachable array of string yes Regions that did not answer in time; their rooms are missing.

Errors: cursor_expired.

One room by its exact name, with each peer in it and how its links run. 404 when no such room is open.

Authorisation: an account access token (jft_…) with the scope records:read.

Parameters

Name In Type Required Description
app path string yes The app’s id.
room path string yes The room’s exact name.

Response 200: OK (application/json)

object

Cuts the user or peer off from this room and keeps them out of it until until (by default one hour from now, at most 30 days). The eviction is also an entry on the app’s blocklist for this room; remove the entry to let them back in early.

Authorisation: an app’s secret key (sk_…) or an account access token (jft_…) with the scope rooms:write.

Parameters

Name In Type Required Description
app path string yes The app’s id.
room path string yes The room’s exact name.

Request body (application/json, required). Exactly one of user or peer.

Field Type Required Description
user string The user id (from join tickets) to evict.
peer integer The peer id to evict, as the SDK shows it.
until string (date-time) When they may join again: at least a minute and at most 30 days ahead. Without it, one hour from now.
reason string A note for your own records; never shown to the evicted user.

Response 200: Evicted (application/json)

Field Type Required Description
evicted integer yes How many connections were cut off.
until string (date-time) yes When they may join again.
entry string yes The blocklist entry this eviction made; remove it to let them back in early.
unreachable array of string yes Regions that did not answer in time; empty when every region answered. Anyone connected there stays connected until they leave, and a join there is refused from about 30 seconds after the eviction. To try them again, evict again with a new Idempotency-Key (this adds a second entry).

Errors: insufficient_scope, idempotency_conflict, blocklist_full.

What an app used, the recent records behind it, and the raw daily export.

Usage and charges for the billing period so far, per app and in total: what the next invoice would say if the period ended now.

Authorisation: an account access token (jft_…) with the scope usage:read.

Parameters

Name In Type Required Description
acct path string yes The account’s id (acct_…).
period query string (default "current") current, or the start date of an earlier billing period.

Response 200: OK (application/json)

Field Type Required Description
periodStart string (date-time) yes The period’s start.
periodEnd string (date-time) yes The period’s end.
plan "free" | "pro" | "scale" | "enterprise" yes The plan in the period.
hardCap boolean yes The allowance is a hard limit (Free), not a threshold for overage.
totals UsageTotals (object) yes The account’s usage in the period.
totals.peerMinutes number yes Billable minutes in rooms (not alone, not away), summed over peers.
totals.peerMinutesByLink object yes peer-minutes by how the peer’s links ran in each 5-minute interval, from the link-type beacon: direct = no link relayed at any point, relayed = every link relayed throughout, mixed = anything in between, unknown = the app has the beacon off or the SDK is older. Sums to peerMinutes.
totals.relayGB number yes Gigabytes the relay sent.
totals.joins integer yes Joins that succeeded.
totals.refusals object yes by reason (an ErrorCode); empty when none
apps array of object yes Each app’s share of the period (the account’s apps, including deleted ones that used something this period).
apps[].app string yes The app’s id.
apps[].deleted boolean The app has been deleted since.
apps[].totals UsageTotals (object) yes The app’s usage in the period.
allowance object yes What the plan includes in a period.
allowance.peerMinutes integer yes Peer-minutes included.
allowance.relayGB number yes Gigabytes of relay included.
overage array of object yes Usage beyond the allowance and its price.
overage[].meter "peerMinutes" | "relayGB" yes The meter.
overage[].quantity number yes In units, rounded up as billed (started 100,000s for peer-minutes).
overage[].unit OverageUnit (object) yes The unit it is billed in.
overage[].unitPrice Money (object) yes The price of one unit.
overage[].amount Money (object) yes The overage’s charge so far.
fee Money (object) yes The plan’s fee for the period.
fee.amount integer yes minor units
fee.currency "eur" | "usd" yes The currency.
total Money (object) yes Fee and overage so far, before tax.
total.amount integer yes minor units
total.currency "eur" | "usd" yes The currency.
spendCap Money (object) | null yes The spend cap, or null for none.
asOf string (date-time) | null yes The newest record counted; null before the first.

Joins, refusals, evictions and finished sessions and relay allocations, newest first, kept 1, 7 or 30 days by plan. The onboarding page polls type=join&limit=1 for the first join.

Authorisation: an account access token (jft_…) with the scope records:read.

Parameters

Name In Type Required Description
app path string yes The app’s id.
from query string (date-time) The earliest record time to include.
to query string (date-time) The latest record time to include.
type query array of "join" | "refusal" | "eviction" | "session" | "relay" Only these record types, comma-separated; all when absent.
room query string Exact room name (no prefix search). With room or user, from..to may span at most 31 UTC days.
peer query string With room only: one peer id within that room
user query string Exact user id (from join tickets; no prefix search). Not with room.
cursor query string The next of the previous page.
limit query integer (default 50) Items per page, 1 to 200.

Response 200: OK (application/json)

Field Type Required Description
items array of Record (object) yes
items[].id string yes The record’s id; unique.
items[].type "session" | "relay" | "join" | "refusal" | "eviction" yes A peer’s join, a refusal, an eviction, a peer’s session in a room, or a relay allocation.
items[].session string Shared by a peer’s session and relay records, to group them.
items[].room string The room.
items[].peer string The peer’s id.
items[].user string | null The user id from the join ticket; null without a ticket.
items[].region string Where it happened.
items[].sdk string The SDK version.
items[].platform string web, ios, …
items[].start string (date-time) yes When the interval started (the time of the event for joins, refusals and evictions).
items[].end string (date-time) yes When the interval ended.
items[].seconds number The interval’s length.
items[].billableSeconds number Seconds billed; time alone in the room or away is not counted.
items[].bytesToClient integer Relay records: bytes the relay sent to this peer.
items[].bytesToPeers integer Relay records: bytes the relay sent on to the other peers.
items[].status string ok, or the refusal’s reason (an error code).
items[].http integer The refusal’s HTTP status.
items[].origin string Refusals with status origin only: the page’s Origin as the service saw it (scheme://host[:port], or a non-URL such as “null”). Untrusted text; at most one such record per app and origin per minute, with count.
items[].count integer Refusals with status origin: how many were folded into this record in its minute
items[].units object What the record counts toward the bill, by meter (such as peerMinutes, relayGB).
next string | null yes Pass as cursor to get the next page; null on the last page.
retainedFrom string (date-time) yes The oldest record kept for this app (1, 7 or 30 days by plan); a range before it returns what is kept.

Buckets are UTC hours or UTC days; start is the bucket’s start, inclusive. Buckets with no usage are omitted (the client fills the axis). At most 31 days per request for hour, 13 months for day. Freshness as in PeriodUsage.

Authorisation: an account access token (jft_…) with the scope usage:read.

Parameters

Name In Type Required Description
app path string yes The app’s id.
from query string (date-time) yes The start of the range, inclusive.
to query string (date-time) yes The end of the range.
step query "hour" | "day" (default "hour") One bucket per UTC hour or per UTC day.
byRegion query boolean (default false) Split each bucket by region.

Response 200: OK (application/json)

Field Type Required Description
items array of object
next string | null Pass as cursor to get the next page; null on the last page.

From samples taken every 5 minutes in every region: exact at each 5-minute boundary. step=hour gives each hour’s peak (the max of its 12 boundaries), step=day each day’s. Buckets with no live rooms are omitted. At most 7 days per request for 5m, 90 days for hour and day. Kept 90 days: a range before retainedFrom returns what is kept (possibly nothing), never an error. asOf is the newest sample counted; the bucket that contains it may still grow. A peer counts as relayed if at least one of its links runs through our relay at that moment (that is what costs relay); direct = peers − relayedPeers.

Authorisation: an account access token (jft_…) with the scope usage:read.

Parameters

Name In Type Required Description
app path string yes The app’s id.
from query string (date-time) yes The start of the range, inclusive.
to query string (date-time) yes The end of the range.
step query "5m" | "hour" | "day" (default "5m") Every 5-minute sample, or each hour’s or day’s peak.

Response 200: OK (application/json)

Field Type Required Description
asOf string (date-time) | null yes The newest sample counted; null before the first.
retainedFrom string (date-time) yes The oldest data kept (90 days).
items array of object yes
items[].start string (date-time) yes The bucket’s start.
items[].peers integer yes Peers at the sample time (5-minute steps), or the peak in the hour or day.
items[].rooms integer yes Rooms open, counted the same way as peers.
items[].relayedPeers integer yes Peers with at least one link through the relay, counted the same way as peers.
next string | null yes Pass as cursor to get the next page; null on the last page.

A signed link (one hour) to a gzipped JSON-lines file of the app’s records for that UTC day, from the archive, de-duplicated, without the internal cost. Only the last 90 days exist; an earlier day answers 404. After the account is closed, its owners can still export its apps’ records until the account is deleted 30 days later.

Authorisation: an account access token (jft_…) with the scope records:read.

Parameters

Name In Type Required Description
app path string yes The app’s id.
day query string (date) yes The UTC day.

Response 200: OK (application/json)

object

Rooms by their peak peer count that UTC day; a room open across midnight counts on both days, so days cannot be summed. Kept 24 months; a day before retainedFrom returns zeros, never an error.

Authorisation: an account access token (jft_…) with the scope usage:read.

Parameters

Name In Type Required Description
app path string yes The app’s id.
day query string (date) yes The UTC day.

Response 200: OK (application/json)

Field Type Required Description
day string (date) yes The UTC day.
rooms integer yes Rooms open at any time that day.
maxPeers integer yes The largest room’s peak that day (0 with no rooms).
retainedFrom string (date) yes The earliest day kept.
buckets array of object yes Rooms counted by their peak, smallest first.
buckets[].label "1" | "2–5" | "6–10" | "11–20" | "21–50" | "51+" yes The bucket’s range, for display.
buckets[].min integer yes The smallest peak in the bucket.
buckets[].max integer | null yes The largest peak in the bucket; null for the open-ended last one.
buckets[].rooms integer yes Rooms whose peak falls in the bucket.

The app’s busiest rooms on one UTC day, by peer-minutes or by peak peers.

Authorisation: an account access token (jft_…) with the scope usage:read.

Parameters

Name In Type Required Description
app path string yes The app’s id.
day query string (date) yes The UTC day.
limit query integer (default 20) Items per page, 1 to 100.
sort query "usage" | "peak" (default "usage") by peer-minutes or by peak peers

Response 200: OK (application/json)

Field Type Required Description
items array of object
next string | null Pass as cursor to get the next page; null on the last page.

Your own identity, the tokens of the account, and the device sign-in a CLI or an agent uses.

GET /.well-known/oauth-authorization-server

Section titled “GET /.well-known/oauth-authorization-server”

Where the device login’s endpoints are and what they support, for OAuth clients that discover them. No token needed.

Authorisation: none (public).

Response 200: issuer, device_authorization_endpoint, token_endpoint, grant_types_supported, scopes_supported

Form-encoded, as the RFC says. client_id is jsflow-cli (public client, no secret). scope is space-separated scopes or one preset (read, dev, full). device_name (ours) is shown on the approval page. The user code is 8 characters from a 30-letter alphabet without look-alikes, shown as XXXX-XXXX. Errors here and at /oauth/token follow RFC 6749/8628 ({error, error_description}): the one place jsflow uses error instead of err.

Authorisation: none (public).

Request body (application/x-www-form-urlencoded, required)

Field Type Required Description
client_id "jsflow-cli" yes Always jsflow-cli.
scope string Space-separated scopes, or one preset: read, dev or full.
device_name string A name for this device, shown on the approval page and on the token.

Response 200: OK (application/json)

Field Type Required Description
device_code string yes The code to poll /oauth/token with. Keep it to yourself.
user_code string yes The code the user checks on the approval page.
verification_uri string yes The page where the user approves.
verification_uri_complete string yes The approval page with the code filled in: open this one if you can.
expires_in 600 yes Seconds until the codes expire.
interval integer yes Seconds to wait between polls.

The CLI polls this with the device_code from /oauth/device_authorization, no faster than interval seconds. Until the user decides, it answers authorization_pending (or slow_down when polled too fast); then the access token, or access_denied, or expired_token once the code’s 10 minutes are up.

Authorisation: none (public).

Request body (application/x-www-form-urlencoded, required)

Field Type Required Description
grant_type "urn:ietf:params:oauth:grant-type:device_code" yes The device grant, exactly as shown.
device_code string yes The device_code from /oauth/device_authorization.
client_id "jsflow-cli" yes Always jsflow-cli.

Response 200: The access token (no refresh token at 1.0). (application/json)

Field Type Required Description
access_token string yes The token (jft_…). Send it as Authorization: Bearer <token>.
token_type "Bearer" yes Always Bearer.
expires_in integer yes Seconds until the token expires.
scope string yes The scopes granted, space-separated: those asked for, or fewer if the user narrowed them.

Who the calling token belongs to, the account it works in, and the token’s own details: a quick check that a token works.

Authorisation: an account access token (jft_…) with the scope any.

Response 200: OK (application/json)

Field Type Required Description
user object yes The user the token acts for.
user.id string yes The user’s id.
user.name string yes The user’s display name.
account Membership (object) yes The account the token works in, and the user’s role there.
account.account string yes The account’s id.
account.name string yes The account’s name.
account.role "owner" | "member" yes The user’s role in the account.
account.plan "free" | "pro" | "scale" | "enterprise" yes The account’s plan.
account.closedAt string (date-time) | null Set when the account is closed: until its deletion 30 days later its owners can only export it. Only owners see a closed account here.
token AccessToken (object) yes The calling token.
token.id string yes The token’s id; not the token itself.
token.name string yes The token’s name, from the device that asked for it or as given in the dashboard.
token.scopes array of "usage:read" | "apps:read" | "audit:read" | "records:read" | "apps:write" | "rooms:write" | "secrets:write" yes What the token may do.
token.apps array of string | null yes The apps it is limited to; null for every app in the account.
token.prefix "jft_" Every access token starts with jft_.
token.last4 string The token’s last four characters, to recognise it.
token.created string (date-time) yes When it was created.
token.createdBy object yes The user it acts for.
token.createdFrom object yes Where it was created, to tell tokens apart.
token.lastUsed string (date-time) | null yes Hourly resolution.
token.expires string (date-time) yes When it stops working.
token.revoked string (date-time) | null yes When it was revoked; null while active.

The access tokens the calling user holds in this account. Token values are never shown.

Authorisation: an account access token (jft_…) with the scope any.

Parameters

Name In Type Required Description
cursor query string The next of the previous page.
limit query integer (default 50) Items per page, 1 to 200.

Response 200: OK (application/json)

Field Type Required Description
items array of AccessToken (object) yes
items[].id string yes The token’s id; not the token itself.
items[].name string yes The token’s name, from the device that asked for it or as given in the dashboard.
items[].scopes array of "usage:read" | "apps:read" | "audit:read" | "records:read" | "apps:write" | "rooms:write" | "secrets:write" yes What the token may do.
items[].apps array of string | null yes The apps it is limited to; null for every app in the account.
items[].prefix "jft_" Every access token starts with jft_.
items[].last4 string The token’s last four characters, to recognise it.
items[].created string (date-time) yes When it was created.
items[].createdBy object yes The user it acts for.
items[].createdFrom object yes Where it was created, to tell tokens apart.
items[].lastUsed string (date-time) | null yes Hourly resolution.
items[].expires string (date-time) yes When it stops working.
items[].revoked string (date-time) | null yes When it was revoked; null while active.
next string | null yes Pass as cursor to get the next page; null on the last page.

Revokes one of the calling user’s tokens; it stops working at once. current revokes the token making the call (a logout).

Authorisation: an account access token (jft_…) with the scope any.

Parameters

Name In Type Required Description
token path string | "current" yes The token’s id, or current for the calling token.

Response 204: Revoked.