# Member creation

Use the [CreateMember](/openapi/digital-platform/openapi/members/ocapimembers_createmember/) endpoint to create a
new loyalty member. The required properties will depend on your configuration in Vista Loyalty.

```json
{
  "credentials": {
    "username": "string",
    "password": "string",
    "pin": "string",
    "email": "string"
  },
  "clubMembership": {
    "clubId": 0,
    "clubLevelId": 0
  },
  "personalDetails": {
    "name": {
      "givenName": "string",
      "familyName": "string",
      "middleName": "string"
    },
    "birthDate": "2019-08-24T14:15:22Z",
    "gender": "NotSpecified"
  },
  "acceptedTermsAndConditions": true,
  "authenticationType": "None"
}
```

NOTE
Some properties have been omitted from the code snippet above for brevity.

## Email availability

A member cannot be created with the same `email` as an existing member. To check if an `email` has already been registered,
use the [ValidateEmailAvailability](/openapi/digital-platform/openapi/members/ocapimembervalidateemail_validateemailavailability/)
endpoint.

```json
{
  "email": "string"
}
```

This endpoint will return a response with an `isAvailable` property, indicating whether the provided `email` can be used
to create a new member.

If the `email` is unavailable (i.e., already registered to an existing member), suggest that the patron
[authenticate](/digital-platform/loyalty/member-authentication) their existing member, or [reset their password](/digital-platform/loyalty/member-password-reset).

```json
{
  "isAvailable": true
}
```

## Credentials

Depending on configuration, a combination of `username`/`email` and `password`/`pin` must be specified as the `credentials`
that the member will use for [member authentication](/digital-platform/loyalty/member-authentication).

IMPORTANT
When choosing a `password`, the configured [member password rules](/digital-platform/loyalty/member-password-rules) must be followed.

## Club membership

The `clubId` represents the unique identifier of a club in Vista Loyalty and must be specified when creating a new member.

Use the [GetMasterData](/openapi/digital-platform/openapi/loyalty/ocapiloyaltymasterdata_getmasterdata/) endpoint to
get the list of available loyalty clubs.

```json
{
  "clubs": [
    {
      "id": 0,
      "name": {
        "text": "string",
        "translations": [
          {
            "languageTag": "string",
            "text": "string"
          }
        ]
      }
    }
  ]
}
```

NOTE
Some properties have been omitted from the code snippet above for brevity.

## Terms and conditions

Use the `acceptedTermsAndConditions` request property to indicate whether the patron has accepted the terms and conditions
when signing up.

## Authentication type

Setting the `authenticationType` to `Cookie` or `Token` will automatically authenticate the new member and return
a cookie-based or token-based [loyalty session](/digital-platform/loyalty/member-authentication#loyalty-session) upon member creation.