NAV Navbar
shell

Introduction

Bets API is a RESTful service for data on all sports. It is a PAID service with low price (started with $10 per month).

Note that in order to access Bets API you must purchase related packages.

Please contact us if you have any problem.

Authentication

To authorize, use this code:

# With shell, pass the correct header with each request
curl "api_endpoint_here"
  -H "X-API-TOKEN: YOUR-TOKEN"
# With shell, pass the correct header with each request
curl "api_endpoint_here?token=YOUR-TOKEN"

Make sure to replace YOUR-TOKEN with your token.

X-API-TOKEN: YOUR-TOKEN

You will get a token from our support or Orders page. you can either pass it in header X-API-TOKEN or pass as token= in GET query.

API Endpoints

API endpoint is started with https://api.betsapi.com/v1

Rate Limatation

X-RateLimit-Limit:3600
X-RateLimit-Remaining:3599
X-RateLimit-Reset:1495857600

3600 requests per hour.

You can pay extra 50$ to setup standalone server with 199,999 requests per hour.

You can check the values in headers:

Header Name Description
X-RateLimit-Limit The maximum number of requests that the consumer is permitted to make per hour.
X-RateLimit-Remaining The number of requests remaining in the current rate limit window.
X-RateLimit-Reset The time at which the current rate limit window resets in UTC epoch seconds.

Response

All responses are in JSON and has a success key to indicate it is successful or not.

You’ll get results if everything moves well, and an error will be thrown if failed.

Pricing

Check Pricing for details, or contact us if you have custom requirements.

Events API

InPlay Events

curl "https://api.betsapi.com/v1/events/inplay?sport_id=1"
  -H "X-API-TOKEN: YOUR-TOKEN"

HTTP Request

GET https://api.betsapi.com/v1/events/inplay

Query Parameters

Parameter Required? Description
sport_id Yes Reference
league_id No useful when you want only one league
page No Pager reference

HTTP Response

inplay.json

Upcoming Events

curl "https://api.betsapi.com/v1/events/upcoming?sport_id=1"
  -H "X-API-TOKEN: YOUR-TOKEN"

HTTP Request

GET https://api.betsapi.com/v1/events/upcoming

Query Parameters

Parameter Required? Description
sport_id Yes Reference
league_id No useful when you want only one league
team_id No useful when you want only one team
cc No Eg: ‘co’ for Colombia Reference
day No format YYYYMMDD, eg: 20161201
page No Pager reference

HTTP Response

upcoming.json

Ended Events

curl "https://api.betsapi.com/v1/events/ended?sport_id=1"
  -H "X-API-TOKEN: YOUR-TOKEN"

HTTP Request

GET https://api.betsapi.com/v1/events/ended

Query Parameters

Parameter Required? Description
sport_id Yes Reference
league_id No useful when you want only one league
team_id No useful when you want only one team
cc No Eg: ‘co’ for Colombia Reference
day No format YYYYMMDD, eg: 20161201
page No Pager reference

HTTP Response

ended.json

curl "https://api.betsapi.com/v1/events/search?token=YOUR_TOKEN\
&sport_id=1&home=Man%20City&away=Barcelona&time=1478029500"

Search for event with home/away name plus date

HTTP Request

GET https://api.betsapi.com/v1/events/search

URL Parameters

Parameter Required? Description
sport_id Yes Reference
home Yes home team ID or name
away Yes away team ID or name
time Yes either UTC time epoch (Limited to 90 days) or day YYYYMMDD

HTTP Response

search.json

Event View

curl "https://api.betsapi.com/v1/event/view?token=YOUR_TOKEN\
&event_id=92149"

HTTP Request

GET https://api.betsapi.com/v1/event/view

URL Parameters

