Route planner query

Allows clients to retrieve alternative routes and detailed route information based on a list of locations and route/vehicle configurations. The response includes data such as distance, duration, coordinates, tolls (with fees, locations, and free-flow indicators), and the states (UF) covered.


Method and route

  • POST: /consulta/consultaRoteirizador/{enterpriseId}

Request structure

Headers

  • Authorization: The JWT token must be sent in the header.

Authorization: Bearer {token}

Body

The request must include a JSON with two groups:

  • locations: List of locations for route calculation

  • config: Additional route and vehicle configuration

Example:

{
  "locations": [
    "Ponta Grossa, PR",
    "Diadema, SP",
    "Belo Horizonte, MG"
  ],
  "config": {
    "route": {
      "optimized_route": false,
      "optimized_route_destination": "last",
      "calculate_return": false,
      "alternative_routes": "2",
      "type_route": "efficient"
    },
    "vehicle": {
      "type": "truck",
      "axis": "7"
    },
    "freight_table": {
      "category": "A",
      "freight_load": "granel_solido"
    }
  }
}

Layout

Field

Type

Description

locations

array

List of location strings. Supported formats:

  • City/State → "São Paulo, SP"

  • ZIP code → "12345678"

  • Full address

  • Latitude/Longitude → "-27.81971,-50.32099"

Config

Groups route, vehicle, and freight settings.

Route

Field

Type

Description

route

object

Route settings

route.optimized_route

boolean

Optimizes delivery order if true; keeps input order if false

route.optimized_route_destination

string

"last" uses last location; "best" calculates optimal destination

route.calculate_return

boolean

Includes return route if true

route.alternative_routes

string

Number of alternative routes

route.type_route

string

"efficient", "shortest", "avoid_tolls"

Vehicle

Field

Type

Description

vehicle

object

Vehicle settings

vehicle.type

string

"truck" or "car"

vehicle.axis

string

Number of axles

Freight Table

Field

Type

Description

freight_table

object

Freight table data (ANTT)

freight_table.category

string

Load category: A, B, C, or D

freight_table.freight_load

string

Load type (e.g., granel_solido, geral, perigosa_geral)


Behavior

  • The API processes the provided locations and configuration

  • Routes are calculated based on the defined parameters


Response

Returns:

  • A list of calculated routes (distance, duration, tolls, etc.)

  • The list of input locations

Example of a successful response:

{
  "rotas": [
    {
      "distancia": {
        "texto": "1125 km",
        "valor": 1125
      },
      "distancia_nao_pavimentada": {
        "texto": "0 km",
        "valor": 0,
        "percentual_texto": "0%",
        "percentual_valor": 0
      },
      "duracao": {
        "texto": "12:23:49",
        "valor": 44629
      },
      "endereco_inicio": "ponta grossa",
      "endereco_fim": "belo horizonte, mg",
      "coordenada_inicio": "-25.09492,-50.16311",
      "coordenada_fim": "-19.91952,-43.93833",
      "pedagios": [
        {
          "codigo_antt": "41411513040000103",
          "nome": "P5 - Carambeí",
          "tarifa": { "7": 79.8 },
          "latitude": -24.912136893155846,
          "longitude": -50.086694732308395,
          "is_free_flow": 0
        }
      ],
      "polilinha": "string criptografada",
      "ufs": [
        "PR",
        "SP",
        "MG"
      ],
      "tabela_frete": 7915.02
    }
  ],
  "locais": [
    "Ponta Grossa",
    "Diadema, SP",
    "Belo Horizonte, MG"
  ]
}

Response Layout

rotas

List of calculated routes. Each item contains the fields below.

Field

Type

Description

distancia

object

Total route distance

distancia.texto

string

Formatted distance (e.g., "1125 km")

distancia.valor

number

Distance value (e.g., 1125)

distancia_nao_pavimentada

object

Unpaved distance details

distancia_nao_pavimentada.texto

string

Formatted unpaved distance

distancia_nao_pavimentada.valor

number

Unpaved distance value

distancia_nao_pavimentada.percentual_texto

string

Percentage (e.g., "0%")

distancia_nao_pavimentada.percentual_valor

number

Percentage value

duracao

object

Estimated duration

duracao.texto

string

Formatted duration (e.g., "12:23:49")

duracao.valor

number

Duration in seconds (e.g., 44629)

endereco_inicio

string

Route starting location

endereco_fim

string

Route ending location

coordenada_inicio

string

Start coordinates (latitude,longitude)

coordenada_fim

string

End coordinates (latitude,longitude)

pedagios

array

List of toll plazas along the route

pedagios.codigo_antt

string

ANTT toll identifier

pedagios.nome

string

Toll plaza name

pedagios.tarifa

object

Toll values by axle category (e.g., "7": 79.8)

pedagios.latitude

number

Toll latitude

pedagios.longitude

number

Toll longitude

pedagios.is_free_flow

number

Free-flow indicator (0 or 1)

polilinha

string

Encoded polyline representing the route

ufs

array

List of states (UFs) covered

tabela_frete

number

ANTT minimum freight value

locais

Field

Type

Description

locais

array

Echoes the input locations

HTTP Status

  • 200 or 201: Request successful

  • 400: Validation error (e.g., invalid request parameters)

  • 401: Unauthorized (missing or invalid JWT token)

  • 500: Internal server error or unhandled exception