GET request
Finding Route plan(s)
You can search for Route Plan(s) by using the query param on the URL
URL: https://onfleet.com/api/v2/routePlans
Each request will return an array of Route Plans; depending on the querying params. The following is a list of params you can use to scope your search of Route Plans.
Available Query Params
| Name | Type | Description | 
|---|---|---|
| workerId | string | Optional. Search within this Worker id for the Route Plan. Cannot have multiple worker ids. | 
| startTimeTo | unix timestamp string | Optional. Route Plan Start Time | 
| startTimeFrom | unix timestamp string | Optional. Route Plan End Time | 
| createdTimeTo | unix timestamp string | Optional. Search for Route Plans that are created up to this time. | 
| createdTimeFrom | unix timestamp string | Optional. Search for Route Plans that are created starting at this time. | 
| hasTasks | boolean | Optional. If the route plan has task(s) or not. | 
| limit | number | Optional. Max limit of route plans in the response. Default is 500 and the max is 500. | 
curl -X GET "https://onfleet.com/api/v2/routePlans?workerId=sbgok3wJ77Ysg70zjImngv1J" \
       -u "cd3b3de84cc1ee040bf06512d233719c:" \[
    {
        "id": "jgfAFL8S69Pd8IhHYtw0njdw",
        "name": "R🔥_05-21-2025_1345",
        "state": "PENDING",
        "color": "#A8E7F0",
        "tasks": [],
        "organization": "nYrkNP6jZMSKgBwG9qG7ci3J",
        "team": "E2*f4lzgvpwwNMvDEHPLJVrr",
        "worker": "sbgok3wJ77Ysg70zjImngv1J",
        "vehicleType": "CAR",
        "startTime": 1747860353000,
        "endTime": null,
        "actualStartTime": null,
        "actualEndTime": null,
        "startAt": "HUB",
        "endAt": "HUB",
        "startingHubId": "FK9Uny9sQzcvBmEqHXqwWSeV",
        "endingHubId": "FK9Uny9sQzcvBmEqHXqwWSeV",
        "shortId": "78ed2d1a",
        "timeCreated": 1747860386236,
        "timeLastModified": 1748458689406,
        "timezone": "America/Los_Angeles",
        "plannedDistance": 120190,
        "plannedDuration": 7154,
        "isOverdue": true,
        "taskStates": [],
        "status": "LATE",
        "statusTimeDifference": 1131962944
    },
    {
        "id": "b8RybII*nzj*nWfnq2DlPfEY",
        "name": "R🔥_06-03-2025_1400",
        "state": "PENDING",
        "color": "#FF8B3E",
        "tasks": [
            "P3*vrseB7oOuNnioNvLot4tj",
            "rljrGT7LVThgc9cLDKt7jfxE",
            "hD6Ih8v7UgnMcDAanm6PRjVz",
            "DveAtA16a4KUiS1we9HC~huj",
            "c6*VrCgYQ487dqYMrafq5Nqt",
            "o*8jqK8NsgAYg6LmVtQygOCG"
        ],
        "organization": "nYrkNP6jZMSKgBwG9qG7ci3J",
        "team": "E2*f4lzgvpwwNMvDEHPLJVrr",
        "worker": "sbgok3wJ77Ysg70zjImngv1J",
        "vehicleType": "CAR",
        "startTime": 1748984436000,
        "endTime": null,
        "actualStartTime": null,
        "actualEndTime": null,
        "startAt": "HUB",
        "endAt": "HUB",
        "startingHubId": "08JQM9jnv44*A1ovSCTPg0uG",
        "endingHubId": "08JQM9jnv44*A1ovSCTPg0uG",
        "shortId": "22c55e19",
        "timeCreated": 1748984468123,
        "timeLastModified": 1748984468123,
        "timezone": "America/Los_Angeles",
        "plannedDistance": 225458,
        "plannedDuration": 11607,
        "isOverdue": false,
        "taskStates": [
            1,
            1,
            1,
            1,
            1,
            1
        ],
        "status": "LATE",
        "statusTimeDifference": 7879968
    }
]Note all of them will return the following computed properties:
- taskStates: is an array of integers that represent the state of each task. Its length will always match the tasks length. The nth element in- taskStatesis the state for the nth element in tasks.- Task states: 0 (unassigned), 1 (assigned to worker), 2 (active), 3 (completed)
 
- isOverdue: a boolean property. A route is considered overdue when:\- Route's last task ETA is 6 hours or more in the past
- If there's no last task, or the last task doesn't have an ETA yet then:
- if the Route's end date/time is 6 hours or more in the past
 
- Or, when none of the above, then if the Route's start date/time is yesterday or older
 
- status: Route Status is different from Route State. Route Status is an indicator of actual performance vs. the planned time of the Route, i.e., indicating On Time, Early, and Late;- statuscan be one of [- EARLY,- ON_TIME,- LATE,- UNAVAILABLE]
- statusTimeDifference: The time difference between actual times and planned times;- statusTimeDifferenceis a number indicating a duration in milliseconds
