PingSpan, back to the topPrivate betaJoin the waitlist
Chat API · private beta

The chat backend for developers and their coding agents.

PingSpan delivers every message once and in order, lets your server moderate before anything is stored, and bills per message instead of per user.

Type a message and scroll to follow it through the system.

Startsend

Send from any device

The SDK tags each message with a client_message_id before it leaves the device. Every retry reuses it, so a flaky network never creates a duplicate.

await conversation.send({ text })
Between1 of 4

Your server moderates first

Before anything is stored, PingSpan calls your before_send hook with the message and recent context. Answer allow, reject, rewrite or shadow. Rejected messages are never stored and never billed.

This demo hook hides phone numbers, so it rewrote yours.

PUT /v1/hooks/before_send
Between2 of 4

Stored with a sequence number

The message gets the next number in its conversation, seq 4812, in the same transaction that stores it. No gaps and no reordering, so every client knows exactly what it has and what it is missing.

message.seq === 4812
Between3 of 4

A lost reply costs nothing

Ada's network dropped the server's answer. The SDK sends again with the same client_message_id and gets back the message already stored. Grace sees one copy, and you pay for one message.

same client_message_id → same message
Between4 of 4

Your backend gets a webhook

Every stored message triggers a signed message.created webhook, delivered in order and retried if your server is down. Verify it with our SDK or any Standard Webhooks library.

verifyWebhookEvent(secret, body, headers)
Enddeliver

Every open device, right away

Each device with an open connection gets the message as soon as it is stored. Grace's phone shows it now. Her laptop is asleep.

conversation.on("message.new", render)
Endcatch up

Offline devices catch up on their own

When the laptop wakes, the SDK asks for everything after seq 4809, the last one it saw, and emits 4810, 4811 and 4812 once each, in order. You never write sync code.

GET …/messages?after_seq=4809
Delivered · 212 ms · 1 retry · 0 duplicates

You just watched a message survive.

Its reply was lost and your hook checked it, yet it was stored and delivered once. PingSpan does that for every message, so your team does not build it.

Try to break it

Break the network. The chat stays correct.

Send from Ada to Grace, then drop replies, take Grace offline, or change what your moderation hook answers. The simulation runs in your browser and follows the same rules as the SDK and the server.

Ada

Online
  1. Free tonight?seq 1
  2. Yes, after 7.seq 2
  3. Call me on •••seq 3
Network and moderation
Your hook answers

Rewrite: your hook hides phone numbers before the message is stored.

Grace

Online
  1. Free tonight?seq 1
  2. Yes, after 7.seq 2
  3. Call me on •••seq 3
Repeats
0
Out of order
0
Last seq
3

Server log

  1. Conversation open · 2 messages
  2. → send · client_message_id …5a1c3e8b7f20
  3. before_send → rewrite
  4. Stored · seq 3
  5. Reply to Ada lost
  6. → send again · client_message_id …5a1c3e8b7f20 · already stored, same seq 3
  7. message.new → Grace · seq 3
Features

Everything between send and delivered

What you get when your team comes off the waitlist.

Features, a row of cards

Headless by design

A REST API, a WebSocket protocol and a typed TypeScript SDK generated from our OpenAPI spec. You design the chat screens. There is no widget kit to fight.

npm i @pingspan/sdk

Moderation you control

One hook, four decisions: allow, reject, rewrite or shadow. Pick fail-open or fail-closed for the moments your hook is slow or down.

before_send → { action: "shadow" }

Exactly once, in order

Gap-free sequence numbers per conversation. The SDK drops repeats and fetches any gap before it emits the next message.

message.new · seq 4812

Webhooks for every change

Signed events for messages and conversation changes, in order, with retries. Index messages, send push notifications or feed analytics from one stream.

message.created · conversation.updated

Built for coding agents

An MCP server gives your agent tools for users, conversations, tokens and messages, plus the OpenAPI spec and an explanation for every error code.

npx @pingspan/mcp

The features users expect

Typing indicators, read receipts, unread counts, replies, reactions, edits and deletes. Only a reply counts as a billable message.

member.read · unreadCount

Safety for 1:1 chat

Block users, unmatch, freeze or expire conversations. A blocked user sees a frozen chat with no reason given.

users.block(userId, blockedUserId)

Attachments, three ways

Upload files to PingSpan, to your own storage bucket, or reference files you already host. Your own bucket and external links are never billed for storage.

managed · your bucket · external

Test and live, kept apart

Separate test and live environments with scoped API keys. Mint short-lived user tokens on your server, or sign them with your own key.

sk_test_… · sk_live_…
For AI engineers

Your coding agent can ship the integration.

Add the PingSpan MCP server to Claude Code, Cursor or any MCP client. Your agent reads the OpenAPI spec, seeds test users and conversations, mints tokens and sends messages to check its own work. It runs with test keys only, so it never touches production data.

  • Tools for users, conversations, tokens and messages
  • The OpenAPI spec and an explanation for every error code
  • Errors that say what failed and how to fix it
An example coding agent session using the PingSpan MCP server
  1. Add chat between matched users. Use PingSpan.
  2. docs_get_openapi → read the REST API
  3. I'll add a /session route that mints user tokens, then a chat screen on the client.
  4. seed_test_data → users ada and grace · test key
  5. conversations_create { members: ["ada", "grace"] }
  6. tokens_create { user_id: "ada" } → expires in 1 hour
  7. messages_send { text: "hello from the agent" } → seq 1
  8. messages_list → 1 message, in order
  9. Done. server.ts mints tokens, Chat.tsx renders message.new, and the test conversation works end to end.
The integration

Two files cover the whole trip.

Point at a line to see where it acts on the S.

