Hosted multiplayer backend · WebRTC + server-arbitrated state

Multiplayer API Make any game online. On any device, in any engine.

Player accounts, matchmaking, rooms, shared state and WebRTC peer-to-peer behind one hosted API. Ten lines of client code put two players in the same room, and you never run a game server.

Any platform
Browser, Unity 2021.3+, or any HTTP client.
Any agent
One unauthenticated call. No key, no signup.
Any genre
Turn-based, arena, FPS, .io, co-op.

Free sandbox keys in one call · $19.99/mo to go live · cancel anytime

Illustration: one room, three clients, one shared state

3 calls
login → quickmatch → play
<7 KB
SDK gzipped, zero dependencies
128
players per room
2,000
live rooms per game
$19.99
per month, every game you ship
01 · integration

Ten lines of client code

A guest account, a room, positions on the wire, health through the server. Everything below is the complete loop, with nothing omitted for the sake of a short example. The same three calls carry a browser tab, a phone and a Unity build.

import { Multiplayer } from 'https://multiplayerapi.com/sdk/mp.esm.min.js';

const mp = new Multiplayer({ key: 'mp_pk_…', displayName: 'Alice' });
await mp.login();                                       // the player is in
const room = await mp.quickmatch({ mode: 'ffa', max_players: 8 });

room.on('members', (m) => spawn(m));
room.on('peer', (data, from) => ghosts[from]?.moveTo(data.x, data.y));
room.state.watch('players.*.hp', (hp, path) => updateBar(path, hp));

setInterval(() => room.send({ x: me.x, y: me.y }), 50);   // direct, peer-to-peer
room.mine('hp', 100);                                     // state, validated + kept

Full walkthrough in Start in ten lines · SDK downloads · OpenAPI 3.1

02 · agent integration

Written to be read by an agent

Documentation an agent has to reverse-engineer produces integrations you then have to debug. So the whole API is published as one self-contained plain-text reference, a full OpenAPI 3.1 schema, and a create-a-game endpoint that needs no account, no dashboard and no card. Paste this into Cursor, Claude Code or anything else that can fetch a URL.

prompt · paste into any coding agent

