Skip to main content
POST
Create customer

Authorizations

Authorization
string
header
required

API key created in the organization settings.

Headers

Idempotency-Key
string

Unique key for the operation, 1 to 255 characters (a UUID, for example). Repeating the same key with the same body within 24 hours returns the original response instead of running it again.

Body

application/json

At least one of external_id, tax_id, email or phone. These are the same fields as the customer of an event.

external_id
string

The customer's id in your system. Letter case is ignored; leading and trailing spaces are removed.

Required string length: 1 - 255
tax_id
string

CPF or CNPJ, with or without punctuation. Must be valid.

Maximum string length: 32
email
string<email>

Stored in lowercase.

Maximum string length: 256
phone
string

E.164 (+5511988887777). Without a country code, the store's country is assumed.

Maximum string length: 32
name
string
Required string length: 1 - 256
attributes
object

Custom attributes by name. A new attribute is created with the inferred type. Ignored when the customer already exists.

Marketing opt-in of the new customer. Without it, the customer is created without opt-in.

Response

An active customer already had one of the identifiers sent. It is returned unchanged, nothing about it changes and no webhook is sent.

object
string
required
Allowed value: "customer"
id
string
required
Pattern: ^cus_[A-Za-z0-9_-]+$
created_at
string<date-time>
required
updated_at
string<date-time>
required
html_url
string<uri>
required
tags
object[]
required
attributes
object
required
name
string
email
string<email>
phone
string

Phone number with country code, when available.

source
string
is_subscribed
boolean
is_subscribed_to_email
boolean
total_spent_in_cents
integer
total_orders
integer
first_purchase_date
string<date-time>
last_purchase_date
string<date-time>
external_id
string

The id the store's system gave the customer (external_id of the create and of events).

identification
string
default_address
object