Leal developer portal
Everything you need to build on Leal, the wallet loyalty platform for local businesses. The Leal REST API lets you create loyalty cards, enrol customers, add stamps, redeem rewards and receive webhooks, so your point of sale, booking system or back office can drive the loyalty program directly.
- Base URL
- https://app.getleal.com/api/v1
- Authentication
- Authorization: Bearer <token>
- Format
- JSON requests and JSON responses
- Rate limit
- 300 requests per minute per token
Quickstart
Three steps from a fresh account to a stamped loyalty card.
-
1. Create an API token
Sign in to Leal, open API tokens in your account settings, and create a token. Treat it like a password: it carries the full access of the user who created it.
Open API tokens -
2. List your stores
Every request needs an Authorization header. Start by listing the stores your token can reach, and note the account id you want to work with.
curl https://app.getleal.com/api/v1/accounts \ -H "Authorization: Bearer $LEAL_API_TOKEN" -
3. Add a stamp to a customer card
Stamping is the call most integrations need. Pass the account, the customer and the customer card, and Leal updates the wallet pass and sends the notification.
curl -X POST \ https://app.getleal.com/api/v1/accounts/1/customers/2/customer_cards/3/stamp \ -H "Authorization: Bearer $LEAL_API_TOKEN" \ -H "Content-Type: application/json" \ -d '{"stamps": 1}'
Authentication
Leal uses bearer API tokens. Create one in your account settings at app.getleal.com/api_tokens, then send it on every request:
Authorization: Bearer YOUR_TOKEN A token inherits the access of the user who created it, so it can reach every store that user belongs to. There is no separate sandbox environment yet, so test against a store you do not mind changing.
API resources
Every path below is relative to https://app.getleal.com/api/v1. See the full API reference for parameters and response fields, or read /openapi.json if you are generating a client.
| Resource | Path | What it does |
|---|---|---|
| Stores | /accounts | The accounts your token can reach, with card and customer counts. |
| Cards | /accounts/:account_id/cards | Loyalty stamp card templates: colours, stamp counts and artwork. |
| Rewards | /accounts/:account_id/rewards | Redeemable milestones on a card, at a given number of stamps. |
| Customers | /accounts/:account_id/customers | Loyalty program members. Look them up by search, or by source and external id from another system. |
| Customer cards | /accounts/:account_id/customers/:customer_id/customer_cards | A customer's enrolled card, its stamp progress and its Apple Wallet and Google Wallet links. Includes the stamp and redeem actions. |
| Locations | /accounts/:account_id/locations | Physical stores. Addresses are geocoded so Apple Wallet can show the pass near the shop. |
| Posters | /accounts/:account_id/posters | Printable QR code signup posters and their public signup URLs. |
| Webhook subscriptions | /accounts/:account_id/webhook_subscriptions | Register a target URL to receive an event, or delete a subscription. |
Errors
Every failure returns JSON, never an HTML page. Validation failures also carry an errors object keyed by field name.
{
"error": "Unauthorized. A valid API token is required.",
"code": "unauthorized",
"resolution": "Send the token in the Authorization header, for example `Authorization: Bearer <token>`. Create and manage tokens at https://app.getleal.com/api_tokens.",
"documentation_url": "https://app.getleal.com/docs/api.html"
} - 401 The API token is missing or invalid.
- 404 The record does not exist, or your token cannot reach that store.
- 422 The request was understood but rejected, usually a validation failure.
- 429 You exceeded the rate limit. Check Retry-After.
Rate limits
The API allows 300 requests per minute per API token. Unauthenticated requests are counted per IP address. Every response reports where you are, so a client can slow down before it is blocked:
RateLimit-Limit: 300
RateLimit-Remaining: 297
RateLimit-Reset: 41
RateLimit-Policy: 300;w=60 Going over the limit returns 429 with a Retry-After header, in seconds, and a JSON body whose code is rate_limited. Wait for that long and retry. If you need a higher limit, get in touch.
Webhooks
Subscribe a URL to an event and Leal will POST to it, so you do not have to poll. Subscriptions belong to a store.
curl -X POST \
https://app.getleal.com/api/v1/accounts/1/webhook_subscriptions \
-H "Authorization: Bearer $LEAL_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"event": "customer_card.stamped", "target_url": "https://example.com/hooks/leal"}' Delete a subscription with DELETE on /accounts/:account_id/webhook_subscriptions/:id. The API reference lists the events you can subscribe to.
No code automation
You do not have to write code to connect Leal. The Zapier integration covers the common flows, and the point of sale integrations add stamps automatically when a customer pays.
Machine readable resources
Predictable URLs for automated clients. Every page on this site also serves Markdown when you send the request header Accept: text/markdown.
- https://www.getleal.com/openapi.json
OpenAPI description of the whole API, generated from the Leal codebase. Also at /api/openapi.json.
- https://app.getleal.com/docs/api.html
Reference documentation for every endpoint, parameter and response.
- https://www.getleal.com/.well-known/api-catalog
RFC 9727 catalog linking to the description and the documentation.
- https://www.getleal.com/llms.txt
Summary of Leal and its entry points, written for AI agents.
- https://www.getleal.com/sitemap-index.xml
Every indexable URL on this site.
Something missing, or need a higher rate limit? Get in touch.