Documentation / Dogs

Head-to-head

GET/v1/dogs/{dog_id}/head-to-head/{rival_id}

Available on Live Live Plus

Compare two greyhounds directly: shared races, who finished ahead and how often, plus each dog's career record — the factual rivalry view.

Authenticate with your key in the X-API-Key header — see Authentication. Works with sandbox keys inside the sandbox data window.

Parameters

NameInTypeRequiredDescription
dog_id path integer yes The dog identifier.
rival_id path integer yes The second dog's identifier.

Request

curl "https://api.greyhoundapi.com/v1/dogs/655044/head-to-head/654595" \
  -H "X-API-Key: $GAPI_KEY"
<?php
$ch = curl_init('https://api.greyhoundapi.com/v1/dogs/655044/head-to-head/654595');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => ['X-API-Key: ' . getenv('GAPI_KEY')],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);

print_r($response['data']);
const res = await fetch('https://api.greyhoundapi.com/v1/dogs/655044/head-to-head/654595', {
  headers: { 'X-API-Key': process.env.GAPI_KEY }
});
if (!res.ok) throw new Error(`GreyhoundAPI ${res.status}`);
const { meta, data } = await res.json();
console.log(meta.data_as_of, data);
import { useEffect, useState } from 'react';

export default function Example() {
  const [data, setData] = useState(null);

  useEffect(() => {
    fetch('https://api.greyhoundapi.com/v1/dogs/655044/head-to-head/654595', {
      headers: { 'X-API-Key': import.meta.env.VITE_GAPI_KEY }
    })
      .then((r) => r.json())
      .then((body) => setData(body.data));
  }, []);

  if (!data) return <p>Loading…</p>;
  return <pre>{JSON.stringify(data, null, 2)}</pre>;
}

Browser code exposes whatever key it ships with — use a sandbox key for prototypes and proxy live keys through your own server in production.

import os
import requests

r = requests.get(
    "https://api.greyhoundapi.com/v1/dogs/655044/head-to-head/654595",
    headers={"X-API-Key": os.environ["GAPI_KEY"]},
    timeout=10,
)
r.raise_for_status()
body = r.json()
print(body["meta"]["data_as_of"], body["data"])

Response

200 OKapplication/json
{
    "meta": {
        "request_id": "req_8f2ac1",
        "data_as_of": "2026-07-08T13:05:12Z"
    },
    "data": {
        "dogs": [
            {
                "dog_id": 655044,
                "name": "Full Monty",
                "career": {
                    "total_races": 12,
                    "total_wins": 5,
                    "win_pct": 41.67
                }
            },
            {
                "dog_id": 654595,
                "name": "Miami Yeats",
                "career": {
                    "total_races": 14,
                    "total_wins": 4,
                    "win_pct": 28.57
                }
            }
        ],
        "shared_races": 3,
        "finished_ahead": {
            "655044": 2,
            "654595": 1
        },
        "races": [
            {
                "race_id": 1229082,
                "date_local": "2026-07-08",
                "track": "Romford",
                "grade": "S1",
                "distance_m": 575,
                "positions": {
                    "655044": 3,
                    "654595": 1
                }
            }
        ]
    }
}

Run it live

A real request from your browser straight to api.greyhoundapi.com with your own key — nothing is proxied or logged by this page.

GET/v1/dogs/{dog_id}/head-to-head/{rival_id}

Held in this tab only, sent only to the API host. No key yet? Create a free sandbox key — it runs every endpoint against the sandbox data window.

Notes

Try it live on the sandbox page — this endpoint is included in the free tier.