Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/JorLOrT/rappi2/llms.txt

Use this file to discover all available pages before exploring further.

The Routes API lets you manually create delivery routes or auto-plan them via OpenRouteService (ORS). Each route belongs to an order (orden_id) and can carry an ordered list of stops (paradas). When auto-planning, the API calls ORS to compute distance and duration, then optionally creates a buffer geofence around the computed geometry in MongoDB.
All endpoints require a valid Bearer token. The required permission is noted on each operation.

List routes

GET /rutas Permission: rutas:read
orden_id
integer
Filter routes by order ID. Omit to return all routes.
curl -X GET "https://api.rappi2.com/rutas?orden_id=42" \
  -H "Authorization: Bearer <token>"
[
  {
    "id": 7,
    "orden_id": 42,
    "distancia_km": "12.500",
    "tiempo_estimado": "PT30M",
    "paradas": [
      {
        "id": 1,
        "ruta_id": 7,
        "orden_id": 42,
        "direccion": "Av. Arequipa 1234, Lima",
        "distrito": "Miraflores",
        "secuencia": 1,
        "estado": "Pendiente",
        "fecha_paso": null
      }
    ]
  }
]

Create route

POST /rutas Manually create a route with a set of stops. Permission: rutas:write
orden_id
integer
required
ID of the order this route belongs to. Must reference an existing order.
distancia_km
number
Total route distance in kilometres.
tiempo_estimado
string
Estimated travel time as an ISO 8601 duration string (e.g. "PT45M").
paradas
object[]
Ordered list of stops to include on creation.
curl -X POST "https://api.rappi2.com/rutas" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "orden_id": 42,
    "distancia_km": 12.5,
    "tiempo_estimado": "PT30M",
    "paradas": [
      {"direccion": "Av. Arequipa 1234", "distrito": "Miraflores", "secuencia": 1}
    ]
  }'
{
  "id": 7,
  "orden_id": 42,
  "distancia_km": "12.500",
  "tiempo_estimado": "PT30M",
  "paradas": [
    {
      "id": 1,
      "ruta_id": 7,
      "orden_id": 42,
      "direccion": "Av. Arequipa 1234",
      "distrito": "Miraflores",
      "secuencia": 1,
      "estado": "Pendiente",
      "fecha_paso": null
    }
  ]
}

Auto-plan route via ORS

POST /rutas/planificar Calls OpenRouteService to compute the optimal route between an origin and destination, stores the computed distance and travel time, and optionally creates a buffer geofence in MongoDB around the returned geometry. Permission: rutas:write
Returns 502 if the ORS service is unreachable or returns an error.
orden_id
integer
required
Order to associate with the planned route.
origen_lon
number
required
Origin longitude (-180 to 180).
origen_lat
number
required
Origin latitude (-90 to 90).
destino_lon
number
required
Destination longitude (-180 to 180).
destino_lat
number
required
Destination latitude (-90 to 90).
generar_geocerca
boolean
default:"true"
When true, a ruta_buffer geofence is created in MongoDB around the computed route geometry.
tolerancia_metros
integer
default:"50"
Buffer tolerance in metres for the geofence polygon (15000).
curl -X POST "https://api.rappi2.com/rutas/planificar" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "orden_id": 42,
    "origen_lon": -77.0282,
    "origen_lat": -12.0432,
    "destino_lon": -77.0531,
    "destino_lat": -12.1219,
    "generar_geocerca": true,
    "tolerancia_metros": 100
  }'
{
  "id": 8,
  "orden_id": 42,
  "distancia_km": "9.830",
  "tiempo_estimado": "PT22M30S",
  "paradas": []
}

Get route

GET /rutas/{ruta_id} Retrieve a single route with all its stops. Permission: rutas:read
ruta_id
integer
required
Route ID.
curl -X GET "https://api.rappi2.com/rutas/7" \
  -H "Authorization: Bearer <token>"
{
  "id": 7,
  "orden_id": 42,
  "distancia_km": "12.500",
  "tiempo_estimado": "PT30M",
  "paradas": []
}

Update route

PATCH /rutas/{ruta_id} Partially update a route’s distance or estimated time. All body fields are optional. Permission: rutas:write
ruta_id
integer
required
Route ID.
distancia_km
number
Updated distance in kilometres.
tiempo_estimado
string
Updated estimated duration as ISO 8601 duration (e.g. "PT1H").
curl -X PATCH "https://api.rappi2.com/rutas/7" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"distancia_km": 13.0}'

Delete route

DELETE /rutas/{ruta_id} Deletes the route and all associated geofences stored in MongoDB. Permission: rutas:delete
Deleting a route also removes all geofences linked to it from the geocercas collection in MongoDB.
ruta_id
integer
required
Route ID.
curl -X DELETE "https://api.rappi2.com/rutas/7" \
  -H "Authorization: Bearer <token>"

List stops

GET /rutas/{ruta_id}/paradas Return all stops for a route ordered by secuencia. Permission: rutas:read
ruta_id
integer
required
Route ID.
curl -X GET "https://api.rappi2.com/rutas/7/paradas" \
  -H "Authorization: Bearer <token>"
[
  {
    "id": 1,
    "ruta_id": 7,
    "orden_id": 42,
    "direccion": "Av. Arequipa 1234",
    "distrito": "Miraflores",
    "secuencia": 1,
    "estado": "Pendiente",
    "fecha_paso": null
  }
]

Add stop

POST /rutas/{ruta_id}/paradas Append a new stop to an existing route. Permission: rutas:write
ruta_id
integer
required
Route ID.
direccion
string
required
Street address of the stop.
secuencia
integer
required
Position in the delivery sequence (1-based).
orden_id
integer
Order associated with this stop.
distrito
string
District name.
estado
string
default:"Pendiente"
Initial stop status: Pendiente, Visitada, or Omitida.
curl -X POST "https://api.rappi2.com/rutas/7/paradas" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"direccion": "Jr. de la Union 500", "secuencia": 2, "distrito": "Cercado de Lima"}'
{
  "id": 2,
  "ruta_id": 7,
  "orden_id": null,
  "direccion": "Jr. de la Union 500",
  "distrito": "Cercado de Lima",
  "secuencia": 2,
  "estado": "Pendiente",
  "fecha_paso": null
}

Get stop

GET /rutas/{ruta_id}/paradas/{parada_id} Retrieve a single stop by ID, scoped to the given route. Permission: rutas:read
ruta_id
integer
required
Route ID.
parada_id
integer
required
Stop ID.
curl -X GET "https://api.rappi2.com/rutas/7/paradas/2" \
  -H "Authorization: Bearer <token>"

Update stop

PATCH /rutas/{ruta_id}/paradas/{parada_id} Update a stop’s status, timestamp, address, or district. All body fields are optional. Permission: rutas:write
ruta_id
integer
required
Route ID.
parada_id
integer
required
Stop ID.
estado
string
New status: Pendiente, Visitada, or Omitida.
fecha_paso
string
ISO 8601 datetime at which the stop was visited.
direccion
string
Updated street address.
distrito
string
Updated district name.
curl -X PATCH "https://api.rappi2.com/rutas/7/paradas/2" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"estado": "Visitada", "fecha_paso": "2026-05-22T14:30:00Z"}'

Delete stop

DELETE /rutas/{ruta_id}/paradas/{parada_id} Remove a stop from a route. Permission: rutas:write
ruta_id
integer
required
Route ID.
parada_id
integer
required
Stop ID.
curl -X DELETE "https://api.rappi2.com/rutas/7/paradas/2" \
  -H "Authorization: Bearer <token>"

Response schema

id
integer
required
Route ID (auto-incremented).
orden_id
integer
required
Order this route belongs to.
distancia_km
string
Distance in kilometres, returned as a decimal string.
tiempo_estimado
string
Estimated travel time in ISO 8601 duration format (e.g. "PT30M").
paradas
object[]
Ordered list of stops on this route.

Build docs developers (and LLMs) love