Read prices from offers. Use betslips only to place orders. Offers, from
GET /v2/offers/ or the WebSocket, carry the prices you need to scan markets. Open a betslip when you are ready to place an order, and close it with DELETE /v2/betslips/{betslip_id}/ once the order is placed. The order stays open after its betslip closes.Three ways in
CLI
The fastest start. One open-source binary for the whole API: markets, offers, betslips, orders, heartbeats and position. MIT licence.
REST and WebSocket
Any language. REST for event discovery, a price snapshot, betslips, orders, positions, balance and heartbeats. One WebSocket for live offers, your quotes and order updates.
MCP server
For agents. The CLI runs a local MCP server that is read-only until you turn trading on. A hosted server runs at
magicmarkets.com/mcp.The shape of an integration
Placing an order takes two steps: create a betslip, then place an order against it. A full integration looks like this:- Read prices and pick a selection. List events with
GET /v2/events/and read an event’s offers withGET /v2/offers/, or take both from the WebSocket. An offer’ssport,event_idandbet_typego into a betslip unchanged. - Create a betslip. You describe what you want to trade: the sport, the event, the bet type. The response carries no prices, because quotes are gathered asynchronously.
- Read your executable price. It arrives as a
pmmmessage on the WebSocket, or you poll the betslip. Prices usually land within a couple of seconds. The betslip is short-lived. - Place an order against that betslip, with your price and stake.
- Watch the order on the socket, or poll it.
Safe by default
Automated trading fails in known ways, so the platform and tooling guard against them:- Heartbeats act as a dead-man’s switch. If your code goes quiet, resting orders close themselves.
- Order placement is idempotent when you send a
request_uuid. A retry with the same UUID returns the existing order and cannot place a second one. - Your limit is honoured. An order fills only at your price or better. See Prices and ticks.
- The API cannot move funds. No deposit, withdrawal or key management endpoint exists. A leaked key can trade, not withdraw.
- The local MCP server starts read-only. Trading needs
MAGICMARKETS_ALLOW_TRADING=1. The hosted MCP server has no read-only mode: see MCP server.
Written for humans and agents
The API publishes its own machine-readable reference atmagicmarkets.com/llms.txt, magicmarkets.com/llms-full.txt and the OpenAPI spec. This site adds .md versions of every page. llms-full.txt holds the full API reference in one Markdown file, so one URL gives an agent the whole contract. See Machine-readable docs.

