Skip to content
Internal docs

Authentication

kurnl uses two authentication mechanisms. Which one you use depends on the direction of the API call.

API Key — your calls to kurnl

Use your API key when you are calling kurnl’s API directly (plan queries, address serviceability checks, provider-initiated and bulk provisioning, billing reports).

Send it in the X-API-Key header:

Terminal window
curl https://middleware.kurnl.ca/partner/marketplace/plans/me \
-H "X-API-Key: krnl_a1b2c3d4e5f6..."

API keys are scoped to your provider account. You cannot access another provider’s subscribers or plans with your key.

Scopes

Every API key carries a set of scopes chosen when the key is created under Settings → API Key in the dashboard. A call outside the key’s scopes returns 403 with "API key is missing the required scope '<scope>'".

Scope Grants
plans:read GET /partner/marketplace/plans/me
provisioning:read Bulk batch status, provisioning job status
provisioning:write POST /provisioning/provider-initiated, POST /provisioning/bulk
billing:read GET /partner/reports/billing
agent The /partner/agent/* surface — offered once kurnl has enabled the agent API for your account (see Agent authentication)
leads:write POST /partner/leads — add waitlist leads from your storefront

Write implies read: a key holding provisioning:write also passes provisioning:read checks. Grant each integration only what it needs — a webshop key doesn’t need provisioning:write; a finance export needs only billing:read.

The external-checkout endpoints are not API-key-authenticated (they use the webhook secret, below) and therefore have no scope.

Keys created before scopes existed were migrated with all scopes — their behavior is unchanged. That migration predates leads:write: no existing key carries it, so create a new key with leads:write for your storefront.

Key format

Your API key is a production credential of the form krnl_<hex>. There is no separate sandbox key — the partner API operates on your live account. For safe, no-impact exploration use the in-dashboard sandbox instead.

Multiple keys & rotation

Keys are created, rotated and revoked under Settings → API Key in the dashboard: see Partner API keys for the limit, rotation without downtime and Last used. The delay before a revoked key stops everywhere comes from a per-process credential cache: revocation applies at once on the worker that serves the request, and on the other workers when their cache expires.

Rate limits

Endpoint group Limit
Provider-initiated provisioning & external-checkout callbacks (sessions, /complete, /anonymous-complete, /subscription-status) 120/min
POST /provisioning/bulk 10/min
GET /provisioning/bulk/{batch_id} 300/min
GET /reports/billing 30/min
GET /external-checkout/sessions/{id}/status 60/min
POST /serviceability/check 120/min
GET /serviceability/autocomplete 300/min

Exceeding a limit returns 429. No X-RateLimit-* headers are sent — pace your requests client-side.


Webhook Secret — kurnl’s calls to you (CKO-03)

The webhook secret is used for CKO-03 external checkout callbacks. When your checkout system calls kurnl’s /external-checkout/complete endpoint, kurnl looks up the secret for your service_provider_document_id and verifies the X-Webhook-Secret header before processing anything.

Terminal window
curl -X POST https://middleware.kurnl.ca/partner/external-checkout/complete \
-H "X-Webhook-Secret: your-pre-shared-secret" \
-H "Content-Type: application/json" \
-d '{ "service_provider_document_id": "...", ... }'

This secret is also used to sign outbound webhook events kurnl sends to your webhook_url, which you set under Billing → Checkout & Integrations › Partner webhooks. See Webhooks for signature verification.

Two behaviours worth knowing:

  • No secret configured → 401, not open access. Every webhook-secret endpoint rejects all calls until a secret is set on the Checkout page.
  • On session-based calls the provider comes from the session. For /complete, session read/PATCH, and session-based /subscription-status, kurnl resolves the provider from the session_id and checks your X-Webhook-Secret against that provider’s secret.

Keeping credentials safe

  • Store both the API key and webhook secret as environment variables, never in source code
  • Treat the API key as a production credential — the partner API has no sandbox mode
  • Restrict server access to the IP ranges of your checkout and back-office servers where possible
  • If a credential is compromised, rotate it immediately from the dashboard and audit recent API activity in your logs

Which credential for which endpoint

Endpoint Auth method
GET /partner/marketplace/plans/me X-API-Key — scope plans:read
GET /partner/marketplace/plans/{id} Public (no auth)
GET /partner/serviceability/autocomplete X-API-Key
POST /partner/serviceability/check X-API-Key
POST /partner/external-checkout/sessions Public (optional Bearer JWT to link a signed-in kurnl account)
GET /partner/external-checkout/sessions/{id} X-Webhook-Secret
PATCH /partner/external-checkout/sessions/{id} X-Webhook-Secret
GET /partner/external-checkout/sessions/{id}/status Public (session UUID is the bearer)
POST /partner/external-checkout/complete X-Webhook-Secret
POST /partner/external-checkout/anonymous-complete X-Webhook-Secret
POST /partner/external-checkout/subscription-status X-Webhook-Secret
POST /partner/provisioning/provider-initiated X-API-Key — scope provisioning:write
POST /partner/provisioning/bulk X-API-Key — scope provisioning:write
GET /partner/provisioning/bulk/{batch_id} X-API-Key — scope provisioning:read
GET /partner/reports/billing X-API-Key — scope billing:read
/partner/agent/* X-API-Key — scope agent + separate agent_api_access feature flag; X-Verified-Session on sensitive calls
Subscriber self-service Authorization: Bearer <JWT>
POST /partner/location/, GET /partner/status/notices Public (no auth)
POST /partner/location/details Staff JWT with subscribers:write (not partner-callable)