server.tsyour backend
import {
  beforeSendHandler,
  ChatServer,
  verifyWebhookEvent,
  WebhookVerificationError,
} from "@pingspan/sdk/server";
import { env } from "./env.js";
import { notify } from "./push.js";

const chat = new ChatServer({ apiKey: env.PINGSPAN_API_KEY });

// Each device gets a short-lived token. Your API key stays here.
export const session = (userId: string) => chat.tokens.create({ userId });

// Runs before anything is stored. This one hides phone numbers.
export const beforeSend = beforeSendHandler(env.HOOK_SECRET, ({ message }) => {
  if (message.text === null) return { action: "allow" }; // attachments only
  const text = message.text.replace(/\d[\d\s().-]{5,}\d/g, "•••");
  return text === message.text ? { action: "allow" } : { action: "rewrite", text };
});

// Every stored message, signed, right after it is saved.
export async function onWebhook(req: Request) {
  try {
    const event = await verifyWebhookEvent(env.WEBHOOK_SECRET, await req.text(), req.headers);
    if (event?.type === "message.created") await notify(event.data.message);
    return new Response(null, { status: 204 });
  } catch (e) {
    if (e instanceof WebhookVerificationError) return new Response(null, { status: 401 });
    throw e;
  }
}
app.tsyour app
import { ChatClient } from "@pingspan/sdk";
import { conversationId, render } from "./ui.js";

const chat = new ChatClient({
  token: () =>
    fetch("/session")
      .then((r) => r.json())
      .then((s: { token: string }) => s.token),
});
await chat.connect();

const match = chat.conversation(conversationId);

// Once each, in seq order. Gaps are fetched before anything shows.
match.on("message.new", (m) => render(m));

// Safe to retry: the SDK reuses the client_message_id.
await match.send({ text: "Meet me at 8." });
  1. Startsend() gives the message its client_message_id. Your backend's token lets the device connect.
  2. Between · your hookYour before_send hook decides before anything is stored.
  3. Between · storedPingSpan stores it with the next seq. No code on your side.
  4. Between · retryA lost reply is retried with the same id. Still one copy.
  5. Between · webhookYour backend gets a signed message.created webhook.
  6. End · devicesEach device with an open connection gets it right away.
  7. End · in ordermessage.new fires once per message, in order, after any gap is fetched.
Pricing

Pay for messages. Users and connections are free.

No monthly active user fees and no connection fees. A message is billed once when it is stored, however many people and devices receive it.

Billing

Prices per month, paid for the year.Prices per month, paid month to month.

Free

$0

No card needed

100,000 messages a month

  • Hard cap, nothing to pay
  • 90 days of message history
  • 5 GB attachment storage
  • Every API feature
  • Community support
Join the waitlist

Pro

$99$124/month

$1,188 billed yearly. You save $300.Or $99/month paid yearly, to save $300 a year.

250 thousand messages included

  • $400 per extra million$500 per extra million
  • 100 GB attachment storage
  • Every API feature
  • Email support, 1 business day
Join the waitlist

Enterprise

Committed volume

  • Lower price per million
  • History import from your current provider
  • Dedicated cell option
  • Named engineer, custom SLA
Talk to us
5,000,000
Freeover the capover the cap
Pro$1,999/mo$2,499/mo
Scale$1,874/mo$2,349/mo

Scale is the cheaper plan here, at $375 per million messages.

Scale is the cheaper plan here, at $470 per million messages.

Paying yearly saves you $5,700 a year here.

Paying yearly would save you $5,700 a year here.

You pay for

Always free

  • Users and connections
  • Edits, deletes and reactions
  • Typing, read receipts and presence
  • Messages your hook rejects
  • API calls and webhook deliveries
  • Bandwidth
  • Files in your own bucket or host
  • Full history on paid plans

API calls and bandwidth fall under fair use. We talk to you before any bill.

Switching providers

Bring your message history with you.

We import your full history into PingSpan and keep both systems running side by side while you move users over in stages. Users keep every conversation, and you can roll back at any step.

  1. ImportYour history is loaded in bulk, keyed to the original message ids.
  2. MirrorNew messages flow both ways while both apps are live.
  3. MoveUsers switch in cohorts you choose, from staff to everyone.
FAQ

Questions engineers ask us

When can my team start?

We bring teams in from the waitlist in small groups so each one gets direct help from our engineers. Join with your work email and we will write when your invite is ready.

Which platforms are supported?

The TypeScript SDK runs in the browser and on your server. Any other language can use the REST API, described in OpenAPI, and the documented WebSocket protocol.

Do you charge per user?

No. You pay for stored messages. Users, devices, open connections and API calls are free, and paid plans keep your full message history at no extra cost, so a quiet user costs you nothing.

What does fair use mean?

API calls and bandwidth are not billed. Fair use is up to 25 API calls and 100 kB of bandwidth per billed message, averaged over the month. If you go above it, we talk to you first. You never get a surprise bill.

Can I keep my own moderation?

Yes. Your before_send hook sees each message before it is stored and decides what happens. You choose whether sends fail open or fail closed when your hook is unavailable.

How do my users authenticate?

Your server mints a short-lived user token with your API key, or signs its own with a key you register. Your API key never reaches a device.

Can my coding agent use it safely?

The MCP server only accepts test keys, so an agent can build and test the integration without access to live data.

Private beta

Get early access

We are onboarding teams from the waitlist in small groups. Leave your work email and we will send your invite, with free messages to build on.

You're on the list. We'll email you when your invite is ready.

We'll email you when your invite is ready.

Enter an email like ada@example.com.

Couldn't save that. Try again in a minute.

Too many tries from this network. Wait a minute and try again.