Subscriptions
9 routes. Paths are relative to https://api.intersink.com/v1.
- POST/subscriptionsSubscribe
- GET/subscriptions/{id}Get one
- PATCH/subscriptions/{id}/cancelCancel
- PATCH/subscriptions/{id}/change-planChange plan
- GET/subscriptions/{id}/change-plan-previewPreview
- GET/subscriptions/{id}/historyHistory
- GET/subscriptions/checkCheck
- GET/subscriptions/meMe
- GET/subscriptions/subscribersSubscribers
Subscribe
POST/subscriptions
Needs a signed-in user (Bearer token or access_token cookie).
Subscribe (creates the single row OR reactivates/reuses it). A paid plan
needs payment_id of the caller's successful, unused payment for the
plan price (402 otherwise; 409 when already used).
Parameters
| Name | Type | Description |
|---|---|---|
| Idempotency-Key | string, header | Optional client-generated key (8-128 chars, [A-Za-z0-9_-]). A retry with the same key and body replays the first response (Idempotent-Replayed: true); 409 while the first is in flight; 422 if the body differs. |
Request body application/json
| Field | Type | Description |
|---|---|---|
| plan_idrequired | number | Minimum 1. |
| payment_id | string | Required for a plan with price > 0: a payments row of the caller with
status "success" and amount = the plan price, not used before. |
Response
201. The payload in data is not described in the spec yet.
Get one
GET/subscriptions/{id}
Needs a signed-in user (Bearer token or access_token cookie).
One subscription (subscriber or creator).
Parameters
| Name | Type | Description |
|---|---|---|
| idrequired | number, path |
Response
200. The payload in data is not described in the spec yet.
Cancel
PATCH/subscriptions/{id}/cancel
Needs a signed-in user (Bearer token or access_token cookie).
Cancel (Option A): immediate status → archived; access remains until period_end.
Parameters
| Name | Type | Description |
|---|---|---|
| idrequired | number, path |
Response
200. The payload in data is not described in the spec yet.
Change plan
PATCH/subscriptions/{id}/change-plan
Needs a signed-in user (Bearer token or access_token cookie).
Change plan (upgrade or downgrade). Mutates plan_id on the SAME row. When
the proration amount is > 0 it needs payment_id for exactly that amount.
Parameters
| Name | Type | Description |
|---|---|---|
| idrequired | number, path | |
| Idempotency-Key | string, header | Optional client-generated key (8-128 chars, [A-Za-z0-9_-]). A retry with the same key and body replays the first response (Idempotent-Replayed: true); 409 while the first is in flight; 422 if the body differs. |
Request body application/json
| Field | Type | Description |
|---|---|---|
| new_plan_idrequired | number | Minimum 1. |
| payment_id | string | Required when the change costs money (proration amount > 0): a successful, unused payment of the caller for exactly that amount. |
Response
200. The payload in data is not described in the spec yet.
Preview
GET/subscriptions/{id}/change-plan-preview
Needs a signed-in user (Bearer token or access_token cookie).
Proration preview for a plan change (read-only; matches change-plan).
Parameters
| Name | Type | Description |
|---|---|---|
| idrequired | number, path | |
| new_plan_idrequired | number, query | Minimum 1. |
Response
200. The payload in data is not described in the spec yet.
History
GET/subscriptions/{id}/history
Needs a signed-in user (Bearer token or access_token cookie).
The subscription's event timeline.
Parameters
| Name | Type | Description |
|---|---|---|
| idrequired | number, path | |
| page | number, query | Minimum 1. |
| limit | number, query | Minimum 1. |
Response
200. The payload in data is not described in the spec yet.
Check
GET/subscriptions/check
Needs a signed-in user (Bearer token or access_token cookie).
Am I subscribed to a creator? ?creator_user_id=<uuid>.
Parameters
| Name | Type | Description |
|---|---|---|
| creator_user_idrequired | string, query |
Response
200. The payload in data is not described in the spec yet.
Me
GET/subscriptions/me
Needs a signed-in user (Bearer token or access_token cookie).
The caller's single subscription (+ plan), or null.
Response
200. The payload in data is not described in the spec yet.
Subscribers
GET/subscriptions/subscribers
Needs a signed-in user (Bearer token or access_token cookie).
My subscribers (as a creator).
Parameters
| Name | Type | Description |
|---|---|---|
| page | number, query | Minimum 1. |
| limit | number, query | Minimum 1. |
Response
200. The payload in data is not described in the spec yet.