Register a transaction or custom event and return the applied effects
Integration
Registers a Purchase Transaction or a Custom Event for a member and returns, in the same response, the effects the campaign engine applied. Use event.type: "transaction" for a Purchase Transaction; any other value is a Custom Event type and must match a custom event schema registered for the tenant — see GET /{storeCode}/customEvent/schema/{eventType}/active.
Modes
Write (default) — the event is created and its effects are applied.
Dry run (
dryRun=true) — nothing is persisted; the response is the same as in write mode.
Rate limit
A deployment can limit how many write requests per second are processed synchronously. Dry runs are never limited, and a request rejected with 400 does not count towards the limit.
Above the limit the event is not rejected: it is registered and the endpoint answers 202 with the id of the created Transaction or Custom Event. Its effects are applied in the background, so the 202 response carries no effectsSummary or other response sections. Read the result from the resource in the Location header or from webhooks. Do not resend the request.
The X-RateLimit-* headers on write responses show the current state of the limit.
Validation errors (400)
Besides field-level validation of the event payload, the endpoint answers 400 when:
eventorevent.typeis missing, oreventis not an object;responseContentcontainsnull, an empty string or an unrecognized value;data.header.documentNumberis already used in the tenant — also when a concurrent request with the same document number commits first (the error is reported ondocumentNumber).
Open Loyalty has the JWT authorization. To learn what a JSON Web Token is and how it works, check out Introduction to JSON Web Tokens https://jwt.io/introduction/
Obtain an access token
Send a request with the parameters username and password
Definition
POST /api/admin/login_check Go to definition
Example
curl {HOST}/api/admin/login_check
-H 'Content-Type: application/json;charset=UTF-8'
-H 'Accept: application/json, text/plain, */*'
--data-binary '{"username":"admin","password":"password"}'
Example Response
{
"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6...",
"refresh_token":"0558f8bb29948c4e54c443f..."
}
Using JSON Web Token
Add authorization header to each request
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...
You can now access any API method you want under the /api prefix.
Example
curl {HOST}/api/{storeCode}/analytics/members
-H 'Accept: application/json'
-H 'Content-type: application/x-www-form-urlencoded'
-H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6...'
Refresh JSON Web Token
You can refresh token using refresh_token that was given during login.
To refresh admin token POST /api/token/refresh Go to definition
Store code
When true, nothing is persisted and the response previews what the event would produce, in the same shape as in write mode.
falseUsed only when responseContent includes translations — the locale that section is resolved for; ignored otherwise. Falls back to the locale's parent (pl_PL → pl) and then to the tenant's configured default language; an unknown locale resolves to the default rather than failing. A malformed value (not a locale tag such as pl or en_US, or longer than 35 characters) is ignored, as on every endpoint.
plThe event was processed. In dryRun mode this reflects what would happen; nothing was persisted.
Write mode only. The rate limit was exceeded, so the event was registered and its effects will be applied in the background — see Rate limit above.
Bad request.
Unauthorized
Forbidden.
storeCode does not match any existing store. The response has no body.
Note: a member that cannot be resolved from memberData does not produce a 404 —
the request succeeds with 200 and event.matched: false.
Conflict — the resource is already being processed by another concurrent request.
POST /api/{storeCode}/event HTTP/1.1
Host: openloyalty.localhost
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 280
{
"event": {
"type": "transaction",
"memberData": {
"email": "john.smith@example.com"
},
"data": {
"header": {
"purchasedAt": "2026-01-13 11:40:35+01:00",
"documentNumber": "DOC12346789"
},
"items": [
{
"sku": "PROD1",
"name": "T-Shirt",
"highPrecisionQuantity": 1,
"grossValue": 200,
"category": "T-Shirt"
}
]
}
}
}{
"event": {
"eventId": "00000000-0000-0000-0000-000000000000",
"matched": true,
"member": {
"email": "member_1@example.com",
"memberId": "00000000-0000-0000-0000-000000000000"
},
"createdAt": "2026-01-13T11:40:35+01:00"
},
"effectsSummary": {
"givenUnits": [
{
"walletCode": "default",
"units": 30
}
],
"deductedUnits": [
{
"walletCode": "default",
"units": 30
}
],
"givenRewards": [
{
"rewardId": "6a861f8a-6906-4002-8b9c-4db407e810ea"
}
],
"assignedMemberCustomAttributes": [
{
"key": "level",
"value": "10"
}
],
"removedMemberCustomAttributes": [
{
"key": "level"
}
],
"grantedBadges": [
{
"badgeSystemCode": "multi_rule_badge"
}
],
"assignedTiers": [
{
"tierSetId": "4d5f2c90-3b1e-4a6d-9f2b-8c7a1e5d3b04",
"tierId": "9b2e7a13-5c48-4f6e-8a1d-2c3b4e5f6a7b"
}
]
},
"challengeProgress": [
{
"campaignId": "7c1e2b1a-3d4f-4e5a-9b6c-0d1e2f3a4b5c",
"previousCompletedCount": 0,
"completedCount": 1,
"completed": true,
"limitReached": false,
"milestones": [
{
"milestoneId": "2f8d9c4b-6a7e-4b1c-8d2e-3f4a5b6c7d8e",
"currentValue": 0,
"goal": 3,
"completedConsecutivePeriods": null,
"consecutivePeriods": null
}
]
}
],
"unitsPerProduct": [
{
"campaignId": "0f3c1a6e-4b8a-4e9a-9c3a-2f1a6a6e4b8a",
"walletCode": "default",
"units": 30,
"lines": [
{
"lineIndex": 0,
"sku": "PROD1",
"units": 20
},
{
"lineIndex": 1,
"sku": "PROD1",
"units": 10
}
]
}
],
"productsToPrice": [
{
"sku": "PROD2",
"earned": {
"givenUnits": [
{
"walletCode": "default",
"units": 15
}
]
}
}
],
"suggestions": [
{
"campaignId": "0f3c1a6e-4b8a-4e9a-9c3a-2f1a6a6e4b8a",
"missing": [
{
"type": "transactionAmount",
"required": 500,
"current": 420,
"operator": "gte"
}
],
"wouldEarn": [
{
"type": "points",
"walletCode": "default",
"value": 100
},
{
"type": "tier",
"tierSetId": "3b0f1c2d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
"tierId": "8e1f2a3b-4c5d-4e6f-8a7b-9c0d1e2f3a4b"
},
{
"type": "customAttribute",
"customAttributeKey": "vip_candidate",
"customAttributeValue": "yes"
}
]
},
{
"campaignId": "7c1e2b1a-3d4f-4e5a-9b6c-0d1e2f3a4b5c",
"missing": [
{
"type": "productSetCategory",
"category": "Shoes",
"required": 3,
"current": 1,
"unit": "quantity",
"operator": "gte"
},
{
"type": "channelId",
"operator": "in",
"expected": [
"mobile",
"web"
],
"current": "pos"
}
],
"wouldEarn": [
{
"type": "reward",
"rewardId": "6a861f8a-6906-4002-8b9c-4db407e810ea",
"couponValue": 25
}
]
},
{
"campaignId": "2f8d9c4b-6a7e-4b1c-8d2e-3f4a5b6c7d8e",
"missing": [
{
"type": "bundle",
"lineTargetCode": "summer_bundle",
"setsRequired": 2,
"setsCurrent": 1,
"operator": "gte",
"parts": [
{
"partIndex": 1,
"type": "productSetSku",
"sku": "PROD2",
"required": 2,
"current": 0,
"unit": "quantity"
}
]
},
{
"type": "memberWalletBalance",
"walletCode": "default",
"field": "activeUnits",
"operator": "gte",
"required": 1000,
"current": 850
}
],
"wouldEarn": [
{
"type": "badge",
"badgeSystemCode": "loyal_shopper"
}
]
}
],
"translations": {
"campaigns": {
"0f3c1a6e-4b8a-4e9a-9c3a-2f1a6a6e4b8a": {
"name": "Double points weekend",
"description": "Earn twice the usual points on every purchase this weekend."
},
"7c1e2b1a-3d4f-4e5a-9b6c-0d1e2f3a4b5c": {
"name": "Register three devices"
}
},
"walletTypes": {
"default": {
"name": "Points",
"description": "Your everyday loyalty points."
}
},
"rewards": {
"6a861f8a-6906-4002-8b9c-4db407e810ea": {
"name": "Free coffee",
"shortDescription": "One free coffee of your choice.",
"brandName": "Coffee House"
}
},
"badgeTypes": {
"multi_rule_badge": {
"name": "Collector"
}
},
"milestones": {
"2f8d9c4b-6a7e-4b1c-8d2e-3f4a5b6c7d8e": {
"name": "Three devices",
"description": "Register three devices, any type."
}
},
"tierSets": {
"9d2c1a7e-5b3f-4c8a-b1e6-0f7d3a2c9b41": {
"name": "Coffee club",
"description": "Our loyalty programme."
}
}
}
}Last updated
Was this helpful?

