openapi: 3.0.0
servers:
  - url: https://sandbox.whapi.com/v2/bets
info:
  contact:
    email: platform@williamhill.com
    name: William Hill Labs
    url: http://developer.williamhill.com
    x-twitter: WilliamHill
  description: The Bets API methods are used to place single, multiple and complex bets and to retrieve a customer’s bet history. When retrieving a customer’s bet history you can organize the bets from the betting history in terms of date, bet type and whether the bet is settled or not. You can also specify what fields to be included/excluded or return a list of all default fields the method returns. <br /><br /> The Bets API will also generate a bet delay if you’re placing a single/multiple bet in-Play by creating a time margin to negate the effects of major changes to the market (for example, goals during a football match). Note that in version 2 of our APIs, Bets API contains the functionality of both Bets API v1 and the Betslips API v1.
  title: Bets API
  version: 2.0.0
  x-apisguru-categories:
    - entertainment
  x-logo:
    url: https://twitter.com/WillHillHelp/profile_image?size=original
  x-origin:
    - format: openapi
      url: https://developer.williamhill.com/wh-docs/docs-sdks/bets/swagger/docs
      version: "3.0"
  x-providerName: whapi.com
  x-serviceName: bets
paths:
  /bet/complex:
    post:
      description: Places a multiple or a complex bet.
      operationId: placeComplexBet
      parameters:
        - $ref: "#/components/parameters/param_apiKey"
        - $ref: "#/components/parameters/param_apiSecret"
        - $ref: "#/components/parameters/param_apiTicket"
        - $ref: "#/components/parameters/param_fields"
        - $ref: "#/components/parameters/param_include"
        - $ref: "#/components/parameters/param_exclude"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/complexBetRequestBody"
        description: Complex bet request body
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                response:
                  value: |
                    {
                     "placedBets" : [
                     {
                     "id" : 51097,
                     "number": 1,
                     "receipt" : "O/0013333/0000109/F", 
                     "numLines" : 1, 
                     "totalStake" : 2.50, 
                     "placedDateTime" : "2015-12-12T00:11:00"
                     }, 
                     {
                     "id" : 51098, 
                     "number": 2,
                     "receipt" : "O/0013333/0000109/F", 
                     "numLines" : 1, 
                     "totalStake" : 2.50, 
                     "placedDateTime" : "2015-12-12T00:11:00"
                     }
                     ]
                    }
              schema:
                $ref: "#/components/schemas/betPlacedResponse"
          description: Success
        "202":
          content:
            application/json:
              examples:
                response:
                  value: |
                    {
                     "delayedBets" : [
                     {
                     "id" : 51097, 
                     "number" : 1, 
                     "delayedBetId" : "SL-I60Xjir9wr1MWpZf/XnHHycr7mSePgkYbY+aidjVII2AhfeWsWkuLucDnW0PWkJgmos0HO1zY6fMGbptVOezaicYUgKV",
                     "delayPeriodSeconds" : 5
                     }, 
                     {
                     "id" : 51098, 
                     "number" : 2, 
                     "delayedBetId" : "SL-I60Xjir8wr1MWpZf/XnHHycr7mSePgkYbY+aidjVII2AhfeWsWkuLucDnW0PWkJgmos0HO1zY6fMGbptVOezaicYUgKV",
                     "delayPeriodSeconds" : 5
                     }
                     ]
                    }
              schema:
                $ref: "#/components/schemas/betDelayedResponse"
          description: Delayed
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/errors"
          description: Errors
      summary: Places a multiple or a complex bet.
      tags:
        - Bets
      x-canReturnErrors: null
  /bet/single:
    post:
      description: Places a single bet. When placing a single bet using live inplay bets, the system might generate a bet delay to allow a time margin to negate the effects of major changes (for example, goals) to the market. Note that the amount of bet delay will vary by category and event type. A delayedBetId will be recieved that can be used to resubmit the bet.
      operationId: placeSingleBet
      parameters:
        - $ref: "#/components/parameters/param_apiKey"
        - $ref: "#/components/parameters/param_apiSecret"
        - $ref: "#/components/parameters/param_apiTicket"
        - $ref: "#/components/parameters/param_fields"
        - $ref: "#/components/parameters/param_include"
        - $ref: "#/components/parameters/param_exclude"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/singleBetRequestBody"
        description: Single bet request body
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                response:
                  value: |
                    {
                     "placedBets" : [
                     {
                     "id" : 51097,
                     "receipt" : "O/0013333/0000109/F", 
                     "numLines" : 1, 
                     "totalStake" : 2.50, 
                     "placedDateTime" : "2015-12-12T00:11:00"
                     }
                     ]
                    }
              schema:
                $ref: "#/components/schemas/betPlacedResponse"
          description: Success
        "202":
          content:
            application/json:
              examples:
                response:
                  value: |
                    {
                     "delayedBets" : [
                     {
                     "id" : 51097, 
                     "delayedBetId" : "SL-I60Xjir9wr1MWpZf/XnHHycr7mSePgkYbY+aidjVII2AhfeWsWkuLucDnW0PWkJgmos0HO1zY6fMGbptVOezaicYUgKV",
                     "delayPeriodSeconds" : 5
                     }
                     ]
                    }
              schema:
                $ref: "#/components/schemas/betDelayedResponse"
          description: Delayed
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/errors"
          description: Errors
      summary: Places a single bet
      tags:
        - Bets
      x-canReturnErrors: null
  /betslips:
    post:
      description: Organises the betslip when one or more selections are made. It returns a bet slip structure organised by betting opportunities.
      operationId: validateBetslip
      parameters:
        - $ref: "#/components/parameters/param_apiKey"
        - $ref: "#/components/parameters/param_apiSecret"
        - $ref: "#/components/parameters/param_expanded"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/betSlipRequest"
        description: Betslip Body
        required: true
      responses:
        "200":
          content:
            application/json:
              examples:
                response:
                  value: |
                    {
                     "betslip" : [
                     {
                     number: 1, 
                     numLines: 1
                     ...
                     }
                     ]
                    }
              schema:
                $ref: "#/components/schemas/betSlipResponse"
          description: ""
      tags:
        - Bets
  /freebets:
    get:
      description: Retrieves the current free bets available for a customer.
      operationId: getFreeBets
      parameters:
        - $ref: "#/components/parameters/param_apiKey"
        - $ref: "#/components/parameters/param_apiSecret"
        - $ref: "#/components/parameters/param_apiTicket"
        - $ref: "#/components/parameters/param_fields"
        - $ref: "#/components/parameters/param_include"
        - $ref: "#/components/parameters/param_exclude"
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/freeBet"
          description: Success
        "204":
          description: No Free Bets
      summary: Returns available free bets
      tags:
        - Bets
      x-canreturnErrors: null
  /history:
    get:
      description: Retrieves the customer’s bet history. Options are available to organise the history in terms of date, bet type and settled and unsettled bets. The maximum number of bets and bet history pages retrieved can also be set.
      operationId: getBetHistory
      parameters:
        - $ref: "#/components/parameters/param_apiKey"
        - $ref: "#/components/parameters/param_apiSecret"
        - $ref: "#/components/parameters/param_apiTicket"
        - $ref: "#/components/parameters/param_fromDateTime"
        - $ref: "#/components/parameters/param_toDateTime"
        - $ref: "#/components/parameters/param_fields"
        - $ref: "#/components/parameters/param_include"
        - $ref: "#/components/parameters/param_exclude"
        - $ref: "#/components/parameters/param_page"
        - $ref: "#/components/parameters/param_pageSize"
        - $ref: "#/components/parameters/param_sort"
        - description: Filter by settled bets. If omitted, both settled and unsettled will be returned.
          in: query
          name: settled
          required: false
          schema:
            type: boolean
          x-eg: true
      responses:
        "200":
          content:
            application/json:
              examples:
                response:
                  value: |
                    {
                     bets:
                     [
                     {
                     id:"797",
                     typeCode:"SGL",
                     typeName:"Single",
                     transDateTime:"2016-01-05 14:27:58",
                     settled:false,
                     stake:0.12,
                     status:"N",
                     winnings:0.26,
                     estimatedReturns:0.26
                     },
                     {
                     id:"798",
                     typeCode:"SGL",
                     typeName:"Single",
                     transDateTime:"2016-01-05 15:27:58",
                     numLines:5,
                     numSelections:5,
                     receipt:"O/0001370/0000132/F",
                     settled:false,
                     stake:0.13,
                     cashinValue:0.12,
                     stakePerLine:0.13,
                     status:"A",
                     winnings:0.26,
                     estimatedReturns:0.26,
                     freeBetValue:0.00,
                     legs: 
                     [
                     {
                     type:"W",
                     number:1,
                     parts:
                     [
                     {
                     number:1,
                     description:"Swansea",
                     eventId:"OB_EV3966",
                     eventDescription:"Swansea Vs Sunderland",
                     priceDen:1,
                     priceNum:1,
                     priceType:"L",
                     result:"-",
                     startDateTime:"2016-01-07 20:00:00"
                     },
                     {
                     number:1,
                     description:"Swansea",
                     eachWayNum:1,
                     eachWayDen:1,
                     eachWayPlaces:1
                     eventId:"OB_EV3966",
                     eventDescription:"Swansea Vs Sunderland",
                     eventMarketDescription:"90 Minutes",
                     eventTypeDescription:"Manchester Senior Cup",
                     handicap:0.1,
                     selectionId:"OB_OU00001",
                     priceDen:1,
                     priceNum:1,
                     priceType:"L",
                     result:"-",
                     startDateTime:"2016-01-07 20:00:00",
                     rule4Deductions:0.1,
                     priceFormatted:
                     {
                     fractional:"EVS",
                     decimal:2,
                     american:"+100"
                     } 
                     }
                     ]
                     }
                     ]
                     }
                     ]
                    }
              schema:
                $ref: "#/components/schemas/betHistoryResponse"
          description: Success
        "404":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/errors"
          description: Error
      summary: Retrieves the customer’s bet history.
      tags:
        - Bets
      x-canReturnErrors:
        - 20638
  "/{betId}/cashin":
    put:
      description: Allows a trusted application to cash in a bet (take a return on a bet) on behalf of the customer. If the customers monitor bets they can cash in a bet at any point before the event ends.
      operationId: cashin
      parameters:
        - $ref: "#/components/parameters/param_apiKey"
        - $ref: "#/components/parameters/param_apiSecret"
        - $ref: "#/components/parameters/param_apiTicket"
        - $ref: "#/components/parameters/param_betId"
        - description: The cash in value of the bet
          in: query
          name: cashInValue
          required: true
          schema:
            format: double
            type: number
          x-eg: 20
        - description: The ID of this bet delay
          in: query
          name: cashinBetDelayId
          required: true
          schema:
            type: string
          x-eg: GGGfffEEE
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/cashInResponse"
          description: Success
        "400":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/errors"
          description: Errors
        "409":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/errors"
          description: Errors
      summary: Allows a trusted application to cash in a bet (take a return on a bet) on behalf of the customer
      tags:
        - Bets
      x-canreturnErrors:
        - 20631
        - 20632
        - 20634
        - 20635
        - 20636
        - 20637
