Skip to content

Authentication & scopes

Every request carries an API key. Each key has an explicit list of scopes. A developer key is also confined to one facility: a test key to the sandbox, a live key to a facility your account was approved for.

API keys

Send the key as a bearer token:

curl https://admin.heka.care/api/platform/v1/facilities -H "Authorization: Bearer hsl_live_9f3a1c2b…"
PartMeaning
hsl_live_Live key. Acts on one real facility, within the scopes approved for your account on that facility.
hsl_test_Test key. Same API, but it always acts on the sandbox facility HSL-SANDBOX, which holds synthetic data only.
9f3a1c2bThe visible prefix — shown in the console and logs so you can tell keys apart.
the restSecret. 32 random bytes. The hub stores only its SHA-256 hash, so a lost key cannot be recovered — only replaced.

A missing, malformed, unknown, revoked or expired key returns 401 with an authentication_error and a specific code: missing_api_key, invalid_api_key, api_key_revoked or api_key_expired.

Your developer account

Keys belong to a developer account. Create one at /developers/signup; the hub e-mails you a set-up link, where you choose your password, and you are then signed in to the console. If the hub cannot send e-mail, a Heka SoftLink administrator sends you the set-up link instead.

  • Test keys are self-serve: create them in the console whenever you need them.
  • Live access is requested in the console and approved by a Heka SoftLink administrator, per facility, with the scopes allowed on each.
  • Live access needs two-step verification (an authenticator app) on your account. It cannot be approved while two-step verification is off, and you cannot turn it off while live access is approved.
  • Every live change in the console asks for a current code from your authenticator app: creating or rotating a live key, and creating, changing, enabling or rotating the secret of a live webhook.

Test and live keys

Test keyLive key
FacilityAlways HSL-SANDBOX, whatever else the key saysThe facility it was created for, while your grant for it is active
DataSynthetic: no real people, facilities or moneyReal facility data, within your grant
Who creates itYou, in the consoleYou, in the console, after live access is approved, with a code from your authenticator app
ScopesAny developer scopeOnly scopes on your grant for that facility, never a sandbox-only scope

The hub checks a key’s account, live access and grant on every request, with no cache, so a change takes effect on the next request. When a key cannot be used, the error says why:

StatusCodeMeaning
401api_key_disabledThe developer account that owns the key is not active (for example, suspended).
403live_access_requiredLive access is not approved for the account, or two-step verification is off.
403facility_access_revokedThe account no longer has a grant for the live key’s facility.
503sandbox_unavailableThe sandbox facility is not set up on this hub yet, so test keys cannot be used.

Scopes

There is no wildcard. A request needs every scope its endpoint lists (shown on each operation in the reference); otherwise it gets 403 insufficient_scope with the missing scopes in error.details.missing.

ScopeGrants
plans:readRead plans and add-ons (the public price book).
facilities:readRead facility profiles and balances.
subscriptions:readRead subscriptions, their add-ons and status.
subscriptions:writeCreate subscriptions, change plans, set add-ons and cancel.
invoices:readRead invoices, line items and payments applied to them.
invoices:writeCreate manual invoices, finalize and void them.
payments:readRead payments.
payments:writeRecord manual payments and create Paystack checkout links.
usage:writeReport metered usage (NHIA claims, SMS, AI requests…).
entitlements:readRead the features, limits and commercial state of a facility.
events:readRead the platform event log.
webhooks:manageCreate, list and delete webhook endpoints. Not available to facility-scoped admin keys; a developer key reaches only its own endpoints.
analytics:readRead network revenue analytics (MRR, ARR, retention, receivables). Not available to facility-scoped keys.

A developer key can hold only some of these:

  • Developer scopes: plans:read, facilities:read, subscriptions:read, invoices:read, payments:read, entitlements:read, events:read, usage:write, webhooks:manage.
  • Live grants can carry: plans:read, facilities:read, subscriptions:read, invoices:read, payments:read, entitlements:read, events:read, webhooks:manage.
  • Sandbox only: usage:write. Reporting usage changes a facility’s bill, so it is never part of a live grant.
  • Never on a developer key: subscriptions:write, invoices:write, payments:write, analytics:read.
Typical developer grants
  • Finance / ERP sync: invoices:read, payments:read, events:read, and webhooks:manage for your own endpoints.
  • Showing a facility’s plan and standing: facilities:read, subscriptions:read, entitlements:read.
  • Trying out usage reporting: usage:write on a test key, in the sandbox.

Facility-scoped keys

Every developer key is confined to one facility. Every query it makes is filtered to that facility:

  • Lists return only that facility’s records.
  • Fetching or changing another facility’s resource returns 404, not 403 — the key cannot even learn that the resource exists.
  • Request bodies may omit facility_id; if present it must match.
  • webhooks:manageon a developer key reaches only your own account’s endpoints, in the key’s environment: a test key sees test endpoints, a live key sees live endpoints.
  • Keys issued by Heka SoftLink administrators can be confined to one facility too. Such a key cannot hold the network-wide scopes webhooks:manage, analytics:read.

Rotation & revocation

  • Create one key per integration so each can be revoked on its own. An account can hold up to 10 active keys.
  • Rotate in the console issues a new key and keeps the old one working for 24 hours, then it expires. Deploy the new key, confirm traffic in the request log, and revoke the old key early if you like. Rotating a live key asks for a code.
  • Revoke takes effect on the next request.
  • Keys may carry an expiry date; expired keys fail with api_key_expired.
  • The console shows when each key was last used, and the request log lists every call. Investigate any traffic you do not recognise.