POST /external-checkout/subscription-status
For integrations where you own all billing (e.g. a store that runs WooCommerce Subscriptions, or a billing platform like Stripe Billing): when your billing system puts a subscription on hold, tell kurnl to suspend the port; when it becomes active again, tell kurnl to restore it. When the customer leaves, tell kurnl to cancel it.
The call works for every line of your provider account, however it was ordered — through your own checkout, a provider-initiated order, the marketplace or the dashboard. Suspend and restore create no kurnl invoices or fees: kurnl only performs the network action. A cancel creates none on a line you bill. On a line kurnl bills, a cancel settles the month as a cancellation in the dashboard does (see Billing).
Endpoint
POST /partner/external-checkout/subscription-statusAuthentication
X-Webhook-Secret header — same secret as the other external-checkout endpoints.
Request body
Identify the subscription in one of three ways:
- A —
session_id: the original checkout session. - B —
subscription_id+service_provider_document_id: kurnl’s own identifier, as returned by the completion call. - C —
external_subscription_id+service_provider_document_id: your own per-subscription identifier, the same value you sent asexternal_subscription_idwhen you completed the checkout.
{ "action": "suspend | restore | cancel", "end_date": "YYYY-MM-DD (cancel only, optional)", "reason": "text (cancel only, optional)", "session_id": "uuid (option A)", "subscription_id": "uuid (option B)", "external_subscription_id": "your id (option C)", "service_provider_document_id": "uuid (options B and C)"}Response — 200 OK
{ "subscription_id": "uuid", "action": "suspend", "subscription_status": "SUSPENDED", "port_changed": true, "port_error": null, "message": "Suspended"}suspendresets the switch port to the captive portal, marks the subscriptionSUSPENDED, and setsis_active: false. That applies to anACTIVEsubscription.- Before the install,
suspendholds the technician visit instead and answers200withsubscription_status: "PENDING_INSTALL". A home-drop order isPENDING_INSTALLuntil the technician has been, so this is the ordinary case, not an error: kurnl cancels any booked visit, releases the slot and stops the booking link. The subscription is not markedSUSPENDED— it was never installed.restorelifts the hold and sends a fresh booking link, again answering200withPENDING_INSTALL. - A
CANCELLEDorTERMINATEDsubscription cannot be suspended — see the409below. - Read
subscription_statusfrom the response rather than assuming the action implies a status; before the install both directions reportPENDING_INSTALL. restoreonly reverses a suspend: it queues port re-provisioning, marks the subscriptionACTIVE, and clears kurnl’s dunning/deprovision markers (disconnection notice, exception flag, deprovisioned-at). A subscription in any status other thanSUSPENDEDcannot be restored — see the409below.restoreis all-or-nothing. If kurnl cannot re-open the port — missing switch port, VLAN or plan bandwidth — it returns409naming what is missing and changes nothing: the subscription staysSUSPENDED. It will never reportACTIVEover a port the suspend left on the captive portal. Retry once the underlying data is fixed (ask kurnl operations).- Repeating a call for a subscription already in the target state (suspend an
already-
SUSPENDED, restore an already-ACTIVE) is an idempotent200withport_changed: falseand an “Already …” message.
Cancelling a line
cancel ends the subscription. It is the partner twin of the customer’s own cancel, and it
sends you subscription.cancelled (and later subscription.deprovisioned) as a
webhook.
end_date(optional,YYYY-MM-DD) is the first day without service, in your provider’s local day. The line runs through the day before it."end_date": "2026-11-01"means the last day of service is 31 October. Leave it out and the line ends today.- Today on a live line (
end_dateis today, or left out) means the service runs through today. kurnl’s deprovisioner, which runs every hour, switches it off within the hour after local midnight. - A line not yet installed (
PENDINGorPENDING_INSTALL) ends at once. Its port stays reserved. - A date in the past is refused with
422(“The earliest cancellation date is today, …”). reason(optional, up to 200 characters, defaultpartner_cancelled) is kept as the cancellation reason and comes back ascancellation_reasonin the webhook.- The response carries
ended_at, the cut-off instant: midnight at the start of theend_dateday in your provider’s local time zone, given in UTC (an ISO 8601 timestamp with offset+00:00; for a provider in Vancouver,end_date2026-11-01 is2026-11-01T07:00:00+00:00). The hourly deprovisioner switches the line off within the hour after that instant.subscription_statusis"CANCELLED".port_changedisfalse: the switch is reset when the line is deprovisioned. - Cancelling a line that is already cancelled answers
409and sends no second webhook. A request that arrives while another change to the same line is still running (a secondcancel, or a cancellation from the dashboard) answers409action_in_progressand changes nothing.
Request:
{ "action": "cancel", "external_subscription_id": "your-internal-id-123", "service_provider_document_id": "uuid", "end_date": "2026-11-01", "reason": "customer moved out"}Response:
{ "subscription_id": "uuid", "action": "cancel", "subscription_status": "CANCELLED", "port_changed": false, "port_error": null, "ended_at": "2026-11-01T07:00:00+00:00", "message": "Cancelled; the last day of service is 2026-10-31"}Reading port_changed and port_error
port_changed |
port_error |
Meaning |
|---|---|---|
true |
null |
The network action was performed (or queued, for restore). |
false |
set | Suspend only: the switch action was attempted and failed — the port may still be live. kurnl operations is alerted; the subscription status was still updated. |
false |
null |
No network action was attempted. Suspend only: no switch/port data. A restore that cannot act now fails with 409 instead of returning this. |
Error codes
| Status | Meaning |
|---|---|
401 |
Missing or invalid X-Webhook-Secret |
403 |
Subscription belongs to a different provider |
404 |
Session not found, Subscription not found, or No subscription for this external_subscription_id |
409 |
Session has no subscription yet (checkout not completed) |
409 |
Cannot suspend a subscription in status '…' — suspend only applies to an ACTIVE subscription (ACTIVE → SUSPENDED). Not raised for PENDING_INSTALL, which is held instead. |
409 |
Cannot restore a subscription in status '…' — restore only reverses a suspend (SUSPENDED → ACTIVE). |
409 |
Cannot restore subscription …: the port cannot be re-provisioned (… missing). The subscription stays SUSPENDED. |
409 |
Cancel only: {"detail": {"code": "already_cancelled", "message": "This subscription is already cancelled."}}. Unlike the other 409s, detail is an object here, so read detail.code. |
409 |
{"detail": {"code": "action_in_progress", "message": "…"}} (suspend, restore, cancel) — another change to the same line is still running; nothing was changed. Retry in a few minutes. |
410 |
Session expired or cancelled |
422 |
Cancel only: end_date is before today — The earliest cancellation date is today, <date>. |
422 |
None of the three identification options provided |
429 |
Rate limit exceeded (120 requests / minute) |