Skip to content
Loyvo

Get started

Authentication

Every request is authenticated with a Loyvo API key: one key for the SMS, Loyalty and Wallet APIs. Requests without a valid key get 401.

One key for every API

Create a Loyvo API key in app.loyvo.lk → Settings → API keys, and send it as a bearer token to the SMS, Loyalty and Wallet APIs:

Authorization: Bearer lvo_live_…

Send it in the header on every request, always over HTTPS. Keys in URLs or request bodies are not accepted. Each key belongs to one organisation and only reaches that organisation's data.

Any Loyvo API
curl https://api.loyvo.lk/v1/sender-ids \
  -H "Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx"

Check a key

GET /v1/key tells you which organisation a key belongs to, whether it is live or test, and what it may do. Use it to confirm your setup or to show "Connected to …" in your own app. It needs no permission; an invalid or revoked key gets 401.

The SDKs call it with whoami().

GET /v1/key
curl https://api.loyvo.lk/v1/key \
  -H "Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx"
Response 200
{
  "key_id": "key_7fq2m4x9c1v8",
  "env": "live",
  "scopes": ["sms:send", "loyalty:pos"],
  "org": { "id": "org_3n8k2p", "name": "QUBA" },
  "products": ["loyalty", "sms"]
}

Permissions

When you create a key, choose what it can do. A key without the permission a request needs gets 403 insufficient_scope.

PermissionUsed byLets the key
sms:sendSMS APISend messages and campaigns.
sms:readSMS APICheck messages, campaigns, sender IDs and balance.
loyalty:posLoyalty API, Wallet API (POS)Look up and enrol customers, earn and redeem points.
loyalty:readLoyalty APIRead loyalty data only.
wallet:issueWallet APIIssue and update Apple and Google Wallet passes.

Test and live

Test keys (lvo_test_…) work with the SMS API: they go through the same validation and return the same responses as live keys, but messages are never sent to phones and no credits are used. They are marked delivered within seconds and carry "test": true.

The Loyalty and Wallet APIs don't have a test mode yet and refuse test keys (403 test_key_not_supported). To try them safely, create a separate test organisation and use a live key for it.

Keep keys secret

  • Use keys only on your server or POS back office, never in a website, mobile app or anything a customer can download.
  • Store them in environment variables or a secret manager, not in source code.
  • Give each system its own key so you can revoke one without stopping the others.
  • If a key leaks, revoke it in app.loyvo.lk → Settings → API keys and create a new one straight away.