Clientes
Criar Cliente
POST
/v1/customersBase URL Produção:
https://api.validapay.com.brBase URL Sandbox:
https://sandbox.validapay.com.brAutenticação
bearerAuthorizationstring · header · obrigatório
Envie no header:
Authorization: Bearer {{token}}Cria um novo cliente com dados pessoais como nome, CPF/CNPJ, e-mail e endereço.
Criar cliente
Scopes: customers/write
| Campo | Obrig. | Tipo | Descrição |
|---|---|---|---|
name | ✅ | string | Nome completo |
phone | ✅ | string | E.164 |
email | ❌ | string | email válido |
document | ✅ | string | CPF (11) ou CNPJ (14), só dígitos |
upsert | ❌ | boolean | Se true, retorna existente sem erro |
Body
application/json
Content-Type:application/json
{
"name": "João da Silva",
"phone": "+5511999998888",
"email": "joao@email.com",
"document": "12345678901",
"upsert": false
}Schema
| Field | Type | Required | Description |
|---|---|---|---|
name | string | - | - |
phone | string | - | - |
email | string | - | - |
document | string | - | - |
upsert | boolean | - | - |
Headers
| Name | Type | Value | Required |
|---|---|---|---|
| Content-Type | - | application/json | Optional |
const url = 'https://sandbox.validapay.com.br/v1/customers';
const options = {
method: 'POST',
headers: {
'Authorization': 'Bearer {{token}}',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "João da Silva",
"phone": "+5511999998888",
"email": "joao@email.com",
"document": "12345678901",
"upsert": false
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));Response Examples
201201
{
"customer": {
"customerId": "cus_xxx",
"name": "João da Silva",
"document": "12345678901",
"createdAt": "2024-01-15T10:30:00Z"
}
}400400 existe
{
"code": "CUSTOMER_ALREADY_EXISTS"
}400400 inválido
{
"code": "INVALID_DATA",
"message": "Documento inválido"
}