BetBot API
To use the WinTheTrophy BetBot API, you first need to register for a user account. Once you are logged in, you can create up to 20 BetBots. You do this by clicking the "Your Account" link, then the "BetBot" tab.
Once you create your BetBot, you will get your API key for that BetBot; your BetBot can visit the BetBot API at http://www.winthetrophy.com/apiv1 and ask for the following with .json or .xml responses (always include the API key as a parameter to each request):
Each BetBot is limited to 120 API calls per hour. If you exceed this limit, you’ll start getting 403 Forbidden responses until the hour has elapsed. If your BetBot needs more than 120 calls per hour to function properly, drop us a note and let us know why, and we’ll consider increasing this limit.
If any of the betting terms used in this API guide, such as moneyline, spread, over/under, price, etc. are unfamiliar to you, please consult the WinTheTrophy FAQ.
Example BetBots can be found in this public GitHub repository.
| Resource | What you ask for... | What you get... |
| Leagues | GET /leagues.[xml/json] | array of leagues by their short names (NFL, NBA, etc.) |
| Example: http://winthetrophy.com/apiv1/leagues.xml?api_key=123456789deadbeef987654321 | ||
| Bet Weeks | GET /bet_weeks.[xml/json] | array of the last 8 bet weeks; each bet week will have start and end date, chips, and bets won/lost/pushed |
| Example: http://winthetrophy.com/apiv1/bet_weeks.json?api_key=123456789deadbeef987654321 | ||
| GET /bet_weeks.[xml/json]?start=time1&end=time2 | array of bet weeks for the given time period (input time format is seconds since epoch; the max time interval between start and end is 26 weeks) | |
| Example: http://winthetrophy.com/apiv1/bet_weeks.xml?start=1275913476&end=1277123047&api_key=123456789deadbeef987654321 | ||
| GET /bet_weeks.[xml/json]?time=time | the bet week within which which the provided time occurs (input time format is seconds since epoch) | |
| Example: http://winthetrophy.com/apiv1/bet_weeks.json?time=1275913476&api_key=123456789deadbeef987654321 | ||
| Events (Games) | GET /events.[xml/json] | array of games in the next 24 hours; each game has the attributes listed under GET /events/id |
| Example: http://winthetrophy.com/apiv1/events.xml?api_key=123456789deadbeef987654321 | ||
| GET /leagues/league_short_name/events.[xml/json] | array of games in a given league in the next 24 hours | |
| Example: http://winthetrophy.com/apiv1/leagues/NHL/events.json?api_key=123456789deadbeef987654321 | ||
| GET /events.[xml/json]?start=time1&end=time2 | array of games for the given time period (input time format is seconds since epoch; max interval between start and end is one week) | |
| Example: http://winthetrophy.com/apiv1/leagues/MLB/events.xml?start=1276864729&end=1277123896&api_key=123456789deadbeef987654321 | ||
| GET /events/id.[xml/json] | an event id, name, game time, home score, away score, home team, away team, and bet line [1], and matchup [2]. | |
| Example: http://winthetrophy.com/apiv1/events/10246.json?api_key=123456789deadbeef987654321 | ||
| Bets | GET /bets.[xml/json] | array of the user’s bets for the current bet week; each bet will have attributes listed under /bets/id |
| Example: http://winthetrophy.com/apiv1/bets.xml?api_key=123456789deadbeef987654321 | ||
| GET /leagues/league_id/bets.[xml/json] | array of the user’s bets in a given league for the current bet week | |
| Example: http://winthetrophy.com/apiv1/leagues/3/bets.xml?api_key=123456789deadbeef987654321 | ||
| GET /bets.[xml/json]?start=time1&end=time2 | array of the user’s bets for the given time period (input time format is seconds since epoch, max interval between start and end is one month) | |
| Example: http://winthetrophy.com/apiv1/bets.xml?start=1275913476&end=1277123047&api_key=123456789deadbeef987654321 | ||
| GET /bets.[xml/json]?status=status [3] | array of the user’s resolved or unresolved bets | |
| Example: http://winthetrophy.com/apiv1/bets.xml?status=unresolved&api_key=123456789deadbeef987654321 | ||
| GET /bets/id.[xml/json] | a bet id, event id, type [4], wager, game time, resolved, pick [5], result, amount won, and bet line [1] | |
| Example: http://winthetrophy.com/apiv1/bets/12345.xml?api_key=123456789deadbeef987654321 | ||
| POST /bets.[xml/json] (required POST payload: event_id, bet_line_type [6], pick [5], wager) | same as for GET /bets/id | |
| Example: http://winthetrophy.com/apiv1/bets.xml?event_id=12345&bet_line_type=spread&pick=1&wager=50&api_key=123456789deadbeef987654321 | ||
| POST /bets.[xml/json] (required POST payload: parlay consisting of 3 to 8 bets) | a parlay id, amount won, game time of the last game in the parlay, resolved, result, wager amount, and an array of bets; each with the same data listed for GET /bets/id | |
|
Example: http://winthetrophy.com/apiv1/bets.xml api_key=123456789deadbeef987654321 parlay= bet_1=event_id=123&bet_line_type=moneyline&pick=1&wager=100 bet_2=event_id=456&bet_line_type=moneyline&pick=2&wager=100 . . . bet_8=event_id=789&bet_line_type=moneyline&pick=1&wager=100 [7] [8] |
||
- Bet line includes home_price and away_price for moneyline, home_price, away_price and spread for spread, and over_price, under_price and total for over_under.
- Matchup includes the home_record and away_record for now; more details will be available in the near future.
- status is resolved or unresolved.
- The type is Bet or Parlay.
- The pick is 1 or 2. 1 is home and 2 is away when the bet line type is spread or moneyline. 1 is over and 2 is under when the the bet line type is over_under.
- The bet_line_type is moneyline, spread or over_under.
- The keys for bets (bet_1, bet_2, etc) don’t matter as long as each is unique.
- You can parlay moneyline type bets together, or spread and over/under bets together. Other combinations are not possible. See the WinTheTrophy FAQ for more info.
Example Responses
| http://www.winthetrophy.com/apiv1/bet_weeks.xml?api_key=123456789deadbeef987654321 |
|
<bet-weeks type="array">
<bet-week>
<chips type="integer">1000</chips>
<end-date type="datetime">2010-04-04T23:59:59-04:00</end-date>
<games-lost type="integer">0</games-lost>
<games-pushed type="integer">0</games-pushed>
<games-won type="integer">0</games-won>
<moneyline-lost type="integer">0</moneyline-lost>
<moneyline-pushed type="integer">0</moneyline-pushed>
<moneyline-won type="integer">0</moneyline-won>
<overunder-lost type="integer">0</overunder-lost>
<overunder-pushed type="integer">0</overunder-pushed>
<overunder-won type="integer">0</overunder-won>
<spread-lost type="integer">0</spread-lost>
<spread-pushed type="integer">0</spread-pushed>
<spread-won type="integer">0</spread-won>
<start-date type="datetime">2010-03-29T00:00:00-04:00</start-date>
<chips-available type="integer">1000</chips-available>
</bet-week>
<bet-week>...7 previous bet weeks here...</bet-week>
</bet-weeks>
|
| http://www.winthetrophy.com/apiv1/bet_weeks.json?api_key=123456789deadbeef987654321 |
|
[{ "chips":1000, "end_date":"2010-04-04T23:59:59-04:00", "games_lost":0, "games_pushed":0, "games_won":0, "moneyline_lost":0, "moneyline_pushed":0, "moneyline_won":0, "overunder_lost":0, "overunder_pushed":0, "overunder_won":0, "spread_lost":0, "spread_pushed":0, "spread_won":0, "start_date":"2010-03-29T00:00:00-04:00", "chips_available":1000}, {...7 previous bet weeks here...}] |
| http://www.winthetrophy.com/apiv1/events/123.xml?api_key=123456789deadbeef987654321 |
|
<event>
<away-score type="integer">3</away-score>
<game-time type="datetime">2009-05-22T19:05:00-04:00</game-time>
<home-score type="integer">4</home-score>
<id type="integer">123</id>
<name>MLB - Detroit Tigers vs. Colorado Rockies</name>
<home-team>
<id type="integer">68</id>
<name>Tigers</name>
</home-team>
<away-team>
<id type="integer">88</id>
<name>Rockies</name>
</away-team>
<moneyline>
<home-line type="float">-150.0</home-line>
<away-line type="float">130.0</away-line>
</moneyline>
<spread>
<spread type="float">-1.5</spread>
<home-price type="float">149.0</home-price>
<away-price type="float">-159.0</away-price>
</spread>
<over-under>
<over-price type="float">-109.0</over-price>
<under-price type="float">-101.0</under-price>
<total type="float">9.0</total>
</over-under>
<matchup>
<away-record>16-24</away-record>
<home-record>23-16</home-record>
</matchup>
</event>
|
| http://www.winthetrophy.com/apiv1/bets.xml?api_key=123456789deadbeef987654321 |
|
<bets type="array">
<bet>
<amount-won type="integer" nil="true"></amount-won>
<event-id type="integer">8778</event-id>
<game-time type="datetime">2010-03-29T19:00:00-04:00</game-time>
<id type="integer">31860</id>
<pick type="integer">1</pick>
<resolved type="boolean">false</resolved>
<result nil="true"></result>
<type>Bet</type>
<wager type="integer">100</wager>
<moneyline>
<home-line type="float">-500.0</home-line>
<away-line type="float">400.0</away-line>
</moneyline>
</bet>
<bet>...all your other bets for the week</bet>
</bets>
|
| http://www.winthetrophy.com/apiv1/bets?event_id=5678&bet_line_type=overunder&pick=1&wager=100&api_key=123456789deadbeef987654321 |
|
<bet>
<amount-won type="integer" nil="true"></amount-won>
<event-id type="integer">8778</event-id>
<game-time type="datetime">2010-03-29T19:00:00-04:00</game-time>
<id type="integer">31860</id>
<pick type="integer">1</pick>
<resolved type="boolean">false</resolved>
<result nil="true"></result>
<type>Bet</type>
<wager type="integer">100</wager>
<moneyline>
<home-line type="float">-500.0</home-line>
<away-line type="float">400.0</away-line>
</moneyline>
</bet>
|
|
http://www.winthetrophy.com/apiv1/bets?api_key=123456789deadbeef987654321 parlay= bet_1=event_id=123&bet_line_type=moneyline&pick=1&wager=100 bet_2=event_id=456&bet_line_type=moneyline&pick=2&wager=100 bet_3=event_id=789&bet_line_type=moneyline&pick=1&wager=100 |
|
<parlay>
<amount-won type="integer" nil="true"></amount-won>
<game-time type="datetime">2010-10-09T18:00:00Z</game-time>
<id type="integer">1234</id>
<resolved type="boolean">false</resolved>
<result nil="true"></result>
<wager type="integer">800</wager>
<bets type="array">
<bet>
<amount-won type="integer" nil="true"></amount-won>
<event-id type="integer">123</event-id>
<game-time type="datetime" nil="true"></game-time>
<id type="integer">56086</id>
<pick type="integer">1</pick>
<resolved type="boolean">false</resolved>
<result nil="true"></result>
<type>Bet</type>
<wager type="integer">100</wager>
</bet>
<bet>
<amount-won type="integer" nil="true"></amount-won>
<event-id type="integer">456</event-id>
<game-time type="datetime" nil="true"></game-time>
<id type="integer">56087</id>
<pick type="integer">2</pick>
<resolved type="boolean">false</resolved>
<result nil="true"></result>
<type>Bet</type>
<wager type="integer">100</wager>
</bet>
<bet>
<amount-won type="integer" nil="true"></amount-won>
<event-id type="integer">789</event-id>
<game-time type="datetime" nil="true"></game-time>
<id type="integer">56088</id>
<pick type="integer">1</pick>
<resolved type="boolean">false</resolved>
<result nil="true"></result>
<type>Bet</type>
<wager type="integer">100</wager>
</bet>
</bets>
</parlay>
|



