Skip to main content

Subscription Lifecycle

A subscription tells Ticksupply to record a specific datastream for your account. Once active, it produces the data you can later pull through the Exports API. This guide explains the subscription state machine, what each transition does, and how a subscription’s history of active periods (“spans”) determines what is exportable.

States

A subscription is always in exactly one of three states:
StateMeaning
activeData is being recorded. Exports for this subscription work within its recorded spans.
pausedRecording is stopped. Data captured in earlier spans remains exportable; no new data is collected.
deletedTerminal. The subscription is no longer visible in GET /v1/subscriptions and its recorded spans are gone.

Transitions

Each state change maps to a dedicated endpoint:
From → ToEndpointEffect on spansBilling-gated
(new)activePOST /v1/subscriptionsOpens a new span starting now.Yes
activepausedPOST /v1/subscriptions/{id}/pauseCloses the current span (ended_at = now).No
pausedactivePOST /v1/subscriptions/{id}/resumeOpens a new span starting now.Yes
any → deletedDELETE /v1/subscriptions/{id}All spans are removed.No
deletedactivePOST /v1/subscriptions with the same datastream_idReuses the same subscription ID, resets created_at, opens a fresh span. Prior spans are not restored.Yes
pause, resume, and delete are idempotent. Calling pause on an already-paused subscription (or resume on an already-active one) returns 204 No Content without changing anything. delete on an already-deleted subscription also succeeds without side effects.
Billing-gated transitions can return 402 payment_required — see Billing interactions.

State diagram

Spans drive exportable time ranges

A span is a single [started_at, ended_at] window during which the subscription was recording. Exports are always clipped to the intersection of their requested time range with your subscription’s spans.
StateCurrent spans
activeOne open span (ended_at is null) plus any closed spans from prior pause/resume cycles.
pausedAll spans are closed; the most recent ended_at marks when recording stopped.
deletedNo spans exist.
A subscription that has been paused and resumed will have multiple spans. Retrieve them in chronological order with GET /v1/subscriptions/{id}/spans:
cURL
curl -H "X-Api-Key: $TICKSUPPLY_API_KEY" \
  "https://api.ticksupply.com/v1/subscriptions/sub_019d5faefcce7d218eb2c52037ddb44d/spans"
[
  { "id": "spn_019c2a1b0f3b7abc9d4e5f6a7b8c9d0e1", "started_at": "2024-12-20T12:00:00Z", "ended_at": "2024-12-21T09:30:00Z" },
  { "id": "spn_019c4e8d1234abcd5678ef90123456789", "started_at": "2024-12-22T08:00:00Z", "ended_at": null }
]
The spans array on the POST /v1/subscriptions response is always []. Use GET /v1/subscriptions/{id}/spans right after creation to retrieve the initial open span.

Billing interactions

Three lifecycle-related endpoints can return 402 payment_required:
  • POST /v1/subscriptions — your plan has no room for another subscription, or the trial stream cap has been reached.
  • POST /v1/subscriptions/{id}/resume — resuming would re-enable recording on a plan that currently disallows it (for example, a suspended or past-due plan).
  • POST /v1/exports — billing rules deny the export (for example, the trial export cap has been reached).
pause and delete never return 402. See Error Handling for the full list of error codes.

Common questions

No. Deletion removes the subscription’s spans, and POST /v1/exports returns 403 permission_denied with the message "Subscription has been deleted". If you want to stop collection but keep the data exportable, pause the subscription instead.
The recorded history cannot be recovered. You can start a new recording for the same datastream by calling POST /v1/subscriptions with the original datastream_id — the API reuses the subscription’s ID, resets created_at, and opens a fresh span. Data captured before deletion is not accessible from the restored subscription.
Nothing is recorded. Pause closes the active span at the moment the call lands; resume opens a brand-new span. Exports that cross the gap skip that interval.
If an active or paused subscription already exists for that datastream_id, the API returns 409 already_exists. Only deleted subscriptions can be recreated through this path — that is the “restore” flow described above.
No. Only active subscriptions count toward stream quota. Resuming a paused subscription is subject to billing and trial-limit checks at the moment of resumption.
Last modified on April 17, 2026