Skip to content

Placing Bets

Placing bets is a multi stage process

  1. Get the product information
  2. Send a request to place a bet against the product
  3. Retrieve the result of the bet
Authorization header

Remember to include the Authorization header in the request.

Get product information

query GetProducts {
  products {
    nodes {
      id
      name
      type {
        ... on BettingProduct {
          betType {
            id,
            code
          },
          selling {
            status
          },
          legs {
            nodes {
              id
              selections {
                nodes {
                id
                name
                }
              }
            }
          }
        }
      }
    }
  }
}
Response
{
  "data": {
    "products": {
      "nodes": [
        {
          "id": "55b56f53-39db-454c-a745-cb622cbfc9e0",
          "name": "BATH 13:40 - Exacta",
          "betType": {
            "id": "1",
            "code": "EXACTA"
          },
          "selling": {
            "status": "OPEN"
          },
          "legs": {
            "nodes": [
              {
                "id": "125ec001-1952-4882-b952-345fd3465a01",
                "selections": {
                  "nodes": [
                    {
                      "id": "7b3d3c92-3a94-42a5-b4bc-0547ae54d407",
                      "name": "Ala Kaifi"
                    },
                    {
                      "id": "1901ef8-7927-4f33-b833-819e962c2d87",
                      "name": "Al Tarfa"
                    },
                    {
                      "id": "2bcf9851-d2ed-4ecd-bd05-3919ba58ace6",
                      "name": "Ajyad"
                    },
                    {
                      "id": "f56a393a-60b3-499f-b6b4-48c55b5908aa",
                      "name": "Miss Dolly Rocker"
                    },
                    {
                      "id": "934621cd-39d8-42da-95dc-23105d8556b2",
                      "name": "The Famous Mrs B"
                    }
                  ]
                }
              }
            ]
          }
        }
      ]
    }
  }
}

Placing the bet

NOTE:

A full list of supported bet types with examples is available here.

IMPORTANT:

The ticketId supplied on each request must be unique. This is used for idempotency checks to ensure that the customers account is only debited once if the request is sent multiple times, which could happen due to network issues. In such an event, no bet will be placed as a result of the duplicate request, but the response will be the same as the original request with the exception of the Idempotent field; which can be used to identify that the request was considered a duplicate.

Similarly, each betId should be unique for the customer, if a ticket contains a betId that is not unique for the customer; the entire ticket will be rejected.

From the response above, we can see the ProductId is 55b56f53-39db-454c-a745-cb622cbfc9e0 and that it is a Exacta product. There is one leg, with an Id of 125ec001-1952-4882-b952-345fd3465a01, and there are 5 selections to pick from.

If we wanted to place a £6 bet on "Ala Kaifi", "Al Tarfa" or "Ajyad" in any order. We would send the following request.

Request: Ala Kaifi, Al Tarfa or Ajyad in any order on exacta bet
mutation PlaceWinBet {
  placeBets(
    input: {
      ticketId: "ticket-42acb0ae-5e1c-4d48-b412-644c9c4a56a0"
      bets: [
        {
          betId: "bet-exacta-42acb0ae-5e1c-4d48-b412-644c9c4a56a0"
          productId: "55b56f53-39db-454c-a745-cb622cbfc9e0"
          stake: { currencyCode: GBP, totalAmount: 6.00 }
          legs: [
            {
              productLegId: "125ec001-1952-4882-b952-345fd3465a01"
              selections: [
                {
                  productLegSelectionID: "51f45b63-55ea-4550-bdcf-bfa7827dc1c2",
                  position: 1
                },
                {
                  productLegSelectionID: "1901ef8-7927-4f33-b833-819e962c2d87",
                  position: 1
                },
                {
                  productLegSelectionID: "2bcf9851-d2ed-4ecd-bd05-3919ba58ace6",
                  position: 1
                }
                {
                  productLegSelectionID: "51f45b63-55ea-4550-bdcf-bfa7827dc1c2",
                  position: 2
                },
                {
                  productLegSelectionID: "1901ef8-7927-4f33-b833-819e962c2d87",
                  position: 2
                },
                {
                  productLegSelectionID: "2bcf9851-d2ed-4ecd-bd05-3919ba58ace6",
                  position: 2
                }
              ]
            }
          ]
        }
      ]
    }
  ) {
    ticket {
      id
      toteId
      bets {
        nodes {
          id
          toteId
          placement {
            status
          }
        }
      }
      idempotent
    }
  }
}
{
  "data": {
    "placeBets": {
      "ticket": {
        "id": "ticket-42acb0ae-5e1c-4d48-b412-644c9c4a56a0",
        "toteId": "6ff21d98-1e0c-453f-8b66-3cd301d3e529",
        "bets": {
          "nodes": [
            {
              "id": "bet-exacta-42acb0ae-5e1c-4d48-b412-644c9c4a56a0",
              "toteId": "1233411e10f4462988f6b9b5364e9a00",
              "placement": {
                "status": "ACCEPTED"
              }
            }
          ]
        },
        "idempotent": false
      }
    }
  }
}

Likewise, if we wanted to place the same bet, but would rather specify the stake amount per line. e.g. 6 lines at £1 per line, We would send the following request with lineAmount instead of totalAmount.

Request: Ala Kaifi, Al Tarfa or Ajyad in any order on exacta bet
mutation PlaceWinBet {
  placeBets(
    input: {
      ticketId: "ticket-42acb0ae-5e1c-4d48-b412-644c9c4a56a0"
      bets: [
        {
          betId: "bet-exacta-42acb0ae-5e1c-4d48-b412-644c9c4a56a0"
          productId: "55b56f53-39db-454c-a745-cb622cbfc9e0"
          stake: { currencyCode: GBP, lineAmount: 1.00 }
          legs: [
            {
              productLegId: "125ec001-1952-4882-b952-345fd3465a01"
              selections: [
                {
                  productLegSelectionID: "51f45b63-55ea-4550-bdcf-bfa7827dc1c2",
                  position: 1
                },
                {
                  productLegSelectionID: "1901ef8-7927-4f33-b833-819e962c2d87",
                  position: 1
                },
                {
                  productLegSelectionID: "2bcf9851-d2ed-4ecd-bd05-3919ba58ace6",
                  position: 1
                }
                {
                  productLegSelectionID: "51f45b63-55ea-4550-bdcf-bfa7827dc1c2",
                  position: 2
                },
                {
                  productLegSelectionID: "1901ef8-7927-4f33-b833-819e962c2d87",
                  position: 2
                },
                {
                  productLegSelectionID: "2bcf9851-d2ed-4ecd-bd05-3919ba58ace6",
                  position: 2
                }
              ]
            }
          ]
        }
      ]
    }
  ) {
    ticket {
      id
      toteId
      bets {
        nodes {
          id
          toteId
          placement {
            status
          }
        }
      }
      idempotent
    }
  }
}
{
  "data": {
    "placeBets": {
      "ticket": {
        "id": "ticket-42acb0ae-5e1c-4d48-b412-644c9c4a56a0",
        "toteId": "6ff21d98-1e0c-453f-8b66-3cd301d3e529",
        "bets": {
          "nodes": [
            {
              "id": "bet-exacta-42acb0ae-5e1c-4d48-b412-644c9c4a56a0",
              "toteId": "1233411e10f4462988f6b9b5364e9a00",
              "placement": {
                "status": "ACCEPTED"
              }
            }
          ]
        },
        "idempotent": false
      }
    }
  }
}

Retrieve a bet

You can retrieve a bet by using the toteId that was provided by the placeBets request.

query GetBets {
  bets(toteId: "1233411e10f4462988f6b9b5364e9a00") {
    nodes {
      id
      toteId
      placement {
        status
        stake {
          currency {
            code
          }
          decimalAmount
        }
      }
      ticket {
        id
        toteId
      }
    }
  }
}
{
  "data": {
    "bets": {
      "nodes": [
        {
          "id": "bet-exacta-42acb0ae-5e1c-4d48-b412-644c9c4a56a0",
          "toteId": "1233411e10f4462988f6b9b5364e9a00",
          "placement": {
            "status": "ACCEPTED",
            "stake": {
              "currency": {
                "code": "GBP"
              },
              "decimalAmount": 1.5
            }
          },
          "ticket": {
            "id": "",
            "toteId": "6ff21d98-1e0c-453f-8b66-3cd301d3e529"
          }
        }
      ]
    }
  }
}