For Discord and Slack bots

A sports API for Discord bots. Post every play, then edit it when the call changes.

Live scores and plays for 10 leagues, with a stable id on every play. When replay changes a call, the same play arrives again as a new version, so your bot edits the message it already posted.

What a bot needs from the data

  • A stable id per play

    Every play keeps its id when it changes. Store the message id you posted against the play id, and edit it when a newer version arrives.

  • Nothing lost on restart

    Every change has a gapless seq. Save the last one you handled, and after a deploy or a crash resume from it to get exactly what you missed.

  • A small request budget

    One WebSocket connection carries all your subscriptions, up to 20 games or leagues on Pro, and you pay only for the changes it delivers: about 1,300 requests for a whole NFL game, a third of polling it every 3 seconds.

The touchdown that came back with its extra point

James Cook's touchdown in Bills at Vikings arrived at seq 1106. Five changes later, at seq 1111, the same play arrived as version 2 with the extra point added. A bot that posted the first version edits that message instead of posting a second one.

These two changes are cut from the game's journal, trimmed to the fields a bot uses. The full changes carry the whole play.

Subscribe from the last seq you handled
{ "type": "subscribe", "streams": ["game:01a1d60f-67be-7bdd-83f4-53286521d9bb"], "resume": { "game:01a1d60f-67be-7bdd-83f4-53286521d9bb": 1101 } }
changes.ndjson · seq 1106 and 1111, trimmedFull file
[
  {
    "seq": 1106,
    "op": "upsert",
    "entity_type": "play",
    "entity_id": "01a1d60f-a829-759c-a632-7e6eca90b7f0",
    "version": 1,
    "payload": {
      "description": "J.Cook up the middle for 5 yards, TOUCHDOWN.",
      "away_score": 19,
      "home_score": 6
    }
  },
  {
    "seq": 1111,
    "op": "upsert",
    "entity_type": "play",
    "entity_id": "01a1d60f-a829-759c-a632-7e6eca90b7f0",
    "version": 2,
    "payload": {
      "description": "J.Cook up the middle for 5 yards, TOUCHDOWN. T.Bass extra point is GOOD, Center-R.Ferguson, Holder-T.Doman.",
      "away_score": 20,
      "home_score": 6
    }
  }
]

Pricing

A bot that checks scores every few minutes fits Developer over REST. A bot that posts plays as they happen needs the stream, which starts at Pro.

Compare every limit
  • Developer

    $19 a month

    • 25,000 requests a month
    • 1 request a second, burst of 10
    • REST only, no WebSocket
  • Pro

    $49 a month

    • 150,000 requests a month
    • 10 requests a second, burst of 30
    • WebSocket: 5 connections, 20 subscriptions
  • Business

    $299 a month

    • 2,000,000 requests a month
    • 25 requests a second, burst of 100
    • WebSocket: 10 connections, 150 subscriptions

Questions

Does Statpad post to Discord for me?

No. Statpad is the data. Your bot posts and edits its own messages, through a webhook or the Discord API.

Can the bot run in the browser or on a phone?

Keep the API key on a server. A key draws on your whole account's allowance, so it doesn't belong in client code.

What if my bot is down for an hour?

Resume from the last seq you saved. A game's journal is kept for at least 7 days after it ends, so the stream replays everything you missed and carries on live.