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.
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().
curl https://api.loyvo.lk/v1/key \
-H "Authorization: Bearer lvo_live_xxxxxxxxxxxxxxxxxxxxxxxx"{
"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.
| Permission | Used by | Lets the key |
|---|---|---|
| sms:send | SMS API | Send messages and campaigns. |
| sms:read | SMS API | Check messages, campaigns, sender IDs and balance. |
| loyalty:pos | Loyalty API, Wallet API (POS) | Look up and enrol customers, earn and redeem points. |
| loyalty:read | Loyalty API | Read loyalty data only. |
| wallet:issue | Wallet API | Issue 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.