Skip to main content

Authentication

Every API request needs an API key. Here's how to get one and use it.


Getting Your API Key

In Dashboard

  1. Go to dashboard.loyali.io
  2. Navigate to SettingsAPI Keys
  3. Click Create API Key
  4. Select the key type
  5. Copy the key — you won't see it again

Key Types

Private Keys

sk_live_...

Full access to everything. Server-side only.

✓ Create customers
✓ Award points
✓ Manage rewards
✓ All data

Public Keys

pk_live_...

Read-only access. Safe for browsers.

✓ Look up customers
✓ View points
✓ See rewards
✗ Cannot modify

Never Expose Private Keys

Private keys should only be used on your server. Never put them in frontend JavaScript, mobile apps, or anywhere users can see them.


Using Your Key

Add to the X-API-Key header:

curl https://api.loyali.io/api/v1/customers \
-H "X-API-Key: sk_live_abc123..."

Or use Bearer authentication:

curl https://api.loyali.io/api/v1/customers \
-H "Authorization: Bearer sk_live_abc123..."
View in API Reference →

Key Permissions

When creating a private key in the Dashboard, you can restrict what it can do:

PermissionWhat it allows
customers:readView customers
customers:writeCreate/update customers
points:readView balances
points:writeAward/deduct points
rewards:readView rewards
rewards:writeManage rewards
webhooks:writeCreate webhooks
Least Privilege

Only give each key the permissions it needs. Your checkout service probably doesn't need webhooks:write.


Revoking Keys

If a key is compromised:

In Dashboard

  1. Go to SettingsAPI Keys
  2. Find the key
  3. Click Revoke

The key stops working immediately.


Error Responses

ErrorMeaning
401 Invalid API keyKey doesn't exist or was revoked
403 Insufficient permissionsKey lacks required permission
403 Public key not allowedEndpoint requires private key

Full API Documentation

View Complete API Reference →