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

# Create Customer

> Create a new customer

# Create Customer

Creates a new customer record in the store. Requires the `write_customers` scope.

## Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.launchmystore.io/api/v1/customers.json" \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "email": "jane.smith@example.com",
      "first_name": "Jane",
      "last_name": "Smith",
      "phone": "+1-555-987-6543",
      "accepts_marketing": true,
      "note": "Met at trade show"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.launchmystore.io/api/v1/customers.json', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      email: 'jane.smith@example.com',
      first_name: 'Jane',
      last_name: 'Smith',
      phone: '+1-555-987-6543',
      accepts_marketing: true,
      note: 'Met at trade show'
    })
  });
  ```
</CodeGroup>

## Body Parameters

<ParamField body="email" type="string" required>
  Customer email address (must be unique)
</ParamField>

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

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

<ParamField body="phone" type="string">
  Customer's phone number
</ParamField>

<ParamField body="accepts_marketing" type="boolean" default="false">
  Whether customer has opted in to marketing emails
</ParamField>

<ParamField body="note" type="string">
  Internal notes about the customer
</ParamField>

<ParamField body="tags" type="array">
  Array of tags. Accepted by the request but not persisted — a customer record
  has no tags field.
</ParamField>

<ParamField body="addresses" type="array">
  Array of address objects. Only the **first** address is persisted, and only
  its flat fields (`address1`, `city`, `province`, `country`, `zip`, `phone`)
  are stored on the customer record — there is no separate addresses
  collection. Subsequent addresses are ignored.
</ParamField>

<Note>
  A customer record stores a single combined name (built from `first_name` +
  `last_name`), one phone number, the marketing flag, a note, and one flat
  address. Tags are not stored, and only the first address is persisted.
</Note>

## Response

The response is a bare object keyed by `customer` containing the newly created
customer object (the same shape returned by the read endpoints).
There is no `{ status, data }` envelope.

<ResponseField name="customer" type="object">
  The created customer object
</ResponseField>

## Example Response

```json theme={null}
{
  "customer": {
    "id": "cust_new789",
    "email": "jane.smith@example.com",
    "first_name": "Jane",
    "last_name": "Smith",
    "name": "Jane Smith",
    "phone": "+1-555-987-6543",
    "accepts_marketing": true,
    "orders_count": 0,
    "total_spent": "0.00",
    "tags": [],
    "addresses": [],
    "default_address": null,
    "tax_exempt": false
  }
}
```

## Errors

Errors are returned as a standard `{ "errors": { "base": ["..."] } }` body
with the corresponding HTTP status code.

| Status | Description                                                      |
| ------ | ---------------------------------------------------------------- |
| `400`  | `email` is missing, or a customer with this email already exists |
| `401`  | Invalid or missing access token                                  |
| `403`  | App doesn't have the `write_customers` scope                     |
