> For the complete documentation index, see [llms.txt](https://zumo.fusion.ac/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zumo.fusion.ac/documentation/guides/best-practices.md).

# Best practices

1. Always `GET /replays/{id}` before `replayRequest`.
2. Grant only the events you handle; avoid `*` on production keys.
3. Omit `query.mode` when waiting for `replayFinished`.
4. Ignore lifecycle events for other `replayId` / `requestId` values.
5. Download with `GET /replays/{id}/mcpr` (no key); use `HEAD` to check readiness.
6. Key/ACL changes may take \~60s to apply on Zed.
7. Subscribe to `replayRejected` and `replayFailed`, not only `replayFinished`.

```js
// Good: HTTP gate + filtered handlers
const check = await fetch(`${HUB_URL}/replays/${replayId}`, { headers });
if (check.status === 404 || check.status === 422) {
  socket.emit('replayRequest', { replayId, force: check.status === 422 });
}
```
