> ## Documentation Index
> Fetch the complete documentation index at: https://docs.thanx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Subscriber

<Info>
  Scope required: `subscribers.write`
</Info>

This endpoint opts an email address into the specified merchant's loyalty
marketing. This will enable merchants to send targeted marketing to these
subscribers in order to encourage loyalty opt-in.

It is expected that all user information provided to Thanx via API must have
gotten explicit user consent to participate in the merchant's marketing.

For integrations intending to sign up a user directly for a merchant's loyalty
program should be integrating with the [Consumer APIs](/consumer/overview). This
integration is more intensive, as it requires strict compliance with the
[legal requirements for user creation](/consumer/usage/legal) and must
include a complete enrollment flow (prompt users for card linkage, display
introductory incentives). Please reach out to our team at
<a href="mailto:developer.support@thanx.com">[developer.support@thanx.com](mailto:developer.support@thanx.com)</a> if you are
interested in this type of integration instead.

This endpoint only requires `merchant_id` and `email` to be specified, but
accepts additional subscriber information.

This endpoint responds with a `201` for any valid email address that is sent,
even if the email address is already captured in the system. To avoid
unintentional PII exposure for existing records in the system, this API responds
only with accepted email address. The only time this endpoint `400`s is when the
input email address is invalid.

### Body

<ParamField path="merchant_id" type="string" required>
  Filter by Merchant ID
</ParamField>

<ParamField body="email" type="string" required>
  The subscriber's email
</ParamField>

<ParamField body="first_name" type="string">
  The subscriber's first name
</ParamField>

<ParamField body="last_name" type="string">
  The subscriber's last name
</ParamField>

<ParamField body="birth_date" type="hash">
  The subscriber's birthday information

  <Expandable title="birth_date">
    <ParamField body="year" type="integer" deprecated="true">
      The subscriber's birth year
    </ParamField>

    <ParamField body="month" type="integer">
      The subscriber's birth month
    </ParamField>

    <ParamField body="day" type="integer">
      The subscriber's birth day
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="zip_code" type="string">
  The subscriber's zip code
</ParamField>

<RequestExample>
  ```bash Create a new subscriber theme={null}
  curl https://api.thanxsandbox.com/partner/subscribers/ \
    -X POST \
    -H 'X-ClientId: {client_id}' \
    -H 'Accept-Version: v4.0' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer {access_token}' \
    -d '{
      "merchant_id": "owierywtwt",
      "subscriber": {
        "email": "jane.smith@example.com",
        "first_name": "Jane",
        "last_name":  "Smith",
        "birth_date": {
          "month": 8,
          "day": 14
        },
        "zip_code": "12345"
      }
    }'
  ```
</RequestExample>

### Response

<ResponseField name="subscriber" type="Subscriber">
  The newly created subscriber

  <Expandable title="Subscriber">
    <ResponseField name="email" type="string">
      The subscriber's email
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json 201 theme={null}
  {
    "subscriber": {
      "email": "jane.smith@example.com"
    }
  }
  ```

  ```json 400 theme={null}
  {
    "error": {
      "code": "BAD_REQUEST",
      "message": "Email does not appear to be valid"
    }
  }
  ```
</ResponseExample>
