MagicMarkets Orders API

Place and retrieve orders. All stake fields are converted to USDT. Supports three order formats: normal (match sports), multirunner (outrights), and parlay (accumulators).

GitHub OpenAPI

Operations 9

GET /v2/orders/ List orders #
POST /v2/orders/ Create order #
GET /v2/orders/updates/ Order updates #
GET /v2/orders/{order_id}/ Get order #
GET /v2/orders/tracked/{uuid}/ Get order by UUID #
POST /v2/orders/{order_id}/close/ Close an order #
POST /v2/orders/close_many/ Close multiple orders #
POST /v2/orders/close_all/ Close all open orders #
GET /v2/orders/position/ Calculate position #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/magicmarkets-com:magicmarkets-com-orders-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

magicmarkets-com-orders-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: MagicMarkets Orders API
  version: 0.1.0
  description: 'REST and WebSocket API for MagicMarkets. Place orders, stream real-time

    prices, and manage your positions programmatically. ## Authentication


    Every request must be authenticated with an **API key**. Pass it in the

    `X-Api-Key` header:


    ```

    X-Api-Key:

    ```


    ### Getting an API key


    API keys are created and managed through the MagicMarkets website at

    magicmarkets.com:


    1. Go to **Settings -> API**. 2. Click **Add API Key** and give it a name. 3. Copy the key value - it is shown **once at creation**, so store it

    somewhere safe immediately. You can also revoke or rename existing keys from the same page. There is

    no endpoint in this API to manage keys - all key management happens on

    the website. ### Using a key


    Send the key on every request:


    ```bash

    curl https://magicmarkets.com/v2/xrates/ \

    -H "X-Api-Key: $MAGIC_API_KEY"

    ```


    ## Quickstart


    This walkthrough goes from zero to a placed bet: stream prices over the

    WebSocket, read a `bet_type` off the feed, quote it as a betslip, place

    an order, and watch the order update on the same socket. ### Before you start


    You need an API key (see **Authentication** above) and Python 3.9+ with

    two libraries:


    ```bash

    pip install requests websockets

    ```


    Every snippet reads its configuration from the environment:


    ```bash

    export MAGIC_API_URL="https:///v2"

    export MAGIC_WS_URL="wss:///v2/stream"

    export MAGIC_API_KEY=""

    ```


    Three concepts carry the whole flow:


    - **Two steps to a bet.** A *betslip* registers your interest in one

    selection (`POST /v2/betslips/`); its live quote then arrives as

    `["pmm", ...]` entries on the WebSocket. An *order* commits a stake

    against that quote (`POST /v2/orders/`). You always create the

    betslip first. - **`bet_type` comes from the feed.** Offers on the WebSocket carry the

    `bet_type` string ready to use - pass it to `POST /v2/betslips/`

    verbatim. You never need to construct or parse it (the grammar in

    **Sports & bet types** is reference material, not required reading). - **Stakes are USDT.** Wherever money appears it is a

    `["USDT", amount]` pair. ### Step 1 - Check your key


    Before opening the socket, prove the key works with a cheap REST call -

    a bad key fails the WebSocket upgrade with HTTP 401, so verify the key

    first:


    ```bash

    curl "$MAGIC_API_URL/xrates/" -H "X-Api-Key: $MAGIC_API_KEY"

    ```


    A `200` with `{"status": "ok", ...}` means you are good to go. ### Step 2 - Connect to the stream


    Connect with the key as a query parameter. Every frame the server sends

    is a batch envelope `{"ts": ..., "data": [...]}` - iterate `data[]` and

    dispatch on each entry''s leading type tag (see the **Streaming API**

    endpoint for the full wire format):


    ```python

    import json, os

    from websockets.sync.client import connect


    ws = connect(f"{os.environ[''MAGIC_WS_URL'']}?api_key={os.environ[''MAGIC_API_KEY'']}")


    events, synced = [], False

    while not synced:

    frame = json.loads(ws.recv())

    for entry in frame["data"]:

    if entry[0] == "event":

    events.append(entry[1]) # {"sport": ..., "event_id": ..., ...}

    elif entry[0] == "sync":

    synced = True

    ```


    After `["sync", ...]` you hold the list of currently-priced events, e.g.:


    ```json

    ["event", {"event_type": "normal", "sport": "fb",

    "event_id": "2026-06-15,1001,2002", "competition_id": 1,

    "competition_name": "England Premier League",

    "competition_country": "XE", "home": "Arsenal", "away": "Chelsea",

    "event_name": "Arsenal vs. Chelsea", "ir_status": "pre_event",

    "start_time": "2026-06-15T15:00:00Z"}]

    ```


    ### Step 3 - Register for offers on an event


    Pick an event and register.'
security:
- ApiKeyHeader: []
tags:


# --- truncated at 32 KB (55 KB total) ---
# Full source: https://artifacts.apis.io/magicmarkets-com/openapi/magicmarkets-com-orders-api-openapi.yml