- •Getting Started with API-NG
- •Application Keys
- •API-NG Login
- •Non-Interactive (bot) login
- •Certificate Generation With XCA
- •Interactive Login from a Desktop Application
- •Interactive Login - API Endpoint
- •Login FAQs
- •Keep Alive
- •Logout
- •API-NG - Visualiser
- •Example Requests
- •Market Data Request Limits
- •Understanding Market Navigation
- •API 6.0 > API-NG Operations Comparison Table
- •API-NG Reference Guide
- •Betting API
- •Betfair Starting Price Betting (BSP)
- •Betting on Australian Events
- •Betting On Italian Exchange
- •Navigation Data For Applications
- •Betting Operations
- •listCompetitions
- •listCountries
- •listCurrentOrders
- •listClearedOrders
- •listClearedOrders - Roll-up Fields Available
- •listEvents
- •listEventTypes
- •listMarketBook
- •listMarketCatalogue
- •listMarketProfitAndLoss
- •listMarketTypes
- •listTimeRanges
- •listVenues
- •placeOrders
- •Italian Exchange Specific Bet Rules
- •cancelOrders
- •replaceOrders
- •updateOrders
- •Betting Exceptions
- •Betting Enums
- •Betting Type Definitions
- •Accounts API
- •Accounts Operations
- •createDeveloperAppKeys
- •getAccountDetails
- •getAccountFunds
- •getDeveloperAppKeys
- •getAccountStatement
- •listCurrencyRates
- •transferFunds
- •Account Operations (Vendor API)
- •activateApplicationSubscription
- •cancelApplicationSubscription
- •getApplicationSubscriptionHistory
- •getApplicationSubscriptionToken
- •getVendorClientId
- •listAccountSubscriptionTokens
- •listApplicationSubscriptionTokens
- •updateApplicationSubscription
- •Accounts Exceptions
- •Accounts Enums
- •Accounts TypeDefinitions
- •Heartbeat API
- •Vendor Services in API-NG
- •Interface Definition Documents
- •Additional Information
- •Betfair Price Increments
- •Currency Parameters
- •Racecourse Abbreviations
- •Runner Metadata Description
- •Time Zones
- •Common Error Codes
- •Sample Code
- •Excel & VBA Sample
- •Java
- •Javascript
- •Python
V0.2 |
Introduced betting functionality and |
20-05-2013 |
|
listCurrentOrders |
|
V0.1 |
Initial release |
09-12-2012 |
Quick Navigation
Betting API
Please find the details for the current Betting API endpoints:
You can make requests and place bets on UK & international markets by accessing the UK Exchange via the following endpoints.
UK Exchange |
|
|
|
Interface |
Endpoint |
JSON-RPC Prefix |
<methodname> |
|
|
|
Example |
JSON-RPC |
https://api.betfair.com/exc <methodname> |
SportsAPING/v1.0/listMar |
|
|
hange/betting/json-rpc/v1 |
|
ketBook |
JSON REST |
https://api.betfair.com/exc |
|
|
|
hange/betting/rest/v1.0/ |
|
|
You can make requests and place bets on Australian markets by accessing the Australian exchange server via the following endpoints.
Australian Exchange |
|
|
|
Interface |
Endpoint |
JSON-RPC Prefix |
<methodname> |
|
|
|
Example |
JSON-RPC |
https://api-au.betfair.com/ <methodname> |
SportsAPING/v1.0/listMar |
|
|
exchange/betting/json-rpc |
|
ketBook |
|
/v1 |
|
|
JSON REST |
https://api-au.betfair.com/ |
|
|
|
exchange/betting/rest/v1.0 |
|
|
|
/ |
|
|
Betfair Starting Price Betting (BSP)
The Betfair Starting Price will be determined by balancing bets from customers who want to back and lay at Starting Price and matching into the Betfair exchange markets to balance out any residual demand.
The Betfair Starting Price will be calculated exactly to ensure the fairest and most transparent odds possible for both backers and layers. The BSP does not need to account for a profit margin but instead is calculated at the start of an
event by looking at the relationship between the amounts of money requested at SP by opposing betting parties. To give an even more accurate price, we will use money where possible that is trading on the exchange at the start of the event. This gives a true reflection of public opinion on a selection.
How is the BSP calculated?
The Near Price is based on money currently on the site at SP as well as unmatched money on the same selection in the exchange. To understand this properly, you first need to understand the calculation of the Far Price, which only takes into account the SP bets that have been made. The Far Price is not as complicated but not as accurate and only accounts for money on the site at SP.
Excluding money requested at a fixed price on the exchange, if there are £1000 worth of backers stakes on a selection at SP and £6000 worth of layers liability, we can return an SP at the start of the event of 6/1 (7.0).
If however there were £6000 worth of backers stakes on the selection and £1000 worth of layers liability, we would return an SP of 1/6 (1.17). These are calculations of the Far Price.
The calculation of the final starting price occurs when the market is turned in-play. This is when the market is reconciled.
Betting on Australian Events
API-NG supports betting on events within Australia and/or under the jurisdiction of the Tasmanian Gaming Commission (TGC).
The main requirements of are that:
1. Betting markets for sporting events that take place in Australia must be operated under an Australian licence from the Tasmanian Gaming Commission (the body that regulates on-line gambling in Australia).
2.Bets placed in a betting market that operates under an Australian licence must be matched and settled on equipment residing physically in Australia.
3.No performance degradation may be suffered by customers (in their placement and management of bets) as a result of the requirement for bets to be matched and settled in Australia.
4.Providers of on-line gambling services must formally verify the name and address of every customer who wishes to bet on an Australian sporting event.
Until this verification has taken place for a customer, that customer is not permitted to:
Deposit more than $300 (USD) in a single month into his or her betting account
Use the funds in the betting account to place bets whose cumulative cost in a single month exceeds $300 (USD)
Remove any funds from the account.
Finally, the name and address verification process must be completed within three months of the first deposit into the account, otherwise the account will be suspended until verification has taken place.
To meet the first and second of the TGC’s requirements,you can only bet on Australian events by accessing the Australian exchange server via a separate endpoint. You need to make sure that your client software sends its requests to the correct endpoint URL for the Australian exchange server.
You must also explicitly specify the correct endpoint URL.
You can make requests for and place bets on Australian markets by accessing the Australian exchange server via the following endpoints.
Betting API
Interface |
Endpoint |
JSON-RPC Prefix |
<methodname> |
|
|
|
Example |
JSON-RPC |
https://api-au.betfair.com/ <methodname> |
SportsAPING/v1.0/listMar |
|
|
exchange/betting/json-rpc |
|
ketBook |
|
/v1 |
|
|
JSON REST |
https://api-au.betfair.com/ |
|
|
|
exchange/betting/rest/v1.0 |
|
|
You can make requests for your Aus Exchange wallet information by accessing the Aus Exchange via the following endpoints.
Account API |
|
|
|
Interface |
Endpoint |
JSON-RPC Prefix |
<methodname> |
|
|
|
Example |
JSON-RPC |
https://api-au.betfair.com/ <methodname> |
AccountAPING/v1.0/getA |
|
|
exchange/account/json-rp |
|
ccountFunds |
|
c/v1 |
|
|
JSON REST |
https://api-au.betfair.com/ |
|
|
|
exchange/account/rest/v1. |
|
|
|
0 |
|
|
*Please note the getAccountFunds operations for the Australian Exchange doesn’t currently return details from the Australian wallet. This is due to be rectified in a future release.
Betting On Italian Exchange
Italian residents who have registered an Italian Exchange account can access the Betfair Exchange API. Italian residents can register an account via https://register.betfair.it/account/italy/registration
To use the Italian Exchange with API-NG you need to create an Application Key for your Italian Exchange account by following the process outlined via https://api.developer.betfair.com/services/webapps/docs/display/1smk3cen4v3l u3yomq5qye0ni/Application+Keys
Once you have done created an App Key, you will need to login to API-NG using the Italian Exchange endpoint which is as follows:
Non-interactive Login
https://identitysso.betfair.it/api/certlogin
Interactive Login
https://identitysso.betfair.it/view/login?product=<AppKey>&url=https://www.betfair.it
Italian Exchange Specific Bet Rules
To use the interactive login with the Italian Exchange your App Key will need to be white-listed by Betfair. White-listing is not required to use the non-interactive login method.
There are several additional regulatory rules which apply specifically and only to accounts betting on the Italian Exchange (https://www.betfair.it/exchange):
1.The stake for each back offer is a minimum of 200 Euro Cents and can only be incremented in multiples of 50 Euro Cents.
2.Any lay offers placed by the customer, must be placed in such a way as to ensure that the stake for any corresponding back offer amounts to a minimum of 50 Euro Cents.
3.We cannot accept betting offers with potential winnings, calculated on the basis of the pre-selected odds, that exceed the amount envisaged by article 12, paragraph 4, of Finance Minister Decree no. 111 of 1 March 2006 (10,000 Euros). N.B. This does not include stake.
The Italian Exchange isn't available for betting between 0100 and 0500 GMT
Navigation Data For Applications
Endpoint & Required Headers
ExampleExample Request
Supported Locales
Navigation Data File Structure
JSON Model Structure
ROOT
EVENT_TYPE
GROUP
EVENT
RACE
MARKET
Endpoint & Required Headers
This request allows the retrieval of the full Betfair market navigation menu from a compressed file.
The file can be accessed via https://api.betfair.com/exchange/betting/rest/v1/en/navigation/menu.json and is updated every 5 minutes.
The following request headers are required:
X-Application - Your Application Key
X-Authentication - Your session token, obtained from the API login response.
Example Request
GET https://api.betfair.com/exchange/betting/rest/v1/en/navigation/menu.json HTTP/1.1 Host: api.betfair.com
Connection: keep-alive
X-Application: <AppKey>
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36
X-Authentication: <SessionToken>
Accept: */*
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,da;q=0.6
Supported Locales
The following languages are supported by the navigation file:
en | en_GB | bg | da | de | el | es | it | pt | ru | sv
English - en
Spanish - es
Italian - it
German - de
Swedish - sv
Portuguese -pt
Russian - ru
Greek - el
Bulgarian – bg
Danish - da
Navigation Data File Structure
This is a diagram showing how the Navigation Data File is structured.
In plain English:
A ROOT group node has one or many EVENT_TYPE nodes An EVENT_TYPE node has zero, one or many GROUP nodes An EVENT_TYPE node has zero, one or many EVENT nodes
A Horse Racing EVENT_TYPE node has zero, one or many RACE nodes A RACE node has one or many MARKET nodes
A GROUP node has zero, one or many EVENT nodes
A GROUP node has zero, one or many GROUP nodes
An EVENT node has zero, one or many MARKET nodes An EVENT node has zero, one or many GROUP nodes An EVENT node has zero, one or many EVENT nodes
JSON Model Structure
ROOT
{
"children": [
{
EVENT_TYPE1
},
{
EVENT_TYPE2
},
...
],
"id": 0, // always 0
"name": "ROOT", // always ROOT "type": "GROUP" // always GROUP
}
EVENT_TYPE
{
"children": [
{
GROUP or EVENT or RACE (RACE only if
},
...
],
"id": "1", // Betfair specific eventTypeId "name": "Soccer",
"type": "EVENT_TYPE"
}
GROUP
{
"children": [
{
GROUP or EVENT
},
...
],
"id": "74568202414", // Not a Betfair specif "name": "Womens Soccer",
"type": "GROUP"
}
EVENT
{
"children": [
{
GROUP, MARKET or EVENT
},
...
],
"id": "27244118", // Betfair specific eventI "name": "South Korea U20 (W) v Mexico U20 (W "countryCode": "GB",
"type": "EVENT"
}
RACE
{
"children": [
{
MARKET
},
...
],
"id": "27247020.1115", // Betfair specific r "name": "1300m 3yo",
"startTime": "2014-08-12T11:15:00.000Z", "type": "RACE",
"venue": "Deauville", "countryCode": "GB"
}
MARKET
{
"exchangeId": "1", // Betfair specific excha "id": "1.114881860", // Betfair specific mar "marketStartTime": "2014-08-14T00:00:00.000Z "marketType": "WIN", // Betfair specific mar "numberOfWinners": "2", // Betfair specific "name": "Over/Under 6.5 Goals",
"type": "MARKET"
}