> Index of every page: https://docs.merchantservicedepot.com/llms.txt

# Create customer


`POST /v1/customers`

Only `email` is required. `name` falls back to the local part of the email when omitted.

`externalId` is your own id for this customer, carried alongside ours so you do not have to store a second one. It must be unique among your active customers, and it is **write-once**: set it here, or later on a customer that has none. Changing one already set is `409`.

`customFields` are your own typed fields on the customer — up to **20** rows of `{name, type, value}`, and nothing invalid is ever silently dropped: a bad row is a `422` naming `customFields[i]`. `name`: 1–40 characters, starting with a letter, then letters/digits/spaces/underscores/hyphens; unique per customer, case-insensitively. `type`: `text` | `number` | `boolean` | `date`. `value` by type: text = string up to 500 characters (no control characters); number = a **string-encoded** decimal like `"12"` or `"-3.14"` (up to 50 characters — never a JSON number, so precision survives); boolean = `true`/`false`; date = a real calendar day as `YYYY-MM-DD`.

Auth: a secret key with the `customers.create` permission. Returns `201` with Customer.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `email` | body | string · email | Yes | The customer’s email address. |
| `name` | body | string | No | A human-readable name. |
| `phone` | body | string | No | A phone number including country code. |
| `externalId` | body | string | No | The external id value. |
| `customFields` | body | array | No | The custom fields value. |

## Request

**curl**

```curl
curl -X POST "https://payments-api-sandbox.merchantservicedepot.com/v1/customers" \
  -H "Authorization: Bearer $MYELA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "email": "{{$guid}}@example.com",
  "name": "Ada Lovelace",
  "phone": "+15555550123",
  "externalId": "cust-{{$guid}}",
  "customFields": [
    {
      "name": "Plan tier",
      "type": "text",
      "value": "gold"
    },
    {
      "name": "Seats",
      "type": "number",
      "value": "12"
    },
    {
      "name": "VIP",
      "type": "boolean",
      "value": true
    },
    {
      "name": "Renewal",
      "type": "date",
      "value": "2027-01-31"
    }
  ]
}'
```

**Node**

```node
const res = await fetch("https://payments-api-sandbox.merchantservicedepot.com/v1/customers", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MYELA_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "email": "{{$guid}}@example.com",
    "name": "Ada Lovelace",
    "phone": "+15555550123",
    "externalId": "cust-{{$guid}}",
    "customFields": [
      {
        "name": "Plan tier",
        "type": "text",
        "value": "gold"
      },
      {
        "name": "Seats",
        "type": "number",
        "value": "12"
      },
      {
        "name": "VIP",
        "type": "boolean",
        "value": true
      },
      {
        "name": "Renewal",
        "type": "date",
        "value": "2027-01-31"
      }
    ]
  }),
});

if (!res.ok) {
  const { error } = await res.json();
  // Branch on error.code — never on error.message.
  throw new Error(error.code);
}
const data = await res.json();
```

**Python**

```python
import os
import requests

res = requests.post(
    "https://payments-api-sandbox.merchantservicedepot.com/v1/customers",
    headers={
        "Authorization": f"Bearer {os.environ['MYELA_API_KEY']}",
    },
    json={
        "email": "{{$guid}}@example.com",
        "name": "Ada Lovelace",
        "phone": "+15555550123",
        "externalId": "cust-{{$guid}}",
        "customFields": [
            {
                "name": "Plan tier",
                "type": "text",
                "value": "gold"
            },
            {
                "name": "Seats",
                "type": "number",
                "value": "12"
            },
            {
                "name": "VIP",
                "type": "boolean",
                "value": True
            },
            {
                "name": "Renewal",
                "type": "date",
                "value": "2027-01-31"
            }
        ]
    },
)

if not res.ok:
    # Branch on error["code"] — never on error["message"].
    raise RuntimeError(res.json()["error"]["code"])
data = res.json()
```

## Response

| Field | Type | Description |
| --- | --- | --- |
| `id` | string | Unique customer identifier. |
| `object` | "customer" | Stable resource discriminator. |
| `email` | string | Customer email. |
| `name` | string | Customer name. |
| `phone` | string | Customer phone. |
| `externalId` | string | Your own id for this customer. Write-once. |
| `customFields` | object[] | Your own typed fields, up to 20 rows of {name, type, value}. Omitted when none are set. Replace-on-write. |
| `createdAt` | string | ISO 8601 creation timestamp. |

```json
{
  "id": "cus_01JEXAMPLE",
  "object": "customer",
  "email": "ada@example.com",
  "name": "Ada Lovelace",
  "phone": "+15555550123",
  "externalId": "acct-8812",
  "customFields": [
    {
      "name": "Plan tier",
      "type": "text",
      "value": "gold"
    },
    {
      "name": "Seats",
      "type": "number",
      "value": "12"
    }
  ],
  "createdAt": "2026-08-10T20:49:51.653Z"
}
```

Source: https://docs.merchantservicedepot.com/api-reference/create-customer/
