---
title: Your first scoreboard
section: Guides
order: 1
---

# Your first scoreboard

Ten minutes from nothing to a screen at the field entrance that shows the score, who holds which
zone and the time left, and a Discord message when a zone falls. You need to be the game master of
the game (or ask them for a key).

## 1. Make a dashboard key

On [gridtac.com](https://gridtac.com), signed in with two-factor on (or with Google or Apple), open
**API & hardware → API keys** in the account menu, top right, and create a **Dashboard** key for your game. Copy it now: it is shown once.
It starts with `gt_dash_` and can read only what every spectator may see.

Check it:

```sh
curl -s https://api.gridtac.com/api/v1/whoami -H "Authorization: Bearer gt_dash_…"
```

```json
{ "keyId": "…", "kind": "dash", "label": "Scoreboard", "gameId": "…", "teamId": null }
```

Keep the key on a server, never in a web page that visitors can open. If all you want is a screen,
the game master can make a **spectator link** instead (the game's settings, Map permissions): no key,
no code, a URL you open on the TV ([Spectator link](../api/dashboard.md#spectator-link)).

## 2. Read the game

```sh
curl -s https://api.gridtac.com/api/v1/dashboard -H "Authorization: Bearer gt_dash_…"
```

You get the phase, the teams and their points, the zones with their owner, the latest moments and
the server time. It is rebuilt at most every 5 seconds, so poll every 5 to 15 seconds; the
`RateLimit-Remaining` header says how much room you have left ([rate limits](../api/authentication.md#rate-limits)).

A minimal page in Node, served on your own box:

```js
import http from 'node:http';

const KEY = process.env.GRIDTAC_KEY; // gt_dash_…

http.createServer(async (_req, res) => {
  const r = await fetch('https://api.gridtac.com/api/v1/dashboard', { headers: { authorization: `Bearer ${KEY}` } });
  const d = await r.json();
  const left = d.game.endsAt ? Math.max(0, Date.parse(d.game.endsAt) - Date.parse(d.serverTime)) : null;
  const rows = d.teams.map((t) => `<li style="color:${t.color}">${t.name}: ${t.points ?? 'hidden'}</li>`).join('');
  const zones = d.zones.map((z) => `<li>${z.name}: ${d.teams.find((t) => t.id === z.ownerTeamId)?.name ?? 'nobody'}</li>`).join('');
  res.setHeader('content-type', 'text/html; charset=utf-8');
  res.end(`<meta http-equiv="refresh" content="15"><h1>${d.game.name}</h1>
    <p>${d.game.phase}${left !== null ? `, ${Math.round(left / 60000)} min left` : ''}</p>
    <ul>${rows}</ul><h2>Zones</h2><ul>${zones}</ul>`);
}).listen(8080);
```

Draw countdowns from `serverTime`, not from the viewer's clock. `points` is `null` for every team
when the game master hides the score.

## 3. Get pushed when a zone falls

Polling is fine for a screen. For a bot, let GridTac call you:

```sh
curl -s https://api.gridtac.com/api/v1/webhooks \
  -H "Authorization: Bearer gt_dash_…" -H "content-type: application/json" \
  -d '{ "url": "https://bot.example.com/gridtac", "events": ["zone_captured"] }'
```

Store the `secret` (`whsec_…`) from the answer. Every delivery is a `POST` with the event in the body
and a `GridTac-Signature` header; check the signature, answer `2xx` within 5 seconds, then post
`event.summary` ("Blue took ALPHA") to your Discord channel. How to check the signature, retries and
the delivery log: [Webhooks](../api/webhooks.md).

## Where next

- A team's own board, with that team's positions and orders: [Team view](../api/team.md) and a
  `gt_team_` key.
- Your own device as a player: [Player view](../api/play.md).
- Hardware: [Build a prop](build-a-prop.md).
- Every endpoint: [API reference](../api/reference.md). Every error: [Errors](../api/errors.md).
