Criar cliente
curl --request POST \
--url https://api.upag.io/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"document": {}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', document: {}})
};
fetch('https://api.upag.io/v1/customers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.upag.io/v1/customers';
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', document: {}})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Clientes
Criar cliente
Cadastra um cliente na conta
POST
https://api.upag.io
/
v1
/
customers
Criar cliente
curl --request POST \
--url https://api.upag.io/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"document": {}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', document: {}})
};
fetch('https://api.upag.io/v1/customers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://api.upag.io/v1/customers';
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', document: {}})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Cadastra um cliente. O documento (CPF/CNPJ) é único por conta.
Permissão:
Campos em Referência.
customer.write. Apenas chave secreta (sk_…).
Os exemplos usam o sandbox (
https://api.upag.dev/v1). Em produção use https://api.upag.io/v1 com sk_live_….Endpoint
curl -X POST https://api.upag.dev/v1/customers \
-H "Authorization: Bearer sk_test_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "Maria Souza",
"email": "maria@example.com",
"document": { "type": "cpf", "number": "12345678909" },
"phone": { "countryCode": "55", "areaCode": "11", "number": "999998888" },
"address": {
"street": "Avenida Paulista",
"number": "1578",
"neighborhood": "Bela Vista",
"city": "São Paulo",
"state": "SP",
"country": "BR",
"zip": "01310200"
}
}'
import { Upag } from 'upag';
const upag = new Upag('sk_test_your_api_key');
const customer = await upag.customers.create({
name: 'Maria Souza',
email: 'maria@example.com',
document: { type: 'cpf', number: '12345678909' },
phone: { countryCode: '55', areaCode: '11', number: '999998888' },
address: {
street: 'Avenida Paulista',
number: '1578',
neighborhood: 'Bela Vista',
city: 'São Paulo',
state: 'SP',
country: 'BR',
zip: '01310200',
},
});
Parâmetros
string
required
Nome (mínimo 1 caractere).
object
required
Documento do cliente.
type:cpfoucnpj.number: CPF com 11 dígitos, ou CNPJ válido (inclusive o alfanumérico). Pontos, barra e hífen são removidos.
string | null
E-mail válido. String vazia é tratada como ausente.
object | null
countryCode, areaCode e number (strings não vazias). Os três são obrigatórios quando phone é enviado.object | null
street, number, complement, neighborhood, city, state, country, zip. Todos opcionais e anuláveis; string vazia vira null.Resposta
201 Created
Response
{
"id": "8c1f0a26-5d3b-4f1e-9c72-1a4e6b9d0f83",
"name": "Maria Souza",
"email": "maria@example.com",
"document": { "number": "12345678909", "type": "cpf" },
"phone": { "countryCode": "55", "areaCode": "11", "number": "999998888" },
"address": {
"street": "Avenida Paulista",
"number": "1578",
"complement": null,
"neighborhood": "Bela Vista",
"city": "São Paulo",
"state": "SP",
"country": "BR",
"zip": "01310200"
},
"createdAt": "2026-07-27T18:04:11.482Z",
"updatedAt": "2026-07-27T18:04:11.482Z"
}
Erros
| Status | Mensagem | Causa |
|---|---|---|
409 | Customer with this document number already exists | Já existe cliente com esse documento na conta |
422 | VALIDATION_FAILED | Corpo inválido (documento, e-mail, telefone incompleto…) |