Add & fetch a Member
See the sample example how a member can be added and fetched. Links to more detailed instructions can be found at the end of the article.
How this example works
In this example, you can register a new member profile using the previously specified registration method and then fetch the member details.
The endpoints used in this example is the recommended ones, and they requires an admin token to be used.
Try adding a member yourself
Add a member Endpoint:
POST /api/{storeCode}/member{ "customer": { "email": "[email protected]", "firstName": "John", "lastName": "Smith", "gender": "male" } }This action should trigger
CustomerRegisteredwebhook
Endpoints used
This method allows registering a new Member as an Admin.
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
POST /api/{storeCode}/member/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.
There are two endpoints
To refresh admin token POST /api/token/refresh Go to definition
To refresh member token POST /api/{storeCode}/token/refresh Go to definition
Store code
Return registered member id and email.
Bad request.
Unauthorized.
Forbidden.
Not found.
POST /api/{storeCode}/member HTTP/1.1
Host: openloyalty.localhost
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 526
{
"customer": {
"referrerToken": "text",
"firstName": "text",
"lastName": "text",
"gender": "male",
"email": "text",
"phone": "text",
"loyaltyCardNumber": "text",
"birthDate": "2025-11-18",
"registeredAt": "2025-11-18T21:49:40.947Z",
"address": {
"street": "text",
"address1": "text",
"address2": "text",
"postal": "text",
"city": "text",
"province": "text",
"country": "text"
},
"company": {
"name": "text",
"nip": "text"
},
"labels": [
{
"key": "text",
"value": "text"
}
],
"agreement1": true,
"agreement2": true,
"agreement3": true,
"levelId": "123e4567-e89b-12d3-a456-426614174000"
}
}{
"customerId": "00000000-0000-0000-0000-000000000000",
"email": "text"
}Try fetching a member yourself
Input the customerId of the member you wish to retrieve. Endpoint:
GET /api/{storeCode}/member/{member}200 Returns the complete member profile as you can see below.
{
"labels": [],
"customerId": {member},
"registeredAt": "2025-11-04T10:47:41+01:00",
"active": true,
"firstName": "John",
"lastName": "Smith",
"gender": "male",
"email": "[email protected]",
"address": {},
"createdAt": "2025-11-04T10:47:41+01:00",
"updatedAt": "2025-11-04T10:47:42+01:00",
"agreement1": false,
"agreement2": false,
"agreement3": false,
"company": {},
"transactionsCount": 0,
"returnTransactionsCount": 0,
"transactionsAmount": 0.0,
"returnTransactionsAmount": 0.0,
"transactionsAmountWithoutDeliveryCosts": 0.0,
"amountExcludedForLevel": 0.0,
"averageTransactionAmount": 0.0,
"averageReturnTransactionAmount": 0.0,
"levelAchievementDate": "2025-11-04T10:47:42+01:00",
"anonymized": false,
"referralToken": "X4HVLEH7E",
"defaultAccount": {
"accountId": "76ff22ca-e63e-414e-8b17-6ba54246ceb6",
"activePoints": 0.0,
"transferredPoints": 0.0,
"lockedPoints": 0.0,
"expiredPoints": 0.0,
"spentPoints": 0.0,
"earnedPoints": 0.0,
"blockedPoints": 0.0
},
"customFieldsData": [],
"currency": "USD",
"storeCode": {storeCode},
"segments": [],
"currentLevel": {
"levelId": "275a9ea4-5e39-47f4-ba03-bb5e13f5c9d3",
"name": "Tier1",
"translations": {
"en": {
"name": "Tier1"
}
}
}
}The retrieved JSON object contains a wealth of information. Retrieving this data is crucial for many operations, such as:
Personalizing communication (e.g., "Hello John, you have 500 points!").
Displaying the customer's status in a mobile app or e-commerce account.
Making business decisions in other systems (e.g., a CRM or Marketing Automation tool).
More resources
For a detailed overview and description of the members, please refer to these series of articles:
MembersIn this section, we will cover everything related to Loyalty Program Members. We will show you all the operations you can do on each Member and what you can achieve with them.Last updated
Was this helpful?