Add online multiplayer to my game with the Multiplayer API (https://multiplayerapi.com). Read https://multiplayerapi.com/llms-full.txt first — it is the complete reference. Then create a game with POST https://multiplayerapi.com/v1/games using the preset that matches my genre, and wire the SDK into my client: guest login, quickmatch, positions over room.send(), and health and score in shared state.

  1. step 01

    Reads the reference

    llms-full.txt holds every endpoint, rule, recipe and failure mode in one file. openapi.json gives it the machine schema for the same 26 routes.

  2. step 02

    Creates the game

    One unauthenticated POST /v1/games returns a public key, a secret key and a sandbox that runs for 24 hours. Nothing to click, no form to fill.

  3. step 03

    Writes the client

    A preset (realtime_arena, turn_based, coop, strict) ships the state rules with it, so the game is arbitrated from the first commit rather than after the first cheater.

03 · platforms

Browser, Unity, or anything that speaks HTTP

The Multiplayer API is JSON over HTTP plus WebRTC, which every platform already speaks. There is no native plugin to compile and no engine to migrate to. One game key serves every build you publish, so a web version and a Unity version join the same rooms.

browser · desktop + mobile

Web, no build step

Import the ES module straight from the CDN, or drop a plain <script> tag and use MP.Multiplayer. Under 7 KB gzipped, zero dependencies, works on touch as it does on a mouse.

unity 2021.3+

Unity package

Install from the Package Manager by Git URL. Add com.unity.webrtc for peer-to-peer, or skip it and everything routes through the relay. Same rooms, same keys as your web build.

any stack

Any language

Three routes are enough to play, and the OpenAPI 3.1 schema generates a client in whatever you write in — Godot, Python, Rust, Go, a custom C++ engine.

transport

Direct, with a fallback

WebRTC where it connects, and a server relay for the individual peers it cannot reach, so one player behind a hostile network does not penalize the whole room. Declare a TURN server to bring those players back to direct.

04 · the model

Three channels for three kinds of data

This is the entire mental model. Once you know which channel carries what, adding a genre becomes a configuration question rather than an architecture project.

room.send(data)
Direct Peer-to-peer, best-effort, zero server cost. positions · aim · animation
room.set(path, value)
State Validated by your rules, kept for the match, reaches late joiners. health · score · whose turn
room.emitEvent(topic, data)
Events Ordered and guaranteed, delivered once, never persisted. chat · rematch · one-shots

Choosing the wrong one is the usual mistake. A position pushed through set() costs a lot for nothing; hit points sent through send() vanish on the first reconnect. Read the channel guide.

05 · genres

Nothing in the API knows what a shooter is

There is no "deathmatch" or "hand of cards" object to fit your game into. There are rooms, a JSON state document, counters and leaderboards. Your game decides what they mean, and the four presets below are only sensible defaults for that decision.

Every demo runs on the live API, in your browser, with no install · all demos

06 · authority

Authority without a game server

The server never simulates your game, which is why there is nothing for you to host. It still refuses any write that breaks the rules you declared, so a client cannot award itself the win. Once peer connections are up, each client calls the server every five seconds.

rules, in json

Declared limits

Who may write which path, at what rate, with what maximum delta per write, and which fields are server-only. With no rules at all, a player can only write under their own subtree.

attestation

Countersigned results

The host submits the outcome and the other players countersign it. Agreement confirms the match; disagreement flags it for review instead of auto-banning someone over a lost packet.

webhooks

Signed notifications

match.ended, match.disputed, cheat.flagged, player.banned — HMAC-signed and retried, so your backend reacts instead of polling.

resilience

Reconnects, host loss

Rejoining is reconnecting: state survives, late joiners are caught up, and losing the host migrates the room instead of ending the match.

07 · scope

The eight things you stop maintaining

None of these is hard on its own. Each is a service to deploy, monitor, and keep compatible with the other seven, for as long as the game is online.

  • A signaling server to deploy, scale and keep awake
  • NAT traversal, ICE plumbing, and a relay for the players it defeats
  • Room lifecycle: capacity, join codes, idle cleanup, host migration
  • State reconciliation, and catching late joiners up mid-match
  • Auth: guest accounts, upgrades, sessions, password reset tokens
  • Leaderboards, stats, inventory, and the security around granting items
  • Cheat detection, dispute handling and moderation tooling
  • Autoscaling game servers in regions you cannot yet justify

Against the alternatives. Engine-bound frameworks such as Unity Multiplayer Services or Godot's MultiplayerAPI tie your netcode to one engine and still leave the hosting decision to you. Self-hosted room servers hand you the source and the pager. This is hosted, engine-agnostic, and billed as one flat subscription.

08 · pricing

One subscription. Every game you ship.

One price whatever you ship. No per-seat tiers, no per-message metering, and no bill that grows the week your game finds an audience.

$19.99/ month · usd

Every game in your console, with the same limits for all of them.

  • Unlimited games under one subscription
  • Up to 128 players per room, 2,000 live rooms per game
  • Shared state, declarative rules, WebRTC and relay
  • Leaderboards, inventory, signed webhooks, cheat flags
  • Up to 64 spectators per room, opt-in
  • Cancel anytime from your receipt

Free, for agents and prototypes

One call, no account, no card. You get real keys and a sandbox game that runs 2 live rooms for 24 hours — enough to build and test the integration before you decide.

curl -X POST https://multiplayerapi.com/v1/games \
  -H 'Content-Type: application/json' \
  -d '{"name":"My Game",
       "preset":"realtime_arena"}'

Returns mp_pk_… for the client and mp_sk_…, shown once, for your server. Claim it to your console when you subscribe.

