# Add & fetch a Member

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

{% hint style="warning" %}
The endpoints used in this example is the recommended ones, and they requires an admin token to be used.&#x20;
{% endhint %}

***

## Try adding a member yourself <a href="#to-try-it-yourself" id="to-try-it-yourself"></a>

* Input the previous saved [token](https://help.openloyalty.io/technical-guide/getting-started-guide/authentication) and [storeCode](https://help.openloyalty.io/technical-guide/member-registartion-configuration#to-try-it-yourself) 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](https://help.openloyalty.io/technical-guide/add-webhook#to-try-it-yourself)

***

## Endpoints used

{% openapi src="<https://content.gitbook.com/content/gIv2CyIIYf7vRfuhMKQ6/blobs/2xnMWXnOETp8Vxl2YZoi/openapi-5.61.0%20(1).json>" path="/api/{storeCode}/member" method="post" %}
[openapi-5.61.0 (1).json](https://content.gitbook.com/content/gIv2CyIIYf7vRfuhMKQ6/blobs/2xnMWXnOETp8Vxl2YZoi/openapi-5.61.0%20\(1\).json)
{% endopenapi %}

***

## Try fetching a member yourself <a href="#to-try-it-yourself" id="to-try-it-yourself"></a>

* Input the previous saved [token](https://help.openloyalty.io/technical-guide/getting-started-guide/authentication) and [storeCode](https://help.openloyalty.io/technical-guide/member-registartion-configuration#to-try-it-yourself) in the request header
* Input the customerId of the member you wish to retrieve.\
  Endpoint: `GET /api/{storeCode}/member/{member}`&#x20;
* 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": "john.smith@example.com",
    "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:

{% content-ref url="<https://app.gitbook.com/s/cNVX03KZzmrGwJihLiEx/main-features/members>" %}
[Members](https://app.gitbook.com/s/cNVX03KZzmrGwJihLiEx/main-features/members)
{% endcontent-ref %}
