1
Create an API key
Sign in at magicmarkets.com, go to Settings, then API, and click Add API Key. API access needs a minimum deposit of 10 USDT. The value is shown once. Store it somewhere safe. See Authentication.
2
Check the key over REST
Do this before you open the stream. The WebSocket handshake refuses a bad key with only a status code and a one-word body. REST returns a full error envelope.A
200 with {"status": "ok", ...} means the key works. 401 auth_error means the server did not accept a key. Check the header name and the key value.3
Pick your path
The CLI is the fastest start. REST and WebSocket work from any language.
Path A: the CLI
magicmarkets is a single Go binary for the whole v2 API, with a built-in MCP server. It is open source under the MIT licence at github.com/magicmarkets/magicmarkets-cli. You need a recent Go toolchain. There are no prebuilt binaries yet. If the shell cannot find magicmarkets after install, run make where and add that directory to your PATH.
MAGICMARKETS_ALLOW_TRADING=1. See CLI and MCP server.
Path B: REST and WebSocket
REST lists events, returns a snapshot of an event’s offers, and commits betslips and orders. The WebSocket pushes live offers, your private betslip quotes (pmm) and order updates. You normally hold one socket open and call REST alongside it.
Events and offers with curl
Lines 2 and 3 of the flow above also work over REST, when a snapshot is enough. List football events that start after now:["event", ...]. limit defaults to 500 and goes up to 5000. To read the next page, pass the last entry’s "{sport},{event_id}" as after. A page shorter than limit is the last one. Filtering by event_id or competition_id needs sport as well.
ir_status can stay pre_event after start_time passes. Check start_time before you treat an event as not started.
Read the offers on that event:
sport and event_id are required. event_id is a repeated query parameter: repeat it to price up to 20 events in one call. bet_type, market_type and min_liquidity (USDT, summed across the price_list) narrow the result. Each entry is the object the stream sends as ["offer", ...], and its bet_type goes into POST /v2/betslips/ unchanged.
The reply is paged. limit defaults to 500 (max 5000). Pass the last entry’s "{event_id},{bet_type}" as after for the next page. A page shorter than limit is the last one.
A reply can be about 4 seconds behind live prices. Register the event on the stream when you need each change as it happens. The quote for your betslip arrives as pmm on the socket, or you poll the betslip.
A first request with curl
Every response uses one envelope. Checkstatus before reading data.
What to read next
Concepts
Betslips, orders, offers, pmm, heartbeats, and the two-step flow.
WebSocket stream
The wire format and every message type.
Errors and rate limits
The error envelope, every code, and the budgets.