09 · questions

Questions about the Multiplayer API

Multiplayer API is the hosted multiplayer backend at multiplayerapi.com. It turns a browser game, an engine build or a weekend prototype into an online game, without a dedicated game server on your side.

What is a Multiplayer API?

A multiplayer API is a hosted service that handles everything two or more players need to share a game session: identity, matchmaking, a room, a shared source of truth, and a realtime transport between clients. Multiplayer API does exactly that over HTTP and WebRTC, so you keep your engine, your rendering and your game logic, and stop maintaining netcode infrastructure.

What does the Multiplayer API include?

Player accounts with instant guest login, matchmaking and rooms with host migration, shared state validated by declarative rules, WebRTC peer-to-peer with relay fallback, ordered events, leaderboards, inventory and progression, spectators, signed webhooks, cheat detection and a developer console. See the documentation, try the live demos, or drop in the JavaScript SDK.

How fast can I integrate the Multiplayer API?

Three calls are enough to be playing: log in, quickmatch, then sync. A complete realtime loop with position streaming and shared health fits in about ten lines. The JavaScript SDK is under 7 KB gzipped, has zero dependencies and needs no build step. Start with Start in ten lines.

Does the Multiplayer API work on mobile, desktop and inside game engines?

Yes. The JavaScript SDK runs in any modern browser on desktop and mobile, as an ES module or a plain script tag. The Unity package supports Unity 2021.3 and above, with optional com.unity.webrtc for peer-to-peer and a server relay when it is absent. Any other stack can talk to the API directly: it is JSON over HTTP with an OpenAPI 3.1 schema, so you can generate a client in any language. One game key serves every build you ship.

Can an AI agent integrate the Multiplayer API for me?

Yes, and it is a supported path rather than a side effect. Point a coding agent at llms-full.txt, a single self-contained reference, or at the OpenAPI 3.1 schema. The agent can then create a game with one unauthenticated POST /v1/games, receive the public and secret keys in the response, and wire the SDK into your client.

Creating a game needs no account, no dashboard and no card: the resulting sandbox runs 2 live rooms for 24 hours, and you subscribe when you want to ship.

How is Multiplayer API different from Unity or Godot multiplayer APIs?

Unity Multiplayer Services and Godot's MultiplayerAPI are engine-bound frameworks: your netcode lives inside one engine and you still decide where the server runs. Multiplayer API is a hosted, language-agnostic service you call over HTTP and WebRTC from any stack, including plain web games, custom clients and agent-generated code.

Do I need to run a game server?

No dedicated game server, no signaling server, no TURN cluster to babysit. The Multiplayer API server never simulates your game: it connects players, arbitrates writes against the rules you declare, and stores what must survive the match. Positions and animations travel directly between players over WebRTC, and once those connections are up each client only calls the server every five seconds.

Is the Multiplayer API authoritative? Can players cheat?

Shared state is server-arbitrated. Without rules, a player may only write under their own subtree. With rules, you declare who can write what, at what rate, and with what maximum delta per write, and some fields become server-only.

Match results can require peer attestation, where the host submits and other players countersign, and disagreements are flagged for review instead of triggering an automatic ban. Your backend can receive match.ended, cheat.flagged and player.banned as HMAC-signed webhooks.

How much does the Multiplayer API cost?

One subscription at $19.99 per month covers every game in your console, with up to 128 players per room and up to 2,000 live rooms per game. There is no per-seat pricing and no per-message metering, and you can cancel at any time from your receipt.

Can I try the Multiplayer API for free?

Yes. Every live demo on this site runs on the real API, and one POST /v1/games returns working keys with no account and no card. That sandbox game runs 2 live rooms for 24 hours, which is enough to build and test a real integration before you subscribe.

Create a game, then open two tabs

That is the whole test: paste the public key into the SDK, load your game twice, and watch the second tab appear in the first.

$19.99/mo · unlimited games · cancel anytime