# الاشتراكات (https://raaqeb.dev/docs/api/subscriptions)

> الرابطان اللذان يؤكدان الاشتراك وينهيانه.

لكل اشتراك رمزه الخاص في رابطي التأكيد وإلغاء الاشتراك. لا يفعل فتح الرابط بطلب GET إلا أن يقود إلى صفحة الاشتراك، وفيها زر يرسل طلب POST الذي ينفّذ الإجراء، فلا يؤكد ماسح البريد الذي يتبع الروابط اشتراك أحد ولا يلغيه.

## التأكيد

**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.

المعلَمات:

- `token` (المسار): `string` يطابق `^[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.

الاستجابات:

- `303`: To the subscription's page, which says where the subscription stands. الترويسات: `location`.

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

Confirm a subscription

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

المعلَمات:

- `token` (المسار): `string` يطابق `^[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.

الاستجابات:

- `303`: To the subscription's page, which says where the subscription stands. الترويسات: `location`.
- `404`: No subscription has this token. المحتوى: `text/plain` `Not Found`.
- `503`: The database is not open or did not answer. المحتوى: `text/plain` `Service Unavailable`.

## إلغاء الاشتراك

**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.

المعلَمات:

- `token` (المسار): `string` يطابق `^[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.

الاستجابات:

- `303`: To the subscription's page, which says where the subscription stands. الترويسات: `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`.

المعلَمات:

- `token` (المسار): `string` يطابق `^[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.

الاستجابات:

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