# Listar Rutas

Mediante este endpoint se pueden buscar rutas por fecha de asignacion. Además se puede luego filtrar por device\_id

Para obtener la lista de Rutas se debe realizar un GET como el que se muestra a continuación

<mark style="color:blue;">`GET`</mark> `https://api.persat.com.ar/v1/deliveryRoutes`

#### Query Parameters

<table><thead><tr><th width="134">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>date<mark style="color:red;">*</mark></td><td>String isoDate</td><td>Fecha en formato ISO. Ej: "2020-01-01T00:00:00.000Z"</td></tr><tr><td>device_id</td><td>Number</td><td>Identificador del vehiculo al cual se asignó la ruta</td></tr></tbody></table>

#### Headers

| Name                                            | Type   | Description     |
| ----------------------------------------------- | ------ | --------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer API\_KEY |

### Respuesta

{% tabs %}
{% tab title="200: OK La consulta se ejecutó con éxito" %}

```json
{
    "success": true,
    "data": [
       {
         "_id":1707684808389,
         "assignation_info":{
            "assigned_date":"2024-02-11T00:00:00.000Z",
            "device_id":14,
            "device_name":"AA123ZZ Leonardo Diaz"
         },
         "departure":{
            "name":"Deposito Principal",
            "planned_departure_time":480
         },
         "deliveries":[
            {
               "_id":"JGBG41276",
               "state":"FINISHED",
               "planned_arrival_time":489,
               "arrival_time": 501            /* Solo cuando el Chofer entregó */
            },
            {
               "_id":"EJDS48377",
               "state":"ASSIGNED",
               "planned_arrival_time":508
            },
            {
               "_id":"RGLU11921",
               "state":"ASSIGNED",
               "planned_arrival_time":525
            },
            {
               "_id":"AQAW56259",
               "state":"ASSIGNED",
               "planned_arrival_time":536
            }
         ],
         "arrival":{
            "name":"Deposito Minoristas",
            "planned_arrival_time":558
         },
         "route_distance":15650,
         "route_time":78 
       }, {...}
    ]
}
```

{% endtab %}

{% tab title="400: device\_id no es un número" %}

```json
{
    "success": false,
    "error": {
        "status": 400,
        "type": "BAD_REQUEST",
        "userMessage": "device_id debe ser un number"
    }
}
```

{% endtab %}
{% endtabs %}

### Análisis de la respuesta

El resultado es un array de Rutas. La explicación de cada uno de los campos se puede ver en el endpoint [Obtener Ruta](/modulos/gestion-de-entregas/rutas-de-entrega/obtener-ruta.md)

{% hint style="info" %}
En caso de no haber resultados se recibirá un array vacío.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.api.persat.com.ar/modulos/gestion-de-entregas/rutas-de-entrega/listar-rutas.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
