Rotas
Criar Rota
Criar uma nova rota/território.
POST /api/routes
Cria uma nova rota para gestão de território.
Auth: Obrigatória — permissão route:manage
Corpo da Requisição
| Campo | Tipo | Obrigatório | Descrição |
|---|---|---|---|
code | string | Sim | Código único por tenant |
name | string | Sim | Nome da rota |
Exemplo
curl -X POST https://api.reten.ai/api/routes \
-H "Authorization: Bearer <token>" \
-H "x-tenant-id: <tenant-id>" \
-H "Content-Type: application/json" \
-d '{
"code": "ZONE-NORTH",
"name": "North Zone"
}'const response = await fetch("https://api.reten.ai/api/routes", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"x-tenant-id": "<tenant-id>",
"Content-Type": "application/json",
},
body: JSON.stringify({ code: "ZONE-NORTH", name: "North Zone" }),
});
const route = await response.json();import requests
response = requests.post(
"https://api.reten.ai/api/routes",
headers={
"Authorization": "Bearer <token>",
"x-tenant-id": "<tenant-id>",
},
json={"code": "ZONE-NORTH", "name": "North Zone"},
)
route = response.json()Resposta 201 Created
{
"id": "dd0e8400-e29b-41d4-a716-446655440000",
"code": "ZONE-NORTH",
"name": "North Zone",
"isActive": true
}Respostas de Erro
| Status | Descrição |
|---|---|
409 | O código da rota já existe |