Parameter Required? Description
event_id Yes Event ID you get from events/*

HTTP Response

event_view.json event_view.basketball.json

Event History

curl "https://api.betsapi.com/v1/event/history?token=YOUR_TOKEN\
&event_id=219465"

History events of Home/Away Team before this event.

HTTP Request

GET https://api.betsapi.com/v1/event/history

URL Parameters

Parameter Required? Description
event_id Yes Event ID you get from events/*
qty No default 10, allowing 1 to 20.

HTTP Response

event_history.json

Event Odds Summary

curl "https://api.betsapi.com/v1/event/odds/summary?token=YOUR_TOKEN\
&event_id=232751"

HTTP Request

GET https://api.betsapi.com/v1/event/odds/summary

URL Parameters

Parameter Required? Description
event_id Yes Event ID you get from events/*

HTTP Response

event_odds_summary.json

Event Odds

curl "https://api.betsapi.com/v1/event/odds?token=YOUR_TOKEN\
&event_id=92149"

HTTP Request

GET https://api.betsapi.com/v1/event/odds

URL Parameters

Parameter Required? Description
event_id Yes Event ID you get from events/*
source No Possible value: bet365, 10bet, ladbrokes, williamhill, betclic, pinnaclesports, planetwin365, ysb88, 188bet, unibet, bwin, betfair, betfred, cloudbet, betsson, betdaq, paddypower, sbobet, titanbet, betathome, dafabet, marathonbet, betvictor, everygame, interwetten. defaults to bet365.
since_time No Integer. add_time will be >= $since_time in results. Faster to get only updates.

HTTP Response

event_odds.json

Odds Markets Reference

Event Stats Trend

curl "https://api.betsapi.com/v1/event/stats_trend?token=YOUR_TOKEN\
&event_id=294607"

Soccer only. only available for events after 2017-06-10.

HTTP Request

GET https://api.betsapi.com/v1/event/stats_trend

URL Parameters

Parameter Required? Description
event_id Yes Event ID you get from events/*

HTTP Response

event_stats_trend.json

Event Lineup

curl "https://api.betsapi.com/v1/event/lineup?token=YOUR_TOKEN\
&event_id=206153"

Soccer only. Note not all events have lineup. you can get the flag (has_lineup) in /event/view.

HTTP Request

GET https://api.betsapi.com/v1/event/lineup

URL Parameters

Parameter Required? Description
event_id Yes Event ID you get from events/*

HTTP Response

event_lineup.json

League

curl "https://api.betsapi.com/v1/league?token=YOUR_TOKEN\
&sport_id=1"

HTTP Request

GET https://api.betsapi.com/v1/league

URL Parameters

Parameter Required? Description
sport_id Yes Reference
cc No Eg: ‘co’ for Colombia Reference
page No Pager reference

HTTP Response

league.json

League Table

curl "https://api.betsapi.com/v1/league/table?token=YOUR_TOKEN\
&league_id=94"

HTTP Request

GET https://api.betsapi.com/v1/league/table

URL Parameters

Parameter Required? Description
league_id Yes flag ‘has_leaguetable’ from League API

HTTP Response

league_table.json

League TopList

curl "https://api.betsapi.com/v1/league/toplist?token=YOUR_TOKEN\
&league_id=94"

HTTP Request

GET https://api.betsapi.com/v1/league/toplist

URL Parameters

Parameter Required? Description
league_id Yes flag ‘has_toplist’ from League API

HTTP Response

league_toplist.json

Team

curl "https://api.betsapi.com/v1/team?token=YOUR_TOKEN\
&sport_id=1"

HTTP Request

GET https://api.betsapi.com/v1/team

URL Parameters

Parameter Required? Description
sport_id Yes Reference
page No Pager reference

HTTP Response

team.json

Bet365 API

Bet365 InPlay

curl "https://api.betsapi.com/v1/bet365/inplay?token=YOUR_TOKEN"

HTTP Request

GET https://api.betsapi.com/v1/bet365/inplay

URL Parameters

Parameter Required? Description
raw No raw Bet365 body without parsing

HTTP Response

bet365_inplay.json

Fields Explanation

Bet365 Inplay Event

curl "https://api.betsapi.com/v1/bet365/event?token=YOUR_TOKEN\
&FI=60504279"

HTTP Request

GET https://api.betsapi.com/v1/bet365/event

URL Parameters

Parameter Required? Description
FI Yes FI from Bet365 Inplay
stats No extra stats info (only provided for Soccer and Cricket)
lineup No lineup info (only provided for Cricket right now)
raw No raw Bet365 body without parsing

HTTP Response

bet365_event.soccer.json bet365_event.soccer.stats.json bet365_event.basketball.json bet365_event.cricket.json bet365_event.cricket.lineup.json

Fields Explanation

Bet365 Upcoming Events

curl "https://api.betsapi.com/v1/bet365/upcoming?sport_id=1"
  -H "X-API-TOKEN: YOUR-TOKEN"

HTTP Request

GET https://api.betsapi.com/v1/bet365/upcoming

Query Parameters

Parameter Required? Description
sport_id Yes Reference
league_id No useful when you want only one league
day No format YYYYMMDD, eg: 20161201
page No Pager reference

HTTP Response

bet365_upcoming.json

Bet365 PreMatch Odds

curl "https://api.betsapi.com/v1/bet365/start_sp?token=YOUR_TOKEN\
&event_id=60504279"

HTTP Request

GET https://api.betsapi.com/v1/bet365/start_sp

URL Parameters

Parameter Required? Description
FI Yes Event ID you get from bet365/upcoming
raw No raw Bet365 body without parsing

HTTP Response

bet365_event.json

Bet365 Result

curl "https://api.betsapi.com/v1/bet365/result?token=YOUR_TOKEN\
&event_id=63543522"

It is useful when you have FI from Bet365 XML Feed and want to know the results.

HTTP Request

GET https://api.betsapi.com/v1/bet365/result

URL Parameters

Parameter Required? Description
event_id Yes Event ID (FI) from Bet365 Inplay

HTTP Response

bet365_result.json

BWin API

BWin InPlay

curl "https://api.betsapi.com/v1/bwin/inplay?token=YOUR_TOKEN"

HTTP Request

GET https://api.betsapi.com/v1/bwin/inplay

HTTP Response

bwin_inplay.json

BWin Prematch Odds

curl "https://api.betsapi.com/v1/bwin/prematch?token=YOUR_TOKEN"

HTTP Request

GET https://api.betsapi.com/v1/bwin/prematch

URL Parameters

Parameter Required? Description
day No format YYYYMMDD, eg: 20161201
sport_id No BWin sport_id

HTTP Response

bwin_prematch.json

BWin Event

curl "https://api.betsapi.com/v1/bwin/event?token=YOUR_TOKEN\
&event_id=60504279"

HTTP Request

GET https://api.betsapi.com/v1/bwin/event

URL Parameters

Parameter Required? Description
event_id Yes Event ID you get from /bwin/inplay or prematch

HTTP Response

bwin_event.json

BWin Result

curl "https://api.betsapi.com/v1/bwin/result?token=YOUR_TOKEN\
&event_id=60504279"

HTTP Request

GET https://api.betsapi.com/v1/bwin/result

URL Parameters

Parameter Required? Description
event_id Yes eventid from BWin API

HTTP Response

bwin_result.json

BetFred API

BetFred Result

curl "https://api.betsapi.com/v1/betfred/result?token=YOUR_TOKEN\
&event_id=7924565"

Useful that you want the results by querying with BetFred XML Feed.

HTTP Request

GET https://api.betsapi.com/v1/betfred/result

URL Parameters

Parameter Required? Description
event_id Yes eventid from BetFred XML Feeds. (.20 will be removed automatically)

HTTP Response

betfred_result.json

WilliamHill API

WilliamHill Result

curl "https://api.betsapi.com/v1/williamhill/result?token=YOUR_TOKEN\
&event_id=10901582"

Useful that you want the results by querying with WilliamHill XML Feed.

HTTP Request

GET https://api.betsapi.com/v1/williamhill/result

URL Parameters

Parameter Required? Description
event_id Yes event_id from WilliamHill XML Feeds. (Example: the id 10901582 is from url http://sports.williamhill.com/bet/en-gb/betting/e/10901582/)

HTTP Response

williamhill_result.json

Sbobet API

Sbobet Result

curl "https://api.betsapi.com/v1/sbobet/result?token=YOUR_TOKEN\
&event_id=2268831"

Useful that you want the results by querying with Sbobet Event ID.

HTTP Request

GET https://api.betsapi.com/v1/sbobet/result

URL Parameters

Parameter Required? Description
event_id Yes event_id from Sbobet

HTTP Response

sbobet_result.json

CSV/Excel

We offer data in CSV/Excel format if you don’t know how to program. Please contact us and send your requirements.

FAQ

How can I get all historical data?

First try with League API, and go through pager to get all data.

Afterwards, pass each league_id in Events API with pager.

How can I get all leagues in Brazil?

use League API with cc=br. For example: https://api.betsapi.com/v1/league?token=YOUR-TOKEN&sport_id=1&cc=br

Do you provide languages other than English?

Yes, we do. Pass LNG_ID as one of the param in GET for specified language. Reference.

References

Sport ID

sport_id Name sport_id Name
1 Soccer 18 Basketball
13 Tennis 91 Volleyball
78 Handball 16 Baseball
17 Ice Hockey 14 Snooker
12 American Football 3 Cricket
83 Futsal 15 Darts
92 Table Tennis 94 Badminton
8 Rugby Union 19 Rugby League
36 Australian Rules 66 Bowls
9 Boxing/UFC 75 Gaelic Sports
90 Floorball 95 Beach Volleyball
110 Water Polo 107 Squash

Errors

Error Code Description
INTERNAL_SERVER_ERROR 500 Internal Server Error, contact Support if it happens
NOT_FOUND 404 Not Found
METHOD_NOT_ALLOWED Method is not allowed, only GET is supported.
UNDER_MAINTENANCE API is under maintenance, we’ll annouce it
AUTHORIZE_FAILED Token is not provided or incorrect.
TOO_MANY_REQUESTS API rate limit exceeded.
PERMISSION_DENIED You’re not allowed, contact Support if it is wrong.
PARAM_REQUIRED Required param is missing, check error_detail for details
PARAM_INVALID param is invalid, check error_detail for details

Countries

countries.json

Pager

Whenever you see pager in the API response, it means you can go next page by passing page=2 etc. there are 3 elements inside which means:

Error Code Description
page Current page
per_page how many results per page, default to 50 as always
total how many results in total. use it to indicate that it has next page or not.

time_status

Error Value Description
0 Not Started
1 InPlay
2 TO BE FIXED
3 Ended
4 Postponed
5 Cancelled
6 Walkover
7 Interrupted
8 Abandoned
9 Retired

Odds Markets

Error Value Description
1_1 1X2
1_2 Asian Handicap
1_3 O/U, Goal Line
1_4 Asian Corners
1_5 1st Half Asian Handicap
1_6 1st Half Goal Line
1_7 1st Half Asian Corners
1_8 Half Time Result
18_1 Money Line
18_2 Spread
18_3 Total Points

Languages

LNG_ID Description
1 English (by default)
2 zh_TW
3 es_ES
5 de_DE
6 it_IT
10 zh_CN
22 pt_PT
70 ja_JP
71 ko_KR
72 fr_FR
73 ru_RU

Changes

2017-11-04

2017-10-24

2017-08-09

2017-06-10

2017-06-04

2017-05-30

2017-05-27

2017-05-07

2017-04-17

2017-04-05

2017-04-01

2017-03-27

2017-03-18

2017-03-17

2017-01-08

2016-12-23

2016-12-07

2016-12-02

Code Sample

PHP