Criar rota para novos pedidos

Cria uma rota agrupando pedidos recém-criados, definindo motorista e ordem de paradas.

Header obrigatório. Toda chamada exige o header x-abbiamo-seller-group-key. Preencha-o no canto superior direito desta página ou veja como obter a sua chave.

Rate limit: 300 requisições por minuto por chave. Acima disso a API retorna HTTP 429.

Orders in a route can have type: RETURN. For return orders, provide source_address (the customer's address where the driver will collect the package) instead of destination_address. The system will use this address as the order's destination internally.

The type field defaults to DELIVERY when not provided.

Este endpoint cria múltiplos pedidos numa mesma rota. Uma rota é um conjunto de pedidos agrupados e atribuídos a um motorista. O campo driver_document é opcional — quando a rota é enviada sem driver_document, o sistema cria uma rota ociosa, sem transportadora nem motorista atribuídos, que pode ser atribuída depois pelo dashboard.

Edge cases

  • The driver_document, quando informado, precisa ser de um motorista atribuído a pelo menos uma das filiais dos pedidos criados
  • The response field already_exists indicates whether the order exists or not in the system when the request is made.
  • If one or more orders already exists in the system there are two possible outcomes:
    • they are routable and therefore they'd be assigned together with new orders in the route
    • they are not routable and the request would throw an API error

⛔ Este endpoint não edita pedidos. Se um ou mais pedidos já existem no sistema com endereço diferente do enviado na requisição, o pedido antigo (com o endereço antigo) é agrupado na rota.

POST
/v2/orders/route
x-abbiamo-seller-group-key<token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/v2/orders/route" \  -H "Content-Type: application/json" \  -d '{    "orders": [      {        "seller_identifier": "123",        "order_number": "136411776",        "volumes": [          {            "items": [              {                "name": "Exemplo 1"              }            ]          }        ],        "customer": {          "name": "Joao Guilherme"        },        "destination_address": {          "zip_code": "01412100",          "state": "RJ",          "city": "Rio de Janeiro",          "neighborhood": "Ipanema",          "street": "Rua Conde de Bonfim",          "street_number": "10"        }      },      {        "seller_identifier": "123",        "order_number": "136411777",        "volumes": [          {            "items": [              {                "name": "Exemplo 2"              }            ]          }        ],        "customer": {          "name": "Eduardo Dantas"        },        "destination_address": {          "zip_code": "22071060",          "state": "RJ",          "city": "Rio de Janeiro",          "neighborhood": "Copacabana",          "street": "Rua Saint Roman",          "street_number": "83"        }      }    ],    "route": {      "start": {        "type": "WAREHOUSE_SELLER_IDENTIFIER",        "value": "123"      },      "end": {        "type": "WAREHOUSE_SELLER_IDENTIFIER",        "value": "123"      },      "cost": 1200    }  }'
"{\n  \"status\": \"success\",\n  \"route\": {\n  \t\"id\": \"1d1dfa9c-4fe2-4315-9d65-ec0e8f95d239\",\n    \"cost\": 1200,\n  },\n  \"orders\": [\n    {\n      \"id\": \"30c24480-8e45-4afa-af35-0231b460e9ed\",\n      \"order_number\": \"136411776\",\n      \"tracking\": \"abc123#\",\n      \"already_exists\": true,\n  \t\t\"mail_label_link\": \"https://mail-label-api.abbiamo.io/mail-label/v1?trackings=abc123#\",\n  \t\t\"tracking_link\": \"http://meupedido.abbiamolog.com/abc123#\"\n    },\n    {\n      \"id\": \"96bed76f-4453-4dea-addc-521d9476b513\",\n      \"order_number\": \"136411777\",\n    \t\"tracking\": \"def456!\",\n      \"already_exists\": true,\n  \t\t\"mail_label_link\": \"https://mail-label-api.abbiamo.io/mail-label/v1?trackings=def456!\",\n  \t\t\"tracking_link\": \"http://meupedido.abbiamolog.com/def456!\"\n    },\n    {\n      \"id\": \"164f51fb-92c2-4041-8a7d-3aa87c82352e\",\n      \"order_number\": \"136411778\",\n    \t\"tracking\": \"ghi789=\",\n      \"already_exists\": false,\n  \t\t\"mail_label_link\": \"https://mail-label-api.abbiamo.io/mail-label/v1?trackings=ghi789=\",\n  \t\t\"tracking_link\": \"http://meupedido.abbiamolog.com/ghi789=\"\n    },\n    {\n      \"id\": \"1a72e4d8-d2cc-4a2d-ba2c-b5c91181a8e2\",\n      \"order_number\": \"136411779\",\n    \t\"tracking\": \"jkl101_\",\n      \"already_exists\": false,\n  \t\t\"mail_label_link\": \"https://mail-label-api.abbiamo.io/mail-label/v1?trackings=jkl101_\",\n  \t\t\"tracking_link\": \"http://meupedido.abbiamolog.com/jkl101_\"\n    }\n  ]\n}"

"{\n  \"statusCode\": \"400\",\n  \"message\": [\n    \"order_number must be a string\",\n    \"volumes must contain at least 1 elements\",\n    \"volumes must be an array\",\n    \"customer must be a non-empty object\",\n    \"customer must be an object\",\n    \"destination_address must be a non-empty object\",\n    \"destination_address must be an object\"\n  ],\n  \"error\": \"Bad Request\"\n}"

Nesta página