---
title: "Create a customer"
method: POST
path: "/v1/customers"
tags: ["Customers"]
---

# Create a customer

`POST /v1/customers`

Create a new customer record. Customers can be associated with payments for tracking and recurring billing.

## Headers

- `X-Idempotency-Key` string, required

## Request body

- CreateCustomerRequest
  - `externalId` string — Your own customer ID.
  - `name` string
  - `email` string, email
  - `document` string — CPF or CNPJ number.
  - `documentType` 'CPF' | 'CNPJ'
  - `phone` string
  - `metadata` object

## Response `201`

Customer created.

- object
  - `customer` Customer
    - `customerId` string — Merchant-facing customer slug (e.g., `cus_ab12cd34ef`). Use this as the `{customerId}` path parameter in subsequent calls.
    - `name` string
    - `email` string
    - `document` string
    - `phone` string
    - `externalId` string
    - `isActive` boolean
    - `createdAt` string, date-time

## Other responses

- `400` — Validation error.
- `401` — Missing or invalid authentication token.
- `409` — Idempotency conflict, raised by the idempotency middleware. `IDEMPOTENCY_PAYLOAD_MISMATCH` means the key was already used with a different request body, at any point in the 24-hour window, including by a request still in flight. `IDEMPOTENCY_CONFLICT` means a request with the same key and the same body is still being processed. Both use the **flat** envelope: `error` is the HTTP reason phrase and the machine-readable code is the top-level `code`. Note that `IDEMPOTENCY_CONFLICT` raised later by the withdrawal service on an idempotency-key collision uses the nested `Error` envelope instead.

## Changes

- **2026-08-27** `9d4ba1cc037c` — 1 breaking, 3 warning, 3 info
  - the `error` response's property type/format changed from `object`/`` to `string`/`` for status `409`
  - removed the optional property `error/code` from the response with the `409` status
  - removed the optional property `error/details` from the response with the `409` status
  - removed the optional property `error/message` from the response with the `409` status
  - …3 more
- **2026-05-03** `a382df24e843` — 1 warning, 1 info
  - removed the optional property `customer/id` from the response with the `201` status
  - added the optional property `customer/customerId` to the response with the `201` status
- **2026-04-14** `c75657100757` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/yuvexpay/apis/yuvexpay-api/changes/v1/customers/post.md)

---

[API](https://skmtc.dev/yuvexpay/apis/yuvexpay-api.md) · [All operations](https://skmtc.dev/yuvexpay/apis/yuvexpay-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/yuvexpay/yuvexpay-api/revisions/746526879975/schema)
