Webhooks are available on Pro and Data. Register an HTTPS endpoint, choose the events, and the API sends a signed POST when a match finishes, a confirmed lineup is published, or a fixture is postponed, cancelled or awarded.
Every request carries X-PitchAPI-Signature: t=<unix>,v1=<hex>, an HMAC-SHA256 over the timestamp and the raw body with the endpoint's whsec_ secret. Verify it before parsing, and reject an old timestamp so a captured request cannot be replayed.
Delivery is retried on your server's failures with a widening schedule, and twenty consecutive failures disable the endpoint. A delivery log lists what was sent, and a redeliver endpoint replays one. Only HTTPS on a public address is accepted — loopback, private ranges and the cloud metadata address are refused at registration and again at dial time.
Webhooks
Instead of polling, register a URL and we POST to it when something changes. Included in Pro and Data. Endpoints are managed at /v1/webhook-endpoints with your key, or from the account page if you are signed in.
Deliveries are at least once: a retry can repeat an event, so make your handler idempotent on the id field — it is opaque, stable for the event, and never an internal identifier. Ordering is not guaranteed across events.
Events
| Type | Fires when |
|---|---|
match.finished | A match reaches full time. Once per match — a re-ingest does not repeat it. |
match.lineups | A confirmed team sheet is published. A correction before kickoff fires again; a prediction never does. |
match.status | A fixture is postponed, cancelled or awarded. |
The request
A JSON body and five headers. data is exactly what the matching REST call returns: GET /v1/matches/{id} for match.finished and match.status, and GET /v1/matches/{id}/lineups for match.lineups, so one decoder handles both the response and the push.
POST /hooks/pitchapi HTTP/1.1 Content-Type: application/json User-Agent: PitchAPI-Webhooks/1 (+https://pitchapi.dev) X-PitchAPI-Event: match.finished X-PitchAPI-Delivery: 1 X-PitchAPI-Timestamp: 1795812300 X-PitchAPI-Signature: t=1795812300,v1=5f1c...9ab0 {"id":"evt_2Fq7Lm","type":"match.finished","created_at":"2026-11-28T21:05:00Z","api_version":"2026-11-28","data":{"id":"m_2mT4V5","status":"finished","score_home":3,"score_away":2}}
Verifying the signature
The signed message is timestamp + "." + raw body, HMAC-SHA256 with the endpoint's whsec_ secret. Compare in constant time, and reject a timestamp more than five minutes old so a captured request cannot be replayed. Use the raw bytes: re-serialising the JSON changes them.
import hmac, hashlib, time
def verify(secret: str, header: str, body: bytes) -> bool:
parts = dict(p.split("=", 1) for p in header.split(","))
ts = int(parts["t"])
if abs(time.time() - ts) > 300:
return False
msg = f"{ts}.".encode() + body
expected = hmac.new(secret.encode(), msg, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts["v1"])import { createHmac, timingSafeEqual } from "node:crypto";
export function verify(secret: string, header: string, body: string) {
const parts = Object.fromEntries(
header.split(",").map((p) => p.split("=")),
);
const ts = Number(parts.t);
if (Math.abs(Date.now() / 1000 - ts) > 300) return false;
const expected = createHmac("sha256", secret)
.update(`${ts}.${body}`)
.digest("hex");
return timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
}func verify(secret, header string, body []byte) bool {
var ts int64
var got string
for _, p := range strings.Split(header, ",") {
k, v, _ := strings.Cut(p, "=")
switch k {
case "t":
ts, _ = strconv.ParseInt(v, 10, 64)
case "v1":
got = v
}
}
if time.Since(time.Unix(ts, 0)).Abs() > 5*time.Minute {
return false
}
mac := hmac.New(sha256.New, []byte(secret))
fmt.Fprintf(mac, "%d.", ts)
mac.Write(body)
want := hex.EncodeToString(mac.Sum(nil))
return hmac.Equal([]byte(want), []byte(got))
}Retries and failure
- Any 2xx is success. A delivery is retried after 10 s, 1 m, 5 m, 15 m, 1 h, 4 h, 12 h and 24 h, then buried.
410 Goneis treated as permanent and not retried — use it when the endpoint will never accept anything again.- Twenty consecutive failed deliveries disable the endpoint. It stays disabled until you set
active: truefrom the account page or byPATCH, which also clears the count. GET /v1/webhook-endpoints/{id}/deliveriesshows the last 50 attempts with the status code each one received, and.../deliveries/{deliveryID}/redeliverqueues one again.- URLs must be HTTPS and publicly routable. Loopback, private ranges and the cloud metadata address are refused, redirects are not followed, and the address is checked again when the connection is made.
Endpoints
Every request takes an X-API-KEY header and returns the JSON envelope described on the overview.
List webhook event types
The three events the API emits, with what each one means.
curl https://api.pitchapi.dev/v1/webhook-endpoints/event-types \
-H "X-API-KEY: $PITCH_KEY"Create a webhook endpoint
Registers a URL for one or more event types. The response carries the signing secret once — it is never shown again; rotate it if it is lost.
curl -X POST https://api.pitchapi.dev/v1/webhook-endpoints \
-H "X-API-KEY: $PITCH_KEY"List webhook endpoints
Every endpoint on the account with its health: whether it is active, how many deliveries in a row have failed, and when it was disabled if it was.
curl https://api.pitchapi.dev/v1/webhook-endpoints \
-H "X-API-KEY: $PITCH_KEY"Update a webhook endpoint
Change the URL, description or subscribed events, or set active to false to pause deliveries. Setting active to true clears the failure count.
curl https://api.pitchapi.dev/v1/webhook-endpoints/{id} \
-H "X-API-KEY: $PITCH_KEY"Delete a webhook endpoint
Removes the endpoint and its delivery history. Answers 204 with no body.
curl https://api.pitchapi.dev/v1/webhook-endpoints/{id} \
-H "X-API-KEY: $PITCH_KEY"Rotate the signing secret
Issues a new secret. Deliveries signed with the old one stop verifying immediately, so deploy the new value before rotating.
curl -X POST https://api.pitchapi.dev/v1/webhook-endpoints/{id}/secret \
-H "X-API-KEY: $PITCH_KEY"List recent deliveries
The last 50 delivery attempts for an endpoint, with the status code and error each one received. This is how you debug a receiver without guessing.
curl https://api.pitchapi.dev/v1/webhook-endpoints/{id}/deliveries \
-H "X-API-KEY: $PITCH_KEY"Redeliver an event
Queues one delivery for another attempt now, resetting its attempt count. Answers 202.
curl -X POST https://api.pitchapi.dev/v1/webhook-endpoints/{id}/deliveries/{deliveryID}/redeliver \
-H "X-API-KEY: $PITCH_KEY"Common questions
- How do I verify a webhook signature?
- Compute HMAC-SHA256 over the string
<t>.<raw body>with the endpoint secret and compare it to thev1value inX-PitchAPI-Signature. Use the raw body, not a re-serialised object, and reject timestamps outside your tolerance. - What happens when my endpoint is down?
- Delivery is retried on a widening schedule. Twenty consecutive failures disable the endpoint, and the delivery log shows what was attempted. Failures caused by the API rather than your server do not count as strikes.