The Racing API Odds API

The Odds API from The Racing API — 1 operation(s) for odds.

OpenAPI Specification

the-racing-api-odds-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: The Racing Australia Odds API
  version: 1.4.3
  x-logo:
    url: https://www.theracingapi.com/static/images/logo_padded.png
  description: High performance API for horse racing statistical modelling, application development and web content. Complete coverage of UK, Irish and Hong Kong horse racing.
  contact:
    url: https://www.theracingapi.com/
  x-generated-from: official-openapi-spec
servers:
- url: https://api.theracingapi.com
  description: Production server
tags:
- name: Odds
paths:
  /v1/odds/{race_id}/{horse_id}:
    get:
      tags:
      - Odds
      summary: The Racing API Odds Runner
      description: <h4>Get detailed pre-race runner odds data, including price movements, for UK and Irish racing.</h4><table><tbody><tr><td><b>Min. Required Plan</b></td><td>Pro</td></tr><tr><td><b>Rate Limit</b></td><td>5 requests per second</td></tr></tbody></table><p>ℹ️ Price movements, displayed in the 'history' fields, are available for runners in races from 2025-03-17 onwards.</p>
      operationId: odds_runner_v1_odds__race_id___horse_id__get
      security:
      - HTTPBasic: []
      parameters:
      - name: race_id
        in: path
        required: true
        schema:
          type: string
          title: Race Id
      - name: horse_id
        in: path
        required: true
        schema:
          type: string
          title: Horse Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RaceRunnerOdds'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
      - lang: Shell
        source: 'curl -u USERNAME:PASSWORD https://api.theracingapi.com/v1/odds/{race_id}/{horse_id}

          '
        label: cURL
      - lang: Python
        source: 'import requests

          from requests.auth import HTTPBasicAuth


          url = "https://api.theracingapi.com/v1/odds/{race_id}/{horse_id}"

          params = {}

          response = requests.request("GET", url, auth=HTTPBasicAuth(''USERNAME'',''PASSWORD''), params=params)

          print(response.json())'
        label: Python3
      - lang: PHP
        source: "<?php\n$username = 'USERNAME';\n$password = 'PASSWORD';\n$url = \"https://api.theracingapi.com/v1/odds/{race_id}/{horse_id}\";\n\n$params = http_build_query([ ]);\n\n$ch = curl_init(\"$url?$params\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);\ncurl_setopt($ch, CURLOPT_USERPWD, \"$username:$password\");\n\n$response = curl_exec($ch);\n\nif (curl_errno($ch)) {\n  echo 'Error:' . curl_error($ch);\n} else {\n  echo $response;\n}\n\ncurl_close($ch);\n?>"
        label: PHP
      - lang: JavaScript
        source: "const username = 'USERNAME';\nconst password = 'PASSWORD';\nconst credentials = btoa(`${username}:${password}`);\n\nconst params = new URLSearchParams({});\nconst url = `https://api.theracingapi.com/v1/odds/{race_id}/{horse_id}?${params}`;\n\nfetch(url, {\n  method: 'GET',\n  headers: {\n    'Authorization': `Basic ${credentials}`\n  }\n})\n.then(response => response.json())\n.then(data => console.log(data))\n.catch(error => console.error('Error:', error));"
        label: Node.js
      - lang: Ruby
        source: 'require ''net/http''

          require ''uri''

          require ''json''


          params = {}

          uri = URI(''https://api.theracingapi.com/v1/odds/{race_id}/{horse_id}'')

          uri.query = URI.encode_www_form(params)


          http = Net::HTTP.new(uri.host, uri.port)

          http.use_ssl = true


          request = Net::HTTP::Get.new(uri)

          request.basic_auth(''USERNAME'', ''PASSWORD'')


          response = http.request(request)

          puts JSON.parse(response.body)'
        label: Ruby
      - lang: Java
        source: "import java.net.http.*;\nimport java.util.Base64;\nimport java.util.Map;\n\nMap<String, String> params = Map.of();\nString credentials = Base64.getEncoder()\n    .encodeToString(\"USERNAME:PASSWORD\".getBytes());\n\nHttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.theracingapi.com/v1/odds/{race_id}/{horse_id}\"))\n    .header(\"Authorization\", \"Basic \" + credentials)\n    .build();\n\nHttpResponse<String> response = client.send(\n    request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
        label: Java
      - lang: Go
        source: "package main\n\nimport (\n    \"fmt\"\n    \"io\"\n    \"net/http\"\n    \"net/url\"\n)\n\nfunc main() {\n    params := url.Values{}\n    url := \"https://api.theracingapi.com/v1/odds/{race_id}/{horse_id}?\" + params.Encode()\n\n    client := &http.Client{}\n    req, _ := http.NewRequest(\"GET\", url, nil)\n    req.SetBasicAuth(\"USERNAME\", \"PASSWORD\")\n\n    resp, _ := client.Do(req)\n    defer resp.Body.Close()\n    body, _ := io.ReadAll(resp.Body)\n    fmt.Println(string(body))\n}"
        label: Go
      - lang: C#
        source: "using System.Net.Http.Headers;\nusing System.Text;\nusing System.Web;\n\nvar params_ = HttpUtility.ParseQueryString(string.Empty);\nvar url = $\"https://api.theracingapi.com/v1/odds/{race_id}/{horse_id}?{params_}\";\n\nvar client = new HttpClient();\nvar credentials = Convert.ToBase64String(\n    Encoding.ASCII.GetBytes(\"USERNAME:PASSWORD\"));\nclient.DefaultRequestHeaders.Authorization =\n    new AuthenticationHeaderValue(\"Basic\", credentials);\n\nvar response = await client.GetAsync(url);\nvar content = await response.Content.ReadAsStringAsync();\nConsole.WriteLine(content);"
        label: .NET
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  schemas:
    RaceRunnerOddsBookmakers:
      properties:
        bookmaker:
          anyOf:
          - type: string
          - type: 'null'
          title: Bookmaker
          default: ''
        fractional:
          anyOf:
          - type: string
          - type: 'null'
          title: Fractional
          default: ''
        decimal:
          anyOf:
          - type: string
          - type: 'null'
          title: Decimal
          default: ''
        ew_places:
          anyOf:
          - type: string
          - type: 'null'
          title: Ew Places
          default: ''
        ew_denom:
          anyOf:
          - type: string
          - type: 'null'
          title: Ew Denom
          default: ''
        updated:
          anyOf:
          - type: string
          - type: 'null'
          title: Updated
          default: ''
        history:
          anyOf:
          - items:
              $ref: '#/components/schemas/RaceRunnerOddsHistory'
            type: array
          - type: 'null'
          title: History
          default: []
      type: object
      title: RaceRunnerOddsBookmakers
      example:
        bookmaker: Bet365
        decimal: '6'
        ew_denom: '5'
        ew_places: '4'
        fractional: 5/1
        history:
        - changed_at: '2025-04-22T13:34:00+01:00'
          decimal: '6.5'
          fractional: 11/2
        - changed_at: '2025-04-22T13:28:00+01:00'
          decimal: '5.5'
          fractional: 9/2
        updated: '2025-04-22 13:30:26'
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    RaceRunnerOdds:
      properties:
        race_id:
          type: string
          title: Race Id
        horse_id:
          type: string
          title: Horse Id
        horse:
          type: string
          title: Horse
        odds:
          anyOf:
          - items:
              $ref: '#/components/schemas/RaceRunnerOddsBookmakers'
            type: array
          - type: 'null'
          title: Odds
          default: []
      type: object
      required:
      - race_id
      - horse_id
      - horse
      title: RaceRunnerOdds
      example:
        horse: Spartan Arrow
        horse_id: hrs_30314725
        odds:
        - bookmaker: Bet365
          decimal: '6'
          ew_denom: '5'
          ew_places: '4'
          fractional: 5/1
          history:
          - changed_at: '2025-04-22T13:34:00+01:00'
            decimal: '6.5'
            fractional: 11/2
          updated: '2025-04-22 13:30:26'
        race_id: rac_11588863
    RaceRunnerOddsHistory:
      properties:
        changed_at:
          type: string
          title: Changed At
        fractional:
          type: string
          title: Fractional
        decimal:
          type: string
          title: Decimal
      type: object
      required:
      - changed_at
      - fractional
      - decimal
      title: RaceRunnerOddsHistory
      example:
        changed_at: '2025-04-22T13:34:00+01:00'
        decimal: '6.5'
        fractional: 11/2
  securitySchemes:
    HTTPBasic:
      type: http
      scheme: basic
x-tagGroups:
- name: Get Started
  tags:
  - Introduction
  - Authentication
  - Endpoint Overview
  - Rate Limits
  - Changelog
- name: Core API
  tags:
  - Courses
  - Dams
  - Damsires
  - Horses
  - Jockeys
  - Odds
  - Owners
  - Racecards
  - Results
  - Sires
  - Trainers
- name: Core API (by plan level)
  tags:
  - Free Plan
  - Basic Plan
  - Standard Plan
  - Pro Plan
- name: Regional APIs
  tags:
  - Australia
  - North America