Betfair Exchange markets with back and lay prices
Exchange markets of a sport (optionally one competition or event), soonest or most traded first: market name and type, start time, status, in-play flag, money matched and available, bet delay, commission, the event (name, country, start) and competition, and each runner's best three back and lay prices with the money available at each, last traded price and status (horse and greyhound racing also carry the runner's form, jockey/trainer, cloth number and silks description). Prices are in GBP and slightly delayed, as on the public exchange pages. Pass next_page back as page; null on the last page. Cached 30 seconds. Also filter by the event's country and a start-time window. Each runner also has adjustment_factor and sp (Betfair Starting Price near, far and actual, when published).
Every response includes credits_used: the credits this call cost.
Parameters
| name | type | description |
|---|---|---|
sport | soccer | tennis | golf | cricket | rugby_union | boxing | horse_racing | motor_sport | cycling | rugby_league | darts | greyhound_racing | snooker | american_football | baseball | basketball | ice_hockey | australian_rules | handball | volleyball | gaelic_games | politics | mma | esports | Sport. Example: soccer Default: soccer |
competition | string | Competition id(s) from /betfair/v1/competitions, comma-separated (e.g. 10932509 for the English Premier League). |
event | string | One event id (from event.id): all its markets unless market_type is given. |
market_type | string | Market type code(s), comma-separated: MATCH_ODDS (default for team sports), WIN (racing, golf), PLACE, OVER_UNDER_25, CORRECT_SCORE, BOTH_TEAMS_TO_SCORE, HALF_TIME, ASIAN_HANDICAP ... or all. |
in_play | string | true: only markets in play; false: only markets not yet started. |
sort | time | matched | time: soonest first; matched: most money matched first. Default: time |
limit | integer | Markets per page (1-40, default 20). |
page | integer | Page number. |
country | string | Event country code(s), comma-separated, e.g. GB,IE. |
date_from | string | Only markets starting at or after this time (YYYY-MM-DD or ISO time). |
date_to | string | Only markets starting before this time (YYYY-MM-DD or ISO time). |
Every endpoint also takes fresh, raw, fields (see lean responses and caching).
Example
curl "https://api.api.sh/betfair/v1/markets?sport=soccer" \
-H "x-api-key: $APISH_KEY" import os, requests
res = requests.get(
"https://api.api.sh/betfair/v1/markets",
params={"sport": "soccer"},
headers={"x-api-key": os.environ["APISH_KEY"]},
timeout=120,
)
res.raise_for_status()
data = res.json() const url = new URL("https://api.api.sh/betfair/v1/markets");
url.searchParams.set("sport", "soccer");
const res = await fetch(url, { headers: { "x-api-key": process.env.APISH_KEY } });
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const data = await res.json(); Response
A JSON object with the fields described above, plus raw (the source's own data), cached, fetched_at and credits_used. Errors return {"success": false, "error": "…"} with the HTTP status (see errors). A lookup that ran but found nothing (404) costs the price above; refused calls and errors on our side are free (what's charged).