Criar cliente
curl --request POST \
--url https://api.nasten.net/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Ana Souza",
"document": "01234567890",
"email": "ana.souza@exemplo.com.br",
"phone": "11912345678",
"birthDate": "1995-03-10",
"mailMarketing": false,
"taxFree": false,
"tags": [
"vip"
],
"notes": "<string>",
"billingAddresses": [
{
"street": "<string>",
"number": "<string>",
"neighborhood": "<string>",
"city": "<string>",
"state": "<string>",
"zipCode": "<string>",
"complement": "<string>"
}
],
"extraEmails": [
"jsmith@example.com"
],
"extraPhones": [
"<string>"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Ana Souza',
document: '01234567890',
email: 'ana.souza@exemplo.com.br',
phone: '11912345678',
birthDate: '1995-03-10',
mailMarketing: false,
taxFree: false,
tags: ['vip'],
notes: '<string>',
billingAddresses: [
{
street: '<string>',
number: '<string>',
neighborhood: '<string>',
city: '<string>',
state: '<string>',
zipCode: '<string>',
complement: '<string>'
}
],
extraEmails: ['jsmith@example.com'],
extraPhones: ['<string>']
})
};
fetch('https://api.nasten.net/v1/customers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.nasten.net/v1/customers"
payload = {
"name": "Ana Souza",
"document": "01234567890",
"email": "ana.souza@exemplo.com.br",
"phone": "11912345678",
"birthDate": "1995-03-10",
"mailMarketing": False,
"taxFree": False,
"tags": ["vip"],
"notes": "<string>",
"billingAddresses": [
{
"street": "<string>",
"number": "<string>",
"neighborhood": "<string>",
"city": "<string>",
"state": "<string>",
"zipCode": "<string>",
"complement": "<string>"
}
],
"extraEmails": ["jsmith@example.com"],
"extraPhones": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nasten.net/v1/customers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Ana Souza',
'document' => '01234567890',
'email' => 'ana.souza@exemplo.com.br',
'phone' => '11912345678',
'birthDate' => '1995-03-10',
'mailMarketing' => false,
'taxFree' => false,
'tags' => [
'vip'
],
'notes' => '<string>',
'billingAddresses' => [
[
'street' => '<string>',
'number' => '<string>',
'neighborhood' => '<string>',
'city' => '<string>',
'state' => '<string>',
'zipCode' => '<string>',
'complement' => '<string>'
]
],
'extraEmails' => [
'jsmith@example.com'
],
'extraPhones' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nasten.net/v1/customers"
payload := strings.NewReader("{\n \"name\": \"Ana Souza\",\n \"document\": \"01234567890\",\n \"email\": \"ana.souza@exemplo.com.br\",\n \"phone\": \"11912345678\",\n \"birthDate\": \"1995-03-10\",\n \"mailMarketing\": false,\n \"taxFree\": false,\n \"tags\": [\n \"vip\"\n ],\n \"notes\": \"<string>\",\n \"billingAddresses\": [\n {\n \"street\": \"<string>\",\n \"number\": \"<string>\",\n \"neighborhood\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zipCode\": \"<string>\",\n \"complement\": \"<string>\"\n }\n ],\n \"extraEmails\": [\n \"jsmith@example.com\"\n ],\n \"extraPhones\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.nasten.net/v1/customers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Ana Souza\",\n \"document\": \"01234567890\",\n \"email\": \"ana.souza@exemplo.com.br\",\n \"phone\": \"11912345678\",\n \"birthDate\": \"1995-03-10\",\n \"mailMarketing\": false,\n \"taxFree\": false,\n \"tags\": [\n \"vip\"\n ],\n \"notes\": \"<string>\",\n \"billingAddresses\": [\n {\n \"street\": \"<string>\",\n \"number\": \"<string>\",\n \"neighborhood\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zipCode\": \"<string>\",\n \"complement\": \"<string>\"\n }\n ],\n \"extraEmails\": [\n \"jsmith@example.com\"\n ],\n \"extraPhones\": [\n \"<string>\"\n ]\n}")
.asString();{
"success": true,
"data": {
"id": "cmcliente000000000000001",
"companyId": "<string>",
"name": "Ana Souza",
"documentType": "CPF",
"document": "01234567890",
"email": "ana.souza@exemplo.com.br",
"phone": "11912345678",
"birthDate": "2023-11-07T05:31:56Z",
"mailMarketing": true,
"taxFree": true,
"tags": [
"<string>"
],
"notes": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z",
"address": {
"street": "Avenida Paulista",
"streetNumber": "1000",
"neighborhood": "Bela Vista",
"city": "São Paulo",
"state": "SP",
"zipCode": "01310100",
"complement": "<string>",
"id": 123,
"customerId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
},
"BillingAddress": [
{}
],
"emails": [
{}
],
"phones": [
{}
]
}
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a",
"errors": [
{
"path": "customer.document",
"message": "Documento inválido"
}
]
}{
"success": false,
"message": "Token inválido ou expirado",
"code": "NST-401-rcp9"
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a"
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a"
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a",
"error": "Too Many Requests",
"retryAfterMs": 42000,
"limit": 1800,
"window": "1 minute"
}{
"success": false,
"message": "Internal server error",
"code": "NST-500-9e2b"
}Clientes
Criar cliente
Cria um cliente da sua empresa. Se já existe cliente ativo com o mesmo documento, devolve o cadastro existente,
também com 201, sem alterar nada e sem address, BillingAddress, emails e phones.
Cliente criado com a chave de teste é real.
POST
/
v1
/
customers
Criar cliente
curl --request POST \
--url https://api.nasten.net/v1/customers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Ana Souza",
"document": "01234567890",
"email": "ana.souza@exemplo.com.br",
"phone": "11912345678",
"birthDate": "1995-03-10",
"mailMarketing": false,
"taxFree": false,
"tags": [
"vip"
],
"notes": "<string>",
"billingAddresses": [
{
"street": "<string>",
"number": "<string>",
"neighborhood": "<string>",
"city": "<string>",
"state": "<string>",
"zipCode": "<string>",
"complement": "<string>"
}
],
"extraEmails": [
"jsmith@example.com"
],
"extraPhones": [
"<string>"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Ana Souza',
document: '01234567890',
email: 'ana.souza@exemplo.com.br',
phone: '11912345678',
birthDate: '1995-03-10',
mailMarketing: false,
taxFree: false,
tags: ['vip'],
notes: '<string>',
billingAddresses: [
{
street: '<string>',
number: '<string>',
neighborhood: '<string>',
city: '<string>',
state: '<string>',
zipCode: '<string>',
complement: '<string>'
}
],
extraEmails: ['jsmith@example.com'],
extraPhones: ['<string>']
})
};
fetch('https://api.nasten.net/v1/customers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.nasten.net/v1/customers"
payload = {
"name": "Ana Souza",
"document": "01234567890",
"email": "ana.souza@exemplo.com.br",
"phone": "11912345678",
"birthDate": "1995-03-10",
"mailMarketing": False,
"taxFree": False,
"tags": ["vip"],
"notes": "<string>",
"billingAddresses": [
{
"street": "<string>",
"number": "<string>",
"neighborhood": "<string>",
"city": "<string>",
"state": "<string>",
"zipCode": "<string>",
"complement": "<string>"
}
],
"extraEmails": ["jsmith@example.com"],
"extraPhones": ["<string>"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nasten.net/v1/customers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Ana Souza',
'document' => '01234567890',
'email' => 'ana.souza@exemplo.com.br',
'phone' => '11912345678',
'birthDate' => '1995-03-10',
'mailMarketing' => false,
'taxFree' => false,
'tags' => [
'vip'
],
'notes' => '<string>',
'billingAddresses' => [
[
'street' => '<string>',
'number' => '<string>',
'neighborhood' => '<string>',
'city' => '<string>',
'state' => '<string>',
'zipCode' => '<string>',
'complement' => '<string>'
]
],
'extraEmails' => [
'jsmith@example.com'
],
'extraPhones' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nasten.net/v1/customers"
payload := strings.NewReader("{\n \"name\": \"Ana Souza\",\n \"document\": \"01234567890\",\n \"email\": \"ana.souza@exemplo.com.br\",\n \"phone\": \"11912345678\",\n \"birthDate\": \"1995-03-10\",\n \"mailMarketing\": false,\n \"taxFree\": false,\n \"tags\": [\n \"vip\"\n ],\n \"notes\": \"<string>\",\n \"billingAddresses\": [\n {\n \"street\": \"<string>\",\n \"number\": \"<string>\",\n \"neighborhood\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zipCode\": \"<string>\",\n \"complement\": \"<string>\"\n }\n ],\n \"extraEmails\": [\n \"jsmith@example.com\"\n ],\n \"extraPhones\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.nasten.net/v1/customers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Ana Souza\",\n \"document\": \"01234567890\",\n \"email\": \"ana.souza@exemplo.com.br\",\n \"phone\": \"11912345678\",\n \"birthDate\": \"1995-03-10\",\n \"mailMarketing\": false,\n \"taxFree\": false,\n \"tags\": [\n \"vip\"\n ],\n \"notes\": \"<string>\",\n \"billingAddresses\": [\n {\n \"street\": \"<string>\",\n \"number\": \"<string>\",\n \"neighborhood\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zipCode\": \"<string>\",\n \"complement\": \"<string>\"\n }\n ],\n \"extraEmails\": [\n \"jsmith@example.com\"\n ],\n \"extraPhones\": [\n \"<string>\"\n ]\n}")
.asString();{
"success": true,
"data": {
"id": "cmcliente000000000000001",
"companyId": "<string>",
"name": "Ana Souza",
"documentType": "CPF",
"document": "01234567890",
"email": "ana.souza@exemplo.com.br",
"phone": "11912345678",
"birthDate": "2023-11-07T05:31:56Z",
"mailMarketing": true,
"taxFree": true,
"tags": [
"<string>"
],
"notes": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z",
"address": {
"street": "Avenida Paulista",
"streetNumber": "1000",
"neighborhood": "Bela Vista",
"city": "São Paulo",
"state": "SP",
"zipCode": "01310100",
"complement": "<string>",
"id": 123,
"customerId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
},
"BillingAddress": [
{}
],
"emails": [
{}
],
"phones": [
{}
]
}
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a",
"errors": [
{
"path": "customer.document",
"message": "Documento inválido"
}
]
}{
"success": false,
"message": "Token inválido ou expirado",
"code": "NST-401-rcp9"
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a"
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a"
}{
"success": false,
"message": "Descrição do erro",
"code": "NST-400-3f7a",
"error": "Too Many Requests",
"retryAfterMs": 42000,
"limit": 1800,
"window": "1 minute"
}{
"success": false,
"message": "Internal server error",
"code": "NST-500-9e2b"
}Body
application/json

