Skip to main content

How to use the API to create a customer?

To create a customer, use the API endpoint /api/v1/customer.

You can find the documentation for this endpoint here.

The required fields to create a customer are:

  • name: Customer name.

In addition to the name, you must send one of these three fields:

  • taxID: Customer CPF or CNPJ.
  • email: Customer email.
  • phone: Customer mobile phone (starting with 55 and the area code).

Example​

Your request body will look like one of these examples:

Example with taxID​

{
"name": "Dan",
"taxID": "360.***.***-72"
}

Example with email​

{
"name": "Dan",
"email": "dan@gmail.com"
}

Example with phone​

{
"name": "Dan",
"phone": "554899..."
}

After making the request, if everything went well, the request status code will be 2xx and the response body will contain the created customer.

We will return the following example response:

{
"customer": {
"name": "NOME DO CLIENTE",
"taxID": { "taxID": "360...", "type": "BR:CPF" },
"correlationID": "d1d46bbd-b010-4beb-b59e-cecf824efb43"
}
}

Code examples​

curl 'https://api.woovi.com/api/v1/customer' -X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "user-agent: node-fetch" \
--data-binary '{ "name": "Dan", "email": "dan@gmail.com" }'

How to use the API to create a customer with an address?​

When creating a customer, you can also add an address.

info

To create charges with a due date, fines and interest, the customer being charged must have a registered address, as well as their taxID (CPF/CNPJ). The following example assumes this use case.

So, the required fields are:

  • name: Customer name.
  • taxID: Customer CPF or CNPJ.
  • address: Customer address.

You can find documentation about the address object model here.

Example​

The request body, with the address data added, looks like this:

{
"name": "Ana",
"taxID": "672.***.***-51",
"address": {
"zipcode": "137...",
"street": "R...",
"number": "15",
"neighborhood": "Centro",
"city": "S...",
"state": "SP",
"complement": "Casa"
}
}

After making the request, if everything went well, the request status code will be 2xx and the response body will contain the created customer.

We will return the following example response:

{
"customer": {
"name": "ana",
"correlationID": "6ffa...",
"address": {
"zipcode": "137...",
"street": "R...",
"number": "15",
"neighborhood": "Centro",
"city": "S...",
"state": "SP",
"complement": "Casa"
},
"taxID": { "taxID": "67...", "type": "BR:CPF" }
}
}

Code examples​

curl 'https://api.woovi.com/api/v1/customer' -X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "user-agent: node-fetch" \
--data-binary '{"name": "Ana", "taxID": "672.***.***-51", "address": {
"zipcode": "137...", "street": "R...", "number": "15",
"neighborhood": "Centro", "city": "S...", "state": "SP",
"complement": "Casa" } }'