components:
  parameters:
    param_apiKey:
      description: A unique identifier of your application that is generated by the API portal.
      in: header
      name: apiKey
      required: true
      schema:
        pattern: ^[a-zA-Z0-9]{19,50}$
        type: string
      x-eg: l7xxa54460c573b5497c9b24b505xxxxxxxx
    param_apiSecret:
      description: Another unique identifier for your application.
      in: header
      name: apiSecret
      required: true
      schema:
        pattern: ^[a-zA-Z0-9]{19,50}$
        type: string
      x-eg: 355b1e522c544222ab4ff318xxxxxxxx
    param_apiTicket:
      description: The ticket obtained from the sessions API
      in: header
      name: apiTicket
      required: true
      schema:
        pattern: ^[a-zA-Z][a-zA-Z0-9-]{39,100}$
        type: string
      x-eg: TGT-1920-Cl7l4e0hzFWK9aoKeiggDexuWcmAMf9brh6IFpVdsQxxxxxxxx-brsux349
    param_betId:
      description: The identifier of the bet
      in: path
      name: betId
      required: true
      schema:
        type: string
    param_exclude:
      description: Specify fields from the default to exclude (Comma Separated List)
      explode: false
      in: query
      name: exclude
      required: false
      schema:
        items:
          type: string
        type: array
      style: form
    param_expanded:
      description: Allows for all bets for given selections to be returned - not just the specified type
      in: query
      name: expanded
      required: false
      schema:
        type: string
    param_fields:
      description: Specify an absolute field list to return (Comma Separated List)
      explode: false
      in: query
      name: fields
      required: false
      schema:
        items:
          type: string
        type: array
      style: form
    param_fromDateTime:
      description: The UTC FROM datetime from bets to be returned. (yyyy-MM-ddTHH:mm:ss)
      in: query
      name: dateFrom
      required: true
      schema:
        pattern: ^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})$
        type: string
      x-eg: 2013-09-25T13:34:20
    param_include:
      description: Specify fields in addition to the default to return (Comma Separated List)
      explode: false
      in: query
      name: include
      required: false
      schema:
        items:
          type: string
        type: array
      style: form
      x-eg: FieldName
    param_page:
      description: The index of the page to return
      in: query
      name: page
      schema:
        default: 1
        type: number
      x-eg: 10
    param_pageSize:
      description: The number of results per page
      in: query
      name: pageSize
      schema:
        default: 100
        type: number
      x-eg: 15
    param_sort:
      description: The order the response will be retuned by. i.e. transDateTime,desc. Only transDateTime can be used currently
      in: query
      name: sort
      required: false
      schema:
        default: transDateTime,asc
        type: string
      x-eg: transDateTime,desc
    param_toDateTime:
      description: The UTC TO datetime for bets to be returned. (yyyy-MM-ddTHH:mm:ss)
      in: query
      name: dateTo
      required: true
      schema:
        pattern: ^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})$
        type: string
      x-eg: 2013-09-25T13:34:20
  schemas:
    bet:
      properties:
        delayedBetId:
          description: The delayed bet identifier
          type: string
        freeBetId:
          description: The ID number of the free bet token if used in conjunction with this bet
          type: string
        legs:
          items:
            $ref: "#/components/schemas/leg"
          type: array
        number:
          description: The bet number
          type: integer
        stake:
          description: The amount of the stake placed on the bet
          format: double
          type: number
        typeCode:
          description: "The bet type code of the bet. For example: TBL (Treble)"
          type: string
      required:
        - number
        - typeCode
        - stake
        - legs
      type: object
    betDelayed:
      properties:
        delayPeriodSeconds:
          description: The delay time period of the bet in seconds. The resubmission of the bet has to wait for the length of time (in seconds) returned in the delayPeriod before submitting the second request.
          type: integer
        delayedBetId:
          description: The unique identifier of the delayed bet. After the initial response is received, containing the delayPeriod and the delayBetId, the request is then resubmitted using the same delayBetId token that came in that initial response. Check the example below to see how to resend a delayed bet payload.
          type: string
        id:
          description: The number of the bet
          type: string
        number:
          description: Number of the bet if this is part of a multiple bet
          type: number
      required:
        - id
        - delayedBetId
        - delayPeriodSeconds
      type: object
    betDelayedResponse:
      items:
        $ref: "#/components/schemas/betDelayed"
      title: delayedBets
      type: array
    betHistoryResponse:
      properties:
        bets:
          $ref: "#/components/schemas/historyBets"
      type: object
    betPlaced:
      properties:
        id:
          description: The bet id
          type: string
        numLines:
          description: The number of lines the bet consists of
          type: integer
        number:
          description: Number of the bet if this is part of a multiple bet
          type: number
        placedDateTime:
          description: "The time the bet was placed. For example: 2013-01-30TT13:34:20. The value of this element can be replaced with the current timestamp if it was missing."
          type: string
        receipt:
          description: The unique ID of the bet receipt
          type: string
        totalStake:
          description: The total amount staked on the bet
          format: double
          type: number
      required:
        - receipt
      type: object
    betPlacedResponse:
      items:
        $ref: "#/components/schemas/betPlaced"
      title: placedBets
      type: array
    betSlipRequest:
      properties:
        legs:
          items:
            $ref: "#/components/schemas/leg"
          type: array
      type: object
    betSlipResponse:
      properties:
        betslip:
          items:
            $ref: "#/components/schemas/betslipbet"
          type: array
      type: object
    betslipbet:
      properties:
        betMultiplier:
          description: The total aggregated odds, as a decimal, of the multiple bet placed
          pattern: "[0-9]*"
          type: number
        freeBets:
          description: Free bets that can be used with this bet
          items:
            $ref: "#/components/schemas/freeBetDetail"
          type: array
        legs:
          items:
            $ref: "#/components/schemas/betslipleg"
          type: array
        maxStake:
          description: "Maximum stake allowable on the bet. For example: 2500.00 (GBP)"
          format: double
          type: number
        minStake:
          description: "Minumum stake allowable on the bet. For example: 0.05 (GBP)"
          format: double
          type: number
        numLines:
          description: The number of lines (selections) of a bet
          type: number
        number:
          description: The bet number
          type: integer
        typeCode:
          description: "The bet type code of the bet. For example: TBL (Treble)"
          type: string
        typeName:
          description: "The TypeCode of the bet. For example: TBL (Treble)"
          type: string
      required:
        - number
        - typeCode
        - legs
      type: object
    betslipleg:
      properties:
        parts:
          items:
            $ref: "#/components/schemas/betslippart"
          type: array
        sort:
          description: The leg sort. This element is present for complex bets but not for single bets.
          type: string
        type:
          description: Type of leg that was placed on the bet, such as Win or Each-way. Even though the priceNum and priceDen are required for the bets with type value W (win), it is just optional from the endpoint point of view. There are requests / bets like outcomes with starting price but do not have a specific price. Generally prices can change, so if the type is win you have to resubmit and thus verify the price that the customer saw on the screen initially. The API will check if it matches the current price of William Hill. Note that if you send a wrong / outdated price you will receive the error message - Price changed.
          type: string
      required:
        - type
        - parts
      type: object
    betslippart:
      properties:
        eachWayAvailable:
          description: Indicates whether each way is available
          type: boolean
        includeInMultiple:
          description: Indicates if the bet can be used in a multiple bet
          type: boolean
        legGroup:
          description: To organise a number of outcome selections into one or more bet groups, such as a Single bet, a Double bet, a Trixie, etc
          type: integer
        priceChanged:
          description: Indicates if there has been a change in the price
          type: boolean
        priceDen:
          description: Price denominator - will be ignored for types other than L (Fixed Price)
          type: integer
        priceNum:
          description: Price numerator - will be ignored for types other than L (Fixed Price)
          type: integer
        priceType:
          description: The type of price selected. For example - ‘L’ (Fixed)
          type: integer
        selectionId:
          description: The selection identifier
          pattern: ^(OB_OU\d+)$
          type: integer
          x-eg: OB_OU00000001
        singleAvailable:
          description: Indicates whether the bet can be used in a single bet
          type: boolean
        startingPriceAvailable:
          description: Indicates whether starting prices are available
          type: boolean
        status:
          description: Indicates the current status of the bet
          pattern: (A|S)
          type: string
        statusChanged:
          description: Indicates whether the status of the bet has changed
          type: boolean
      required:
        - selectionId
        - priceType
        - priceNum
        - priceDen
        - includeInMultiple
      type: object
    cashInResponse:
      properties:
        success:
          description: Indicates whether the bet has been cashed-in.
          type: boolean
      required:
        - success
      type: object
    complexBetRequestBody:
      properties:
        bets:
          description: A collection of bets
          items:
            $ref: "#/components/schemas/bet"
          type: array
      type: object
    error:
      properties:
        code:
          description: A unique William Hill identifier for the error
          type: string
        field:
          description: To help pinpoint the exact parameter where a request has failed
          type: string
        message:
          description: A unique William Hill text string to enable you to identify the error (in English only)
          type: string
        solution:
          $ref: "#/components/schemas/solution"
      type: object
    errors:
      properties:
        errors:
          items:
            $ref: "#/components/schemas/error"
          type: array
      type: object
    freeBet:
      items:
        $ref: "#/components/schemas/freeBetDetail"
      type: array
    freeBetDetail:
      properties:
        awardDateTime:
          description: The time the free bet was awarded. For example 2014-11-013T23:59:10
          type: string
        displayText:
          description: The message explaining the offer displayed to the customer along with the free bet
          type: string
        expiryDateTime:
          description: The time the free bet expired. For example 2014-11-013T23:59:10
          type: string
        id:
          description: The identifier of the free bet
          type: integer
        offerDesc:
          description: The description of the offer that enabled the customer to place a free bet
          type: string
        offerId:
          description: The identifier of the offer
          type: integer
        offerName:
          description: The name of the offer that enabled the customer to place a free bet
          type: string
        startDateTime:
          description: The time the free bet offer started. For example 2014-11-013T23:59:10
          type: string
        value:
          description: The value of the free bet
          type: number
      required:
        - id
        - offerName
        - value
      type: object
    historyBets:
      items:
        $ref: "#/components/schemas/placedBet"
      type: array
    leg:
      properties:
        parts:
          items:
            $ref: "#/components/schemas/part"
          type: array
        sort:
          description: The leg sort. This element is present for complex bets but not for single bets.
          type: string
        type:
          description: "The leg type. One of the following values: W - Win or E- Each-way. Even though the priceNum and priceDen are required for the bets with type value W (win), it is just optional from the endpoint point of view. There are requests / bets like outcomes with starting price but do not have a specific price. Generally prices can change, so if the type is win you have to resubmit and thus verify the price that the customer saw on the screen initially. The API will check if it matches the current price of William Hill. Note that if you send a wrong / outdated price you will receive the error message - Price changed."
          type: string
      required:
        - type
        - parts
      type: object
    part:
      properties:
        includeInMultiple:
          description: Indicates if the bet can be used in a multiple bet
          type: boolean
        priceDen:
          description: Price denominator - will be ignored for types other than L (Fixed Price)
          type: integer
        priceNum:
          description: Price numerator - will be ignored for types other than L (Fixed Price)
          type: integer
        priceType:
          description: The type of price selected. For example - ‘L’ (Fixed)
          type: integer
        selectionId:
          description: The selection identifier
          pattern: ^(OB_OU\d+)$
          type: integer
          x-eg: OB_OU00000001
      required:
        - selectionId
        - priceType
        - priceNum
        - priceDen
        - includeInMultiple
      type: object
    placedBet:
      properties:
        cashinValue:
          description: The cash in value of the bet. For example £0.88. When no value is given or no value is present, no cash in is available
          format: double
          type: number
        estimatedReturns:
          description: "The estimated value of the returns if the bet is successful. Note: when an estimated return isn’t available, as in the case of a bet placed on a horse at SP (starting price) where the actual price is unknown when the bet is placed, ‘NOT_AVAILABLE’ will appear in the response field."
          format: double
          type: number
        freeBetValue:
          description: If a free bet token is used for the bet, this element represents the value
          format: double
          type: number
        id:
          description: The unique identifier of the bet
          type: string
        legs:
          items:
            $ref: "#/components/schemas/placedBetLeg"
          type: array
        numLines:
          description: Number of lines of bets
          type: integer
        numSelections:
          description: Number of selections that the bet is made of
          type: integer
        receipt:
          description: The unique identifier of the receipt for the bet
          type: string
        settled:
          description: Whether the bet is settled
          type: boolean
        stake:
          description: "The bet stake, which represents the total value of the bet. For example: £ 12.34"
          format: double
          type: number
        stakePerLine:
          description: "The individual stake on each line of the bet. For example: £ 6.17"
          format: double
          type: number
        status:
          description: "The status of the bet. Can be one of the following: A - Active, S - suspended, C - Cashed Out"
          type: string
        transDateTime:
          description: The time the bet was placed
          type: string
        typeCode:
          description: "The bet type code of the bet. For example: TBL (Treble)"
          type: string
        typeName:
          description: "The name of the bet type. For example: Double"
          type: string
        winnings:
          description: Actual value of the returns from this bet
          format: double
          type: number
      required:
        - id
        - typeCode
        - typeName
        - transDateTime
        - settled
        - stake
        - status
        - winnings
        - estimatedReturns
      type: object
    placedBetLeg:
      properties:
        number:
          description: The leg number of the bet
          type: integer
        parts:
          items:
            $ref: "#/components/schemas/placedBetPart"
          type: array
        sort:
          description: The leg sort. This element is present for complex bets but not for single bets.
          type: string
        type:
          description: "The leg type. One of the following values: W - Win or E- Each-way. Even though the priceNum and priceDen are required for the bets with type value W (win), it is just optional from the endpoint point of view. There are requests / bets like outcomes with starting price but do not have a specific price. Generally prices can change, so if the type is win you have to resubmit and thus verify the price that the customer saw on the screen initially. The API will check if it matches the current price of William Hill. Note that if you send a wrong / outdated price you will receive the error message - Price changed."
          type: string
      required:
        - type
        - number
        - parts
      type: object
    placedBetPart:
      properties:
        description:
          description: Human-friendly description of the bet
          type: string
        eachWayDen:
          description: "When the odds are shown in vulgar fractions this is the denominator of the fraction. For example: 2 in 5/2"
          type: integer
        eachWayNum:
          description: "When the odds are shown in vulgar fractions this is the numerator of the fraction. For example: 5 in 5/2"
          type: integer
        eachWayPlaces:
          description: The Each-way places available for the bet
          type: integer
        eventDescription:
          description: The description of the event
          type: string
        eventId:
          description: Unique identifier of the event
          pattern: ^(OB_EV\d+)$
          type: string
          x-eg: OB_EV00000001
        eventMarketDescription:
          description: The description of the market within an event
          type: string
        eventTypeDescription:
          description: The description of type of the event
          type: string
        handicap:
          description: "Denotes if the bet is part of a handicap market. For example: -1 if the selection starts on -1 goals (in football)"
          format: double
          type: number
        number:
          description: The number of the bet
          type: integer
        priceDen:
          description: "When the odds are shown in vulgar fractions this is the denominator of the fraction. For example: 2 in 5/2"
          type: integer
        priceFormatted:
          $ref: "#/components/schemas/priceFormatted"
        priceNum:
          description: "When the odds are shown in vulgar fractions this is the numerator of the fraction. For example: 5 in 5/2"
          type: integer
        priceType:
          description: "The price type chosen when the bet was placed. For example: L (Win)"
          type: string
        result:
          description: "The outcome of the bet/event. Can be one of the following values: W - Won; L - Lost; V - Void; - Result not yet available"
          type: string
        rule4Deductions:
          description: The official scale of deductions that apply when a runner is withdrawn
          format: double
          type: number
        selectionId:
          description: Unique identifier of the selection
          pattern: ^(OB_OU\d+)$
          type: string
          x-eg: OB_OU00000001
        startDateTime:
          description: "Time the event will start. For example: 2013-01-30 11:01:01"
          type: string
      required:
        - number
        - description
        - eventId
        - eventDescription
        - priceDen
        - priceNum
        - priceType
        - result
        - startDateTime
      type: object
    priceFormatted:
      properties:
        american:
          description: The price in American format
          type: string
        decimal:
          description: The decimal format of the price
          format: double
          type: number
        fractional:
          description: The fractional format of the price or EVS when the price evens.
          type: string
      type: object
    singleBetRequestBody:
      properties:
        delayedBetId:
          description: The delayed bet identifier
          type: string
        freeBetId:
          description: The ID number of the free bet token if used in conjunction with this bet
          type: string
        priceDen:
          description: "When the odds are shown in vulgar fractions this is the denominator of the fraction. For example: 2 in 5/2"
          type: integer
        priceNum:
          description: "When the odds are shown in vulgar fractions this is the numerator of the fraction. For example: 5 in 5/2"
          type: integer
        priceType:
          description: "The type of price taken by the customer when the bet is made. Can be one of the following: L - Live Fixed price, S - Starting price - Horse and Greyhound racing or G - Guaranteed best price."
          pattern: ^(L|S|G)$
          type: string
        selectionId:
          description: The unique ID for the selection of the bet
          pattern: ^(OB_OU\d+)$
          type: string
          x-eg: OB_OU00000001
        stake:
          description: The amount of the stake placed on the bet
          format: double
          type: number
        type:
          description: "The type of bet placed. Can be one of the following: W - Win or E- EachWay"
          pattern: ^(W|E)$
          type: string
      required:
        - type
        - stake
        - selectionId
        - priceType
      type: object
    solution:
      properties:
        betNum:
          description: The bet number
          type: string
        eventId:
          description: The identifier of the event
          pattern: ^(OB_EV\d+)$
          type: string
          x-eg: OB_EV00000001
        handicap:
          description: The updated handicap
          type: string
        handicapPrecision:
          description: The handicap precision
          type: string
        priceDen:
          description: "When the odds are shown in vulgar fractions this is the denominator of the fraction. For example: 2 in 5/2"
          type: string
        priceNum:
          description: "When the odds are shown in vulgar fractions this is the numerator of the fraction. For example: 5 in 5/2"
          type: string
        selectionHandicap:
          description: The selection handicap
          type: string
        selectionId:
          description: The identifier of the selection
          pattern: ^(OB_OU\d+)$
          type: string
          x-eg: OB_OU00000001
      type: object
x-customerrors:
  - code: 20601
    message: Insufficient funds
    status: 402
  - code: 20602
    message: Stake too low
    status: 400
  - code: 20603
    message: Stake too high
    status: 400
  - code: 20604
    message: Price changed
    status: 409
  - code: 20605
    message: Market suspended
    status: 400
  - code: 20606
    message: Live prices not available
    status: 400
  - code: 20607
    message: Unexpected bet failure
    status: 500
  - code: 20608
    message: Selection started
    status: 400
  - code: 20609
    message: Handicap has changed
    status: 409
  - code: 20610
    message: Wrong number of parts for leg sort
    status: 400
  - code: 20611
    message: Invalid price type
    status: 400
  - code: 20612
    message: Invalid leg sort
    status: 400
  - code: 20613
    message: Forecasts not available
    status: 400
  - code: 20614
    message: Invalid stake
    status: 400
  - code: 20615
    message: Invalid markets
    status: 400
  - code: 20616
    message: Invalid bet type
    status: 400
  - code: 20617
    message: Invalid leg type
    status: 400
  - code: 20618
    message: Invalid scorecast parameters
    status: 400
  - code: 20619
    message: Each way not available
    status: 400
  - code: 20620
    message: Best price not available
    status: 400
  - code: 20621
    message: Forecasts not available
    status: 400
  - code: 20622
    message: Tricast not available
    status: 400
  - code: 20623
    message: First show not available
    status: 400
  - code: 20624
    message: Second show not available
    status: 400
  - code: 20625
    message: Starting price not available
    status: 400
  - code: 20626
    message: Next price not available
    status: 400
  - code: 20627
    message: Scorecast not available
    status: 400
  - code: 20628
    message: No price available
    status: 400
  - code: 20629
    message: Eachway terms have changed
    status: 409
  - code: 20630
    message: Maximum payout too high
    status: 400
  - code: 20631
    message: Cash In value changed
    status: 409
  - code: 20632
    message: Cash In has a delay
    status: 202
  - code: 20634
    message: Cash In has a pending delay
    status: 202
  - code: 20635
    message: Cash In value too high
    status: 400
  - code: 20636
    message: Cash In unavailable
    status: 400
  - code: 20637
    message: Cash In bet already settled
    status: 400
  - code: 20638
    message: No results. Check paging?
    status: 404
  - code: 20639
    message: Selections cannot be combined
    status: 400
  - code: 20640
    message: Maximum number of parts for leg sort exceeded
    status: 400
x-docchapters:
  - betTypes
  - fieldSelection
  - apiSummary
  - headAndOptions
  - docsAndSdks
  - errorHandling
  - statusCodes
x-globalerrors: null
