AI Support Agent — Authentication
The AI Support Agent API uses two layers of authentication:
- Agent API key — proves which provider is calling. Server-side, on every request.
- Verified session — proves which customer has been identity-checked. Required for sensitive reads and all changes.
1. Agent API key
Send your key in the X-API-Key header, exactly like the rest of the partner API:
curl https://middleware.kurnl.ca/partner/agent/customers/search?q=anna \ -H "X-API-Key: krnl_a1b2c3d4e5f6..."The key is scoped to your provider — you can only reach your own customers.
2. Verified session (email or SMS one-time code)
Before the agent reveals account detail or makes a change, the caller must be verified. The
agent triggers a one-time code to the customer’s email (default) or phone on file, asks the
caller to read it back, and validates it. On success it receives a short-lived token to send as
X-Verified-Session.
Issue a code
Terminal window curl -X POST https://middleware.kurnl.ca/partner/agent/verify/issue \-H "X-API-Key: krnl_..." \-H "Content-Type: application/json" \-d '{ "customer_id": "sub-abc", "channel": "email" }'{ "status": "sent", "sent_to": "a***@example.com", "channel": "email" }The code is sent — never returned in the response. The email comes from your provider, also for a customer another provider serves. Read
sent_toback to the caller so they know which inbox (or phone) to check. Use"channel": "sms"to text it instead;sent_tois then a masked phone like•••42.Validate the code
Terminal window curl -X POST https://middleware.kurnl.ca/partner/agent/verify/check \-H "X-API-Key: krnl_..." \-H "Content-Type: application/json" \-d '{ "customer_id": "sub-abc", "code": "123456" }'{"verified_session": "eyJhbGciOiJIUzI1Ni…","expires_in": 900,"token_type": "verified-session"}Use the session
Send the token on every protected call for that customer:
Terminal window curl https://middleware.kurnl.ca/partner/agent/customers/sub-abc/billing-summary \-H "X-API-Key: krnl_..." \-H "X-Verified-Session: eyJhbGciOiJIUzI1Ni…"
Rules
- The token lasts 15 minutes and is bound to one
(provider, customer)pair — it cannot be reused for a different customer (401). - The code is 6 digits, valid for 10 minutes, with a small attempt limit. Repeated failures should trigger a human handoff (open a ticket — see Reference).
verify/issueis rate-limited to 10/min per key. Within the 60-second cooldown a re-issue still returns{ "status": "sent" }but no email/SMS is actually sent — the existing code simply stays valid. If the caller says nothing arrived, wait out the cooldown before re-issuing rather than retrying in a loop.
Which auth for which endpoint
| Endpoint group | X-API-Key |
X-Verified-Session |
|---|---|---|
customers/search, customers/{id}/tickets |
✅ | — |
verify/issue, verify/check |
✅ | — |
tickets (create / escalate) |
✅ | — |
customers/{id} (full profile) |
✅ | ✅ |
billing-summary, payments, network-health, invoices/{id}/resend |
✅ | ✅ |
notes, contact, password-reset |
✅ | ✅ |
plan-change/preview, plan-change |
✅ | ✅ |
Testing
There is no sandbox agent key: a key always acts on your live account, and a plan-change apply is a real change. Build and test the integration against kurnl’s test environment, which has its own hosts and keys — see Test and production hosts.