> ## Documentation Index
> Fetch the complete documentation index at: https://docs.molesignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Rotate a source token

> Give an alert source a new token; the old one stops working at once.

```http theme={null}
POST /api/v1/alerts/sources/{id}/token
```

Gives an [alert source](https://docs.molesignal.com/en-US/alerting/sources.md) a new token. It requires `alerts.sources.manage`, and the body is empty. The old token stops working at once; with federation on, it stops working on the other clusters once the change syncs. Senders still using the old token need the new one.

```bash cURL theme={null}
curl -X POST http://localhost:5080/api/v1/alerts/sources/$SOURCE_ID/token \
  -H "authorization: Bearer $MS_TOKEN"
```

The response is the source with the new `token`, which appears only this once.

```json 200 theme={null}
{
  "id": "3KEJ1mZqf0bY0b8XUgD4tkd2Vwq",
  "name": "Production Prometheus",
  "kind": "alertmanager",
  "enabled": true,
  "escalation_policy_id": "default",
  "severity": "warning",
  "labels": { "team": "payments" },
  "token_prefix": "ms_aB3kZ1xT9pQrU7nM",
  "home_cluster": "",
  "intake_path": "/api/v1/intake/alerts",
  "created_by": "<user-id>",
  "created_at": 1790000000000000,
  "updated_at": 1790000000000000,
  "last_intake_at": null,
  "token": "<token>"
}
```

**Errors**

| Status | Cause |
| - | - |
| `403` | The token lacks `alerts.sources.manage`. |
| `404` | The source does not exist. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.