# Subscriptions (https://raaqeb.dev/en/docs/api/subscriptions)

> The links that confirm a subscription and end it.

Each subscription has its own token in its confirm and unsubscribe links. Opening a link with a GET only leads to the subscription's page, where a button sends the POST that acts, so a mail scanner that follows links confirms and unsubscribes nobody.

## Confirm

**GET** `/subscriptions/{token}/confirm`

Lead to the subscription's page

Leads to the subscription's page, where the confirm button is; a GET changes nothing, so a mail scanner that opens links acts on none.

Parameters:

- `token` (path): `string` matching `^[A-Za-z0-9_-]{22}$`. The secret in the URL Raaqeb gave out: a heartbeat monitor's, shown in its Heartbeat URL panel, or a subscription's, in the links its subscriber was sent.

Responses:

- `303`: To the subscription's page, which says where the subscription stands. Headers: `location`.

**POST** `/subscriptions/{token}/confirm`

Confirm a subscription

Confirms a pending subscription while its link is younger than 48 hours.

Parameters:

- `token` (path): `string` matching `^[A-Za-z0-9_-]{22}$`. The secret in the URL Raaqeb gave out: a heartbeat monitor's, shown in its Heartbeat URL panel, or a subscription's, in the links its subscriber was sent.

Responses:

- `303`: To the subscription's page, which says where the subscription stands. Headers: `location`.
- `404`: No subscription has this token. Body: `text/plain` `Not Found`.
- `503`: The database is not open or did not answer. Body: `text/plain` `Service Unavailable`.

## Unsubscribe

**GET** `/subscriptions/{token}/unsubscribe`

Lead to the subscription's page

Leads to the subscription's page, where the unsubscribe button is; a GET changes nothing, so a mail scanner that opens links acts on none.

Parameters:

- `token` (path): `string` matching `^[A-Za-z0-9_-]{22}$`. The secret in the URL Raaqeb gave out: a heartbeat monitor's, shown in its Heartbeat URL panel, or a subscription's, in the links its subscriber was sent.

Responses:

- `303`: To the subscription's page, which says where the subscription stands. Headers: `location`.

**POST** `/subscriptions/{token}/unsubscribe`

Unsubscribe

Unsubscribes, whatever the subscription's state; an email client's one-click unsubscribe (RFC 8058) posts here with `List-Unsubscribe=One-Click`.

Parameters:

- `token` (path): `string` matching `^[A-Za-z0-9_-]{22}$`. The secret in the URL Raaqeb gave out: a heartbeat monitor's, shown in its Heartbeat URL panel, or a subscription's, in the links its subscriber was sent.

Responses:

- `200`: An email client's one-click unsubscribe (RFC 8058), which follows no redirect. Body: `text/plain` `Unsubscribed`.
- `303`: To the subscription's page, which says where the subscription stands. Headers: `location`.
- `404`: No subscription has this token. Body: `text/plain` `Not Found`.
- `503`: The database is not open or did not answer. Body: `text/plain` `Service Unavailable`.
