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. Call it with curl, or with an official client library in TypeScript, Python, Ruby, Go, Java, C#, PHP, Swift or Rust.
- 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}'
Client libraries
Official SDKs in nine languages. Install one, hand it your API token, and call Leal with autocomplete, typed responses and real error classes instead of assembling requests yourself. Each one covers the whole API.
Working in a language that is not here? The OpenAPI description works with any generator, and if you would like us to publish that language officially, tell us.
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.
To check connectivity before you have a token, call the public status endpoint. It needs no credentials and returns the rate limit in force:
curl -i https://app.getleal.com/api/v1/status 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 |
|---|---|---|
| Status | /status | Public. No token needed. Confirms the API is up and reports the rate limit in force, so you can check connectivity and read the RateLimit headers before you authenticate. |
| 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.
Versioning and deprecation
The version is in the URL. v1 is current, it is not deprecated, and no retirement date is set. Build against https://app.getleal.com/api/v1.
URLs you have already integrated against keep working. A version is only ever retired after the notice below, and a new version means a new URL, never a change to an existing one.
What counts as a breaking change
These only happen in a new version, never in v1:
- Removing or renaming an endpoint, field or error code.
- Changing the type or meaning of an existing field.
- Making an optional request parameter required.
- Removing a value from an enumerated set.
Anything additive can land in v1 without notice: new endpoints, new optional parameters, and new fields on an existing response. Write clients that ignore fields they do not recognise.
How a retirement is announced
A version that is going away says so on every response, long before it stops working, so a client can notice without anyone reading an email:
HTTP/1.1 200 OK
Deprecation: @1767225600
Sunset: Fri, 01 Jan 2027 00:00:00 GMT
Link: <https://www.getleal.com/developers#versioning>; rel="deprecation"; type="text/html" - Deprecation is the RFC 9745 header: the moment the version became deprecated, as seconds since the epoch.
- Sunset is the RFC 8594 header: the date the version stops serving requests. It is never earlier than the deprecation date.
- Link with rel="deprecation" points back to this page.
We give at least 12 months between announcing a deprecation and the sunset date. After the sunset date the version returns 410 Gone with a JSON body whose code is version_sunset. The current state is always readable, without a token, from the status endpoint.
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://github.com/lealhq
Source for every official SDK, one repository per language.
- 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.