For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.


Try adding a member yourself

  • Input the previous saved token and storeCode in the request header

  • Add a member Endpoint: POST /api/{storeCode}/member

    {
       "customer": {
            "email": "john.smith@example.com",
            "firstName": "John",
            "lastName": "Smith",
            "gender": "male"
        }
    }
  • This action should trigger CustomerRegistered webhook


Endpoints used

Method allows registering new member.

post

This method allows registering a new Member as an Admin.

Authorizations
AuthorizationstringRequired

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

Path parameters
storeCodestringRequired

Store code

Body
Responses
200

Return registered member id and email.

application/json
customerIdstring · uuidOptional

Registered member identity

Example: 00000000-0000-0000-0000-000000000000
emailstringOptional

Registered member email

post/api/{storeCode}/member
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": "2026-01-01",
    "registeredAt": "2026-01-01T00:00:00.000Z",
    "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 previous saved token and storeCode in the request header

  • 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.

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:

user-groupMembers

Last updated

Was this helpful?