curl --request POST \
--url http://localhost:3000/orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"externalOrderId": "PED-10023",
"tenantId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"originZip": "01001-000",
"destinationZip": "89010-000",
"notes": "Entregar somente após as 14h. Documento: NF-e 12345.",
"items": [
{
"description": "Sofá de 3 lugares retrátil",
"weight": 85.5,
"quantity": 2
}
]
}
'import requests
url = "http://localhost:3000/orders"
payload = {
"externalOrderId": "PED-10023",
"tenantId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"originZip": "01001-000",
"destinationZip": "89010-000",
"notes": "Entregar somente após as 14h. Documento: NF-e 12345.",
"items": [
{
"description": "Sofá de 3 lugares retrátil",
"weight": 85.5,
"quantity": 2
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
externalOrderId: 'PED-10023',
tenantId: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
originZip: '01001-000',
destinationZip: '89010-000',
notes: 'Entregar somente após as 14h. Documento: NF-e 12345.',
items: [{description: 'Sofá de 3 lugares retrátil', weight: 85.5, quantity: 2}]
})
};
fetch('http://localhost:3000/orders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/orders",
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([
'externalOrderId' => 'PED-10023',
'tenantId' => 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
'originZip' => '01001-000',
'destinationZip' => '89010-000',
'notes' => 'Entregar somente após as 14h. Documento: NF-e 12345.',
'items' => [
[
'description' => 'Sofá de 3 lugares retrátil',
'weight' => 85.5,
'quantity' => 2
]
]
]),
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 := "http://localhost:3000/orders"
payload := strings.NewReader("{\n \"externalOrderId\": \"PED-10023\",\n \"tenantId\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"originZip\": \"01001-000\",\n \"destinationZip\": \"89010-000\",\n \"notes\": \"Entregar somente após as 14h. Documento: NF-e 12345.\",\n \"items\": [\n {\n \"description\": \"Sofá de 3 lugares retrátil\",\n \"weight\": 85.5,\n \"quantity\": 2\n }\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("http://localhost:3000/orders")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"externalOrderId\": \"PED-10023\",\n \"tenantId\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"originZip\": \"01001-000\",\n \"destinationZip\": \"89010-000\",\n \"notes\": \"Entregar somente após as 14h. Documento: NF-e 12345.\",\n \"items\": [\n {\n \"description\": \"Sofá de 3 lugares retrátil\",\n \"weight\": 85.5,\n \"quantity\": 2\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/orders")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"externalOrderId\": \"PED-10023\",\n \"tenantId\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"originZip\": \"01001-000\",\n \"destinationZip\": \"89010-000\",\n \"notes\": \"Entregar somente após as 14h. Documento: NF-e 12345.\",\n \"items\": [\n {\n \"description\": \"Sofá de 3 lugares retrátil\",\n \"weight\": 85.5,\n \"quantity\": 2\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"shipmentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"trackingCode": "<string>",
"status": "PENDING",
"recipientName": "<string>",
"destinationZip": "<string>"
}Criar pedido (frota própria)
Cria um novo envio de frota própria a partir do painel admin ou de um webhook de ERP. Este é o endpoint de referência para simular uma entrada completa via API: destinatário (com endereço), CEPs de origem/destino, itens/produtos, pedido externo e observações. O CEP de destino é usado para geocodificar e enriquecer o endereço automaticamente.
Autenticação: use um token JWT no header Authorization: Bearer <token> (painel admin)
OU uma chave de API no header X-API-Key: bk_... (webhook/ERP). Com a chave de API,
o tenant é resolvido automaticamente a partir da chave — não é necessário enviar tenantId.
curl --request POST \
--url http://localhost:3000/orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"externalOrderId": "PED-10023",
"tenantId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"originZip": "01001-000",
"destinationZip": "89010-000",
"notes": "Entregar somente após as 14h. Documento: NF-e 12345.",
"items": [
{
"description": "Sofá de 3 lugares retrátil",
"weight": 85.5,
"quantity": 2
}
]
}
'import requests
url = "http://localhost:3000/orders"
payload = {
"externalOrderId": "PED-10023",
"tenantId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"originZip": "01001-000",
"destinationZip": "89010-000",
"notes": "Entregar somente após as 14h. Documento: NF-e 12345.",
"items": [
{
"description": "Sofá de 3 lugares retrátil",
"weight": 85.5,
"quantity": 2
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
externalOrderId: 'PED-10023',
tenantId: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
originZip: '01001-000',
destinationZip: '89010-000',
notes: 'Entregar somente após as 14h. Documento: NF-e 12345.',
items: [{description: 'Sofá de 3 lugares retrátil', weight: 85.5, quantity: 2}]
})
};
fetch('http://localhost:3000/orders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/orders",
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([
'externalOrderId' => 'PED-10023',
'tenantId' => 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
'originZip' => '01001-000',
'destinationZip' => '89010-000',
'notes' => 'Entregar somente após as 14h. Documento: NF-e 12345.',
'items' => [
[
'description' => 'Sofá de 3 lugares retrátil',
'weight' => 85.5,
'quantity' => 2
]
]
]),
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 := "http://localhost:3000/orders"
payload := strings.NewReader("{\n \"externalOrderId\": \"PED-10023\",\n \"tenantId\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"originZip\": \"01001-000\",\n \"destinationZip\": \"89010-000\",\n \"notes\": \"Entregar somente após as 14h. Documento: NF-e 12345.\",\n \"items\": [\n {\n \"description\": \"Sofá de 3 lugares retrátil\",\n \"weight\": 85.5,\n \"quantity\": 2\n }\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("http://localhost:3000/orders")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"externalOrderId\": \"PED-10023\",\n \"tenantId\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"originZip\": \"01001-000\",\n \"destinationZip\": \"89010-000\",\n \"notes\": \"Entregar somente após as 14h. Documento: NF-e 12345.\",\n \"items\": [\n {\n \"description\": \"Sofá de 3 lugares retrátil\",\n \"weight\": 85.5,\n \"quantity\": 2\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/orders")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"externalOrderId\": \"PED-10023\",\n \"tenantId\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"originZip\": \"01001-000\",\n \"destinationZip\": \"89010-000\",\n \"notes\": \"Entregar somente após as 14h. Documento: NF-e 12345.\",\n \"items\": [\n {\n \"description\": \"Sofá de 3 lugares retrátil\",\n \"weight\": 85.5,\n \"quantity\": 2\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"shipmentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"trackingCode": "<string>",
"status": "PENDING",
"recipientName": "<string>",
"destinationZip": "<string>"
}Authorizations
JWT token obtido via endpoint /auth/login
Body
ID do pedido no ERP/cliente (opcional).
"PED-10023"
ID do tenant. Apenas para admins; por padrão usa o tenant do usuário ou o primeiro ativo.
"a1b2c3d4-e5f6-7890-abcd-ef1234567890"
Show child attributes
Show child attributes
CEP de origem (opcional).
^\d{5}-?\d{3}$"01001-000"
CEP de destino.
^\d{5}-?\d{3}$"89010-000"
Observações da entrega.
"Entregar somente após as 14h. Documento: NF-e 12345."
Itens/produtos do pedido.
Show child attributes
Show child attributes