# Annotations API

> POST /api/v1/annotations marks a change under the traffic chart from a deploy script or CI, so a rise or a fall has its reason beside it.

Source: https://mettr.app/docs/annotations-api

Under the traffic chart, the dashboard shows what may explain a rise or a fall: alerts that fired, deploys, Google's search updates, anomalies, and changes you note. Note one by hand on the chart, or send it with a secret key:

```bash
curl https://mettr.app/api/v1/annotations \
  -H "Authorization: Bearer $METTR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"title": "Pricing page redesign", "url": "https://github.com/acme/site/pull/412"}'
```

```json
{"id": 318}
```

## Fields

| Field | Type | What it is |
|---|---|---|
| `title` | string | Required. What changed, up to 120 characters |
| `url` | string | A link to it (the pull request, the release, the campaign), http or https, up to 500 characters. Tokens and signatures in it are taken out before it is kept |
| `ts` | string | When it happened, ISO 8601. Now when left out; at most a day ahead |

Nothing else: an unknown field is refused with `422`, so a typo in a script fails where you see it. 60 a minute; a site keeps up to 20,000.

## Deploys

For deploys there is a better way than a script: a deploy hook reads your repository's own webhook (GitHub, GitLab, Bitbucket) or takes one request from your CI, and notes the commit, its author and its branch. See [Deploys](/docs/deploys).
