Clientes

Criar Cliente

POST/v1/customers
Base URL Produção:https://api.validapay.com.br
Base URL Sandbox:https://sandbox.validapay.com.br

Autenticaçã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

CampoObrig.TipoDescrição
namestringNome completo
phonestringE.164
emailstringemail válido
documentstringCPF (11) ou CNPJ (14), só dígitos
upsertbooleanSe 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

FieldTypeRequiredDescription
name
string-
-
phone
string-
-
email
string-
-
document
string-
-
upsert
boolean-
-

Headers

NameTypeValueRequired
Content-Type-application/jsonOptional
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"
}