Skip to content

Placing Multi 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": "97f60c59-5540-4fd4-8863-52b80c0d9e89",
          "name": "BATH 13:40 - WIN",
          "betType": {
            "id": "1",
            "code": "WIN"
          },
          "selling": {
            "status": "OPEN"
          },
          "legs": {
            "nodes": [
              {
                "id": "5ff0aae6-29a1-4f6a-98c0-190b06aa1300",
                "selections": {
                  "nodes": [
                    {
                      "id": "aeac6957-4fec-4fc9-95c4-683bd25eec5b",
                      "name": "Ala Kaifi"
                    },
                    {
                      "id": "1cf6df9e-baa5-4f25-bf02-ac2ee4c66e7c",
                      "name": "Al Tarfa"
                    },
                    {
                      "id": "c7a329b5-2fbc-4ff2-b826-084a13b939d9",
                      "name": "Ajyad"
                    },
                    {
                      "id": "51f45b63-55ea-4550-bdcf-bfa7827dc1c2",
                      "name": "Miss Dolly Rocker"
                    },
                    {
                      "id": "0d35f4ab-e618-44bf-9d80-d6d40ab3e540",
                      "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 97f60c59-5540-4fd4-8863-52b80c0d9e89 and that it is a Win product. There is one leg, with an Id of 5ff0aae6-29a1-4f6a-98c0-190b06aa1300, and there are 5 selections to pick from.

If we wanted to place a £1.50 bet on "Miss Dolly Rocker", which has the Id 51f45b63-55ea-4550-bdcf-bfa7827dc1c2 and £2.00 on "The Famous Mrs B", which has the Id "0d35f4ab-e618-44bf-9d80-d6d40ab3e540". We would send the following request.

Request: Bet on Miss Dolly Rocker to Win and The Famous Mrs B to Win
mutation PlaceBets {
  placeBets(
    input: {
      ticketId: "ticket-42acb0ae-5e1c-4d48-b412-644c9c4a56a0"
      bets: [
        {
          betId: "bet-win-42acb0ae-5e1c-4d48-b412-644c9c4a56a0"
          productId: "97f60c59-5540-4fd4-8863-52b80c0d9e89"
          stake: { currencyCode: GBP, totalAmount: 1.50 }
          legs: [
            {
              productLegId: "5ff0aae6-29a1-4f6a-98c0-190b06aa1300"
              selections: [{ productLegSelectionID: "51f45b63-55ea-4550-bdcf-bfa7827dc1c2" }]
            }
          ]
        },
        {
          betId: "bet-win-44af934d-6823-4fd7-9a39-11edd4be3ccf"
          productId: "97f60c59-5540-4fd4-8863-52b80c0d9e89"
          stake: { currencyCode: GBP, totalAmount: 2.00 }
          legs: [
            {
              productLegId: "5ff0aae6-29a1-4f6a-98c0-190b06aa1300"
              selections: [{ productLegSelectionID: "0d35f4ab-e618-44bf-9d80-d6d40ab3e540" }]
            }
          ]
        }
      ]
    }
  ) {
    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-win-42acb0ae-5e1c-4d48-b412-644c9c4a56a0",
              "toteId": "8779011e10f4462988f6b9b5364e9a00",
              "placement": {
                "status": "PLACED"
              }
            },
            {
              "id": "bet-win-44af934d-6823-4fd7-9a39-11edd4be3ccf",
              "toteId": "dde8b00ed0c340a9b445f00f705299be",
              "placement": {
                "status": "PLACED"
              }
            }
          ]
        },
        "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: "8779011e10f4462988f6b9b5364e9a00") {
    nodes {
      id
      toteId
      placement {
        status
        stake {
          currency {
            code
          }
          decimalAmount
        }
      }
      ticket {
        id
        toteId
      }
    }
  }
}
{
  "data": {
    "bets": {
      "nodes": [
        {
          "id": "bet-win-42acb0ae-5e1c-4d48-b412-644c9c4a56a0",
          "toteId": "8779011e10f4462988f6b9b5364e9a00",
          "placement": {
            "status": "ACCEPTED",
            "stake": {
              "currency": {
                "code": "GBP"
              },
              "decimalAmount": 1.5
            }
          },
          "ticket": {
            "id": "",
            "toteId": "6ff21d98-1e0c-453f-8b66-3cd301d3e529"
          }
        }
      ]
    }
  }
}