CKO-04: Provider-Initiated Provisioning
When to use this
Use CKO-04 when:
- Your customers buy on your own website — your funnel, your cart, your payment provider
- You are an incumbent or existing ISP bringing your own subscribers to the kurnl network
- You bill your customers yourself — or you let kurnl bill them from the card your storefront saved (see Who bills)
- You want to provision subscribers programmatically from your own back-office system without a marketplace flow
You never create a kurnl checkout session on this path. Sessions belong to marketplace-originated checkout (CKO-03), where kurnl resolves the address and hands the shopper to you.
CKO-04 is the simplest integration path if you already have subscriber relationships and just need kurnl to activate the network port.
How it works
Three calls from your storefront, then one to provision:
GET /partner/serviceability/autocomplete?q=… what the customer typesPOST /partner/serviceability/check -> building_id + the plans you can sellGET /partner/serviceability/units?building_id= -> the suites, each with `available` and `cpe_ready`POST /partner/provisioning/provider-initiated -> the orderThe last call does everything kurnl-side:
- Creates the subscriber record in kurnl (or reuses an existing account by email)
- Creates the subscription
- Either provisions the switch port via SSH (VLAN, bandwidth, optional MAC binding),
or raises an install job for a technician — decided by the building’s line type
and whether the suite’s router is already online, not by you. The response’s
routesays which.
There is no marketplace redirect, no kurnl checkout session, and no webhook required on your side (though you can configure one to receive provisioning status). Whether kurnl also bills the subscription is your call, per order — see Who bills.
Making the call
curl -X POST https://middleware.kurnl.ca/partner/provisioning/provider-initiated \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "plan_version_id": "f7e8d9c0-b1a2-3456-cdef-012345678901", "location_hash": "ab12cd34ef", "subscriber": { "email": "carol@example.com", "username": "carol", "mac_address": "BB:CC:DD:EE:FF:00", "invoice_contact_detail": { "firstname": "Carol", "lastname": "White", "email": "carol@example.com", "phonenumber": "+16045559876" }, "contract_contact_detail": { "firstname": "Carol", "lastname": "White", "email": "carol@example.com" }, "invoice_address": { "street": "Pine Rd", "housenumber": "88", "postalcode": "C3D 4E5", "city": "Kelowna", "province": "BC", "country": "Canada" } } }'Successful response — 200 OK:
{ "job_id": "5a7c9e11-...", "subscription_id": "2b4d6f80-...", "subscriber_id": "1c3e5a79-...", "message": "Provisioning started", "route": "provision", "billing_owner": "partner", "unit_confirmation_pending": false}On the install route job_id is null, route is "install", and the
subscription is PENDING_INSTALL until a technician calls
POST /provisioning/confirm-install.
A suite with several connections (a postal_unit on its units entry) on a first-line building is the exception: the order is accepted and held, the response carries "job_id": null and "unit_confirmation_pending": true (route stays "provision"), and nothing is provisioned — and no subscription.activated webhook fires — until the kurnl operator confirms which connection is the customer’s. See Shared suites.
The port is provisioned asynchronously. Poll the job or wait for the provisioning.completed webhook.
Retries are safe (idempotent). A repeat call for the same (subscriber email, plan version, location) triple returns 200 with the existing subscription instead of creating a duplicate — message is "Provisioning already in progress" (a job is still running) or "Subscription already exists (idempotent replay)", and job_id may be an empty string on a replay, so treat it as optional. The same subscriber + plan at a different location provisions a second line normally. A SUSPENDED subscription counts as existing. Any other live order on the same port — another subscriber’s, or another plan version — is refused with 409 port_in_use.
Rate limit: 120 requests/minute per API key.
Errors
| Status | Meaning |
|---|---|
400 |
Plan version not active / not yet active · location has no switch · unparseable port · provider has no VLAN · plan missing download_speed_mbps |
401 |
Missing or invalid X-API-Key |
403 |
Plan version does not belong to your service provider · API access is not enabled for this account |
404 |
Plan version or location not found |
422 |
Invalid location_hash format · request-body validation |
400 |
The sign-in service refused subscriber.password; the message gives its reason. Only for a new account; nothing was created — send again with another password |
422 |
{"detail": {"code": "speed_tier", "message": "…", "speed_tier_mbps": 1000, "speed_tier_scope": "unit", "plan_download_mbps": 1500}} — the plan is faster than the line delivers; nothing was created. speed_tier_scope is "unit" when the unit’s own cap refused it (compare speed_tier_mbps of the unit in serviceability units), "building" for the building’s tier |
422 |
{"detail": {"code": "plan_audience", "message": "<Plan> is for existing customers — change your plan from your account.", "target_audience": "EXISTING_SUBSCRIBERS"}} — a plan for existing customers only is not listed and not orderable; nothing was created |
503 |
Could not verify the building's speed tier; try again. — retryable, nothing was created |
422 |
{"detail": {"code": "not_covered", "message": "This building is not covered by <provider>. …", "building_id": "…"}} — your provider does not cover the building (no ticked division, picked building or contract); nothing was created |
503 |
Could not verify the building's coverage; try again. · Could not read the line's building; try again. — retryable, nothing was created |
422 |
{"detail": {"code": "plan_not_offered", "message": "<Plan> is not offered in this building.", "building_id": "…"}} — your provider does not offer this plan in the building (no plan selection on the building, its division or its province includes this plan). Nothing was created |
503 |
Could not verify the building's plan offer; try again. — retryable, nothing was created |
409 |
no_free_connection — every connection of the shared suite is taken; offer another suite |
409 |
billing_not_available: … · stripe_customer_in_use: … — you asked kurnl to bill and it cannot set that up; see Who bills |
422 |
stripe_customer_not_found: … · stripe_customer_has_no_payment_method: … — the Stripe customer you named cannot be charged |
502 |
stripe_unavailable: … — Stripe could not be reached during the billing pre-flight; retry |
429 |
Rate limit exceeded |
500 / 502 |
Provisioning failed / upstream configuration errors — safe to retry (idempotent, see above) |
Naming the premise
Every order has to say where. There are two ways, and which one you can use depends on what you know about the customer.
A unit — for a storefront (delivery_mode: "home_drop")
A shopper typing their address into your site has no way to know their switch port, and neither do you. Ask them for their address and suite instead:
POST /serviceability/checkwith the address → abuilding_id.GET /serviceability/units?building_id=…→ the suites, each withavailableandcpe_ready.POST /provisioning/provider-initiatedwithdelivery_mode: "home_drop"and the chosenunit_id.
Render unavailable suites disabled rather than hiding them, and trust available
rather than anything else you may have cached about a unit. A suite with several
connections is one entry (postal_unit set) and is unavailable only when all its
connections are taken.
cpe_ready: true means the suite’s router is already online. On a second- or third-line
building such an order is provisioned at once, without a visit, so you can tell the
shopper that the line starts today. Treat it as a hint, not a promise: branch your
confirmation on the response’s route.
A port — for a migration (delivery_mode: "direct", the default)
A location_hash identifies a physical switch port. You get one of two ways:
- From your provisioning records — if you mapped your subscriber addresses to kurnl location hashes during onboarding
- From the kurnl dashboard — look up the port in Dashboard → Network and copy the location hash
For large migrations, use Bulk Provisioning to supply a CSV of addresses and location hashes.
Provision or install — the building decides
delivery_mode states what you have. The building’s line type, and outside first
line whether the suite’s router is already online, decides what happens. A request that
does not fit it is refused with 422 rather than half-completed:
| Building | You sent a unit | You sent a port |
|---|---|---|
| First line (wired) | Provisioned on the suite’s port — held for the operator’s confirmation when the suite has several connections; 409 suite_not_wired when no port is wired |
Port provisioned immediately |
| Second / third line | Provisioned on the suite’s port when its router is online (suite of one); otherwise install job | 422 — a technician has to go there; kurnl will not provision blind |
| Unclassified | Install job, even when the suite’s router is online | 422 |
A router counts as online when it answered within the last 15 minutes; kurnl checks this
when your order arrives, and takes the install path when it cannot read the router’s
state. cpe_ready on /serviceability/units shows the same state before the customer
chooses, but it is a snapshot: the order can still come back as install.
Read route in the response (provision or install) and branch your confirmation
screen on it — never on the presence of job_id, which is also empty on an
idempotent replay.
Who bills: you, or kurnl
By default you bill the subscriber. kurnl creates no Stripe records and no invoices for the order — it
tracks the subscription for network management (deprovisioning on cancellation, reporting) and never charges
anyone. That is billing.owner: "partner", and it is what every order without a billing block gets.
If your storefront has already put the customer into your Stripe account and saved a card there, you can
hand the billing to kurnl instead. Add a billing block at the top level of the order, next to
plan_version_id:
"billing": { "owner": "kurnl", "stripe_customer_id": "cus_Qx7…", "billing_day": 1}| Field | Required | Meaning |
|---|---|---|
owner |
no | "partner" (default) or "kurnl" |
stripe_customer_id |
with kurnl |
The customer in your Stripe account — the one whose card your storefront saved. kurnl resolves the payment method itself; do not send one. |
billing_day |
no | 1–31, default 1 — the day of the calendar month kurnl charges on. With owner: "kurnl", a day above the provider’s Latest billing day (default 10) is refused 422 with Choose a billing day from 1 to N.; for partner-billed orders the day is stored as sent. |
What your storefront has to do
- Create the customer and save the card in your Stripe account — the one connected to kurnl. kurnl never creates a customer or a payment method for a CKO-04 order.
- Save the card for use without the customer present: a SetupIntent with
usage: "off_session"(or a payment withsetup_future_usage: "off_session"). kurnl cannot check this — a card saved without it fails its first monthly charge with an authentication requirement, and the customer is then sent a payment link (by the provider’s rules). - Do not charge the first period yourself. kurnl does (below).
What kurnl checks before it writes anything
With your key, kurnl verifies that it will be able to bill later — and refuses the order otherwise. On a refusal nothing is created; fix the cause and resend.
| Error | Status | Meaning |
|---|---|---|
billing_not_available |
409 | Your provider has no Stripe connection or no invoicing configured in kurnl. Ask your kurnl contact; until then, order partner-billed. |
stripe_customer_not_found |
422 | No such customer in your Stripe account — also a customer from another account, a test-mode id against a live key, or a deleted customer. |
stripe_customer_has_no_payment_method |
422 | Nothing kurnl could charge: no default payment method and no card, a method attached to a different customer, or an expired card. |
stripe_customer_in_use |
409 | Another subscriber already carries this customer, or this subscriber is already bound to a different one. A replay of the same order with a different stripe_customer_id ends here. |
stripe_unavailable |
502 | Stripe could not be reached. Retry. |
detail starts with the code, followed by a human-readable reason — match on the prefix.
What kurnl does then
kurnl adopts the customer and its default payment method (else the first attached card) onto the subscriber,
records billing_owner: "kurnl" on the subscription, and bills it exactly the way it bills a marketplace
order:
- At activation — when the port is live (
route: "provision"), or when the technician completes the install (route: "install") — kurnl issues the first invoice: the plan’s setup fee plus the current month prorated from that day to month end, and charges the saved card. - Every following month the recurring invoice falls on
billing_dayand is charged to the same card. AutoPay is on. - The subscriber sees the card, AutoPay and every invoice in the self-service portal; the provider’s lifecycle e-mails (invoice issued, payment failed, reminders) go out; and a failed charge enters the provider’s dunning and grace policy, which can end in auto-cutoff. If you hand billing to kurnl, this is what your customer experiences — say so in your own terms.
Nothing is charged at order time. The response tells you what kurnl recorded:
{ "job_id": "5a7c9e11-...", "subscription_id": "2b4d6f80-...", "subscriber_id": "1c3e5a79-...", "message": "Provisioning started", "route": "provision", "billing_owner": "kurnl"}Cancellation
When a subscriber’s service ends, cancel the line with the partner API’s
subscription-status call. It authenticates with
your X-Webhook-Secret and addresses the line by the subscription_id this call returned:
curl -X POST https://middleware.kurnl.ca/partner/external-checkout/subscription-status \ -H "X-Webhook-Secret: YOUR_WEBHOOK_SECRET" \ -H "Content-Type: application/json" \ -d '{ "action": "cancel", "subscription_id": "uuid", "service_provider_document_id": "uuid", "end_date": "2026-10-01", "reason": "Moving out" }'end_date is the first day without service; leave it out and the line ends today. What a cancel does to the
port, the webhooks it sends, what it bills on a line kurnl bills, and its errors are on the
subscription-status reference. Your staff can also cancel a
line in the dashboard (see Handling customers day-to-day).
Field reference
| Field | Type | Required | Notes |
|---|---|---|---|
plan_version_id |
UUID | Yes | The plan version to activate |
delivery_mode |
"direct" | "home_drop" |
No | Default "direct". "home_drop" names a unit instead of a port. |
location_hash |
string (10 hex) | Yes* | Port location identifier — *required on direct (or location_identifier) |
location_identifier |
string | Yes* | Alternative to location_hash |
unit_id |
UUID | Yes† | †Required on home_drop. From GET /serviceability/units. |
subscriber.email |
string | Yes | Subscriber account email — existing accounts are reused |
subscriber.username |
string (min 3) | Yes | Display name |
subscriber.password |
string (min 8) | No | Only applied to new accounts |
subscriber.customer_type |
"RESIDENTIAL" | "BUSINESS" |
No | Default "RESIDENTIAL" |
subscriber.mac_address |
string | No | Enables port security |
subscriber.invoice_contact_detail |
object | Yes | firstname, lastname, email, optional phonenumber/company |
subscriber.contract_contact_detail |
object | Yes | Same shape — may equal invoice contact |
subscriber.invoice_address |
object | Yes | street, housenumber, postalcode, city, province, optional country (default "Canada") |
billing.owner |
"partner" | "kurnl" |
No | Default "partner". "kurnl" hands the billing to kurnl — see Who bills. |
billing.stripe_customer_id |
string | Yes‡ | ‡Required with owner: "kurnl". The customer in your own Stripe account. |
billing.billing_day |
integer 1–31 | No | Default 1. The day of the calendar month kurnl charges on. With owner: "kurnl", a day above the provider’s Latest billing day is refused 422: Choose a billing day from 1 to N.; partner-billed orders are not checked. |