> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mile.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Read routing schedule

> Retrieves the routing schedules of your organization, with the outcome of the last run of each one in `logExecuted`.

Requires the `view/routing-schedule` permission.



## OpenAPI

````yaml /openapi/public/openapi-routing.json get /routing/schedules
openapi: 3.0.0
info:
  title: MileApp API - Routing
  version: 3.0.0
  description: MileApp API Documentation - RESTful API for field operations management.
servers:
  - url: https://apiweb.mile.app/api/v3
security:
  - bearerAuth: []
tags:
  - name: Vehicle
    description: >-
      The vehicle represents a car, bike, truck, or other form of transportation
      used in your organization. They are utilized to optimize the route
      planning process, determining the most efficient path for completing
      multiple tasks or visits. The vehicle attributes contain IDs, capacity,
      speed, working hours, tags, and constraints.


      **To see the details of vehicle object, please follow [this
      link](#tag/vehicle_model)**
  - name: Routing
    description: >-
      The **Routing** refers to process of finding the most effective routes for
      vehicles to travel from one visit to another. The optimization process
      will generate a result that could update the respective task data when
      dispatched. With the ability to handle complex constraints and variables
      such as capacity, time windows, and vehicle availability, the API can be
      customized to meet the specific needs of any business or organization.


      **This section is for the v2 of routing api, if you still use the old one,
      please follow [this link](/v1) to see documentation**.


      **Routing results** are collection of route optimization's results that
      already successfully processed and saved in the database. Routing results
      contains list of routed visits and dropped visits.


      1. Routed visits are sequence recommendation of visits/tasks list
      according to most suitable vehicle and best route.

      2. Dropped visits are list of tasks/visits that out of range of the
      calculation.


      **To see the details of routing object, please follow [this
      link](#tag/route_model)**


      ## Why use Route Optimization


      With Route Optimization API, you can establish or refine an automated
      dispatch or route planning process that improves the operational
      efficiency of your transportation needs. With parameters to express your
      unique operational objectives and constraints, and an algorithm built on
      top of the trusted Google Maps data, the service generates the best
      possible route plans to meet those constraints. Some use-case examples
      follow:


      - A **logistics company** uses Route Optimization to optimize the
      assignments of all next-day shipments, providing a route for each shipment
      that optimizes for distance and time efficiency, cost saving, on time
      delivery, and driver and end customer satisfaction.


      - A **field service provider** uses Route Optimization to find the optimal
      route and sequence for technician's service appointments, and re-optimize
      when condition changes occur, such as en route delays.


      - An **on demand food delivery** company uses Route Optimization in their
      real-time dispatch process to choose the best active driver to pick up
      several new orders and insert it in their existing routes.


      - A **medical service provider** uses Route Optimization to map health
      providers to appointments, improving the efficiency of the routes for each
      provider across their day.


      ## How Route Optimization works


      The Route Optimization API uses a number of inputs to return a route plan.
      Inputs include vehicles, visits or shipments, configurations, and
      constraints. A route plan includes tasks assignment to vehicles, the
      multi-stop routes for each vehicle, and the related metrics.
  - name: Routing Schedule
    description: >-
      A Routing Schedule runs route optimization automatically at the times you
      set, without anyone opening the app. Each schedule points at one
      Configuration Profile, which supplies the hub and the vehicles for every
      run. When Auto Dispatch is enabled, the optimized routes are dispatched to
      the field users as soon as the optimization finishes.


      **Related Guide:** [Routing
      Schedule](/pages/route-optimization/schedule/introduction)
paths:
  /routing/schedules:
    get:
      tags:
        - Routing Schedule
      summary: Read routing schedule
      description: >-
        Retrieves the routing schedules of your organization, with the outcome
        of the last run of each one in `logExecuted`.


        Requires the `view/routing-schedule` permission.
      operationId: getRoutingSchedules
      parameters:
        - $ref: '#/components/parameters/pageInQuery'
        - name: limit
          in: query
          required: false
          description: >-
            Maximum number of schedules to retrieve in a single request.
            **Example:** `50`. **Default:** `20`. **Maximum:** `100`
          schema:
            type: integer
            default: 20
            minimum: 1
            maximum: 100
        - name: name
          in: query
          required: false
          description: >-
            Filter by schedule name, matching any part of it. **Example:**
            `morning`
          schema:
            type: string
        - $ref: '#/components/parameters/hubIdInQuery'
        - name: configurationId
          in: query
          required: false
          description: >-
            Filter by the Configuration Profile the schedule uses. **Example:**
            `65c3a1b2c3d4e5f600000009`
          schema:
            type: string
        - name: status
          in: query
          required: false
          description: Filter by the outcome of the last run. **Example:** `SKIPPED`
          schema:
            type: string
            enum:
              - SUCCESS
              - ONGOING
              - SKIPPED
              - FAILED
        - name: sortBy
          in: query
          required: false
          description: >-
            Field the result-set is sorted on. **Example:** `name`. **Default:**
            `createdTime`
          schema:
            type: string
            enum:
              - createdTime
              - name
            default: createdTime
        - name: sortOrder
          in: query
          required: false
          description: >-
            Ascending or descending order for the sorting. **Example:** `asc`.
            **Default:** `desc`
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    description: Message of API response.
                    type: string
                  routingSchedules:
                    type: object
                    description: >-
                      Paginated list of routing schedules. Each item carries the
                      schedule document plus `logExecuted`.
                    properties:
                      data:
                        type: array
                        description: List of routing schedules.
                        items:
                          type: object
                          properties:
                            logExecuted:
                              type: object
                              description: >-
                                Outcome of the last run of this schedule. Absent
                                on a schedule that has never run.
                              properties:
                                status:
                                  type: string
                                  description: >-
                                    `SUCCESS` — the optimization finished, and
                                    dispatch ran too when Auto Dispatch was on.
                                    `ONGOING` — the run has started and is still
                                    working. `SKIPPED` — the run did not start;
                                    `reason` says why. `FAILED` — the
                                    optimization did not finish.
                                  enum:
                                    - SUCCESS
                                    - ONGOING
                                    - SKIPPED
                                    - FAILED
                                reason:
                                  type: string
                                  description: >-
                                    Why the run was skipped or failed, `null` on
                                    a successful run.

                                    - `no_visit` — no active visit matched the
                                    hub

                                    - `no_vehicle` — the profile has no vehicle
                                    selected

                                    - `configuration_not_found` — the profile is
                                    missing or deleted

                                    - `hub_not_found` — the hub is missing

                                    - `license_visit_limit` — the visit license
                                    check did not pass

                                    - `license_active_vehicle_limit` — the
                                    active-vehicle license limit would be
                                    exceeded

                                    - `previous_run_ongoing` — an earlier run of
                                    this schedule is still working

                                    - `routing_failed` — the optimization did
                                    not finish

                                    - `exception` — an unexpected error, the
                                    message carries the detail
                                  enum:
                                    - no_visit
                                    - no_vehicle
                                    - configuration_not_found
                                    - hub_not_found
                                    - license_visit_limit
                                    - license_active_vehicle_limit
                                    - previous_run_ongoing
                                    - routing_failed
                                    - exception
                                message:
                                  type: string
                                  description: Readable description of the outcome.
                                resultId:
                                  type: string
                                  description: >-
                                    Routing result the run produced. Use [**GET
                                    /result/{resultId}**](#tag/Routing/operation/result~1id1)
                                    to read it.
                                visitFetched:
                                  type: integer
                                  description: >-
                                    How many visits the run collected for the
                                    hub.
                                visitTruncated:
                                  type: boolean
                                  description: >-
                                    `true` when the hub had more active visits
                                    than a single run can collect, so the oldest
                                    1500 by creation time were optimized and the
                                    rest were left out.
                                visitWithoutCoordinate:
                                  type: integer
                                  description: >-
                                    How many of the collected visits carried no
                                    coordinate and were therefore left out of
                                    the optimization. They are not geocoded
                                    automatically.
                                vehicleTotal:
                                  type: integer
                                  description: >-
                                    How many vehicles the profile contributed to
                                    the run.
                                dispatch:
                                  type: object
                                  description: Dispatch outcome of the run.
                                  properties:
                                    executed:
                                      type: boolean
                                      description: >-
                                        `false` when Auto Dispatch was off, the
                                        optimization did not finish, or the run
                                        is still working.
                                    success:
                                      type: integer
                                      description: Vehicles dispatched successfully.
                                    failed:
                                      type: integer
                                      description: >-
                                        Vehicles that failed to dispatch. A
                                        partial failure is not rolled back and
                                        is not retried automatically.
                                lastExecute:
                                  type: string
                                  description: >-
                                    When the entry was written, in `Y-m-d H:i:s`
                                    format. On an `ONGOING` entry this is when
                                    the run started, not when it finished.
                  dataVersion:
                    type: string
                    description: Server timestamp of the response, in milliseconds.
                example:
                  status: true
                  message: Success
                  routingSchedules:
                    current_page: 1
                    data:
                      - _id: 66f0a1b2c3d4e5f600000001
                        organizationId: 65a1b2c3d4e5f60000000001
                        hubId: 65b2c3d4e5f6000000000002
                        configurationId: 65c3a1b2c3d4e5f600000009
                        name: Morning Routing Jakarta
                        autoDispatch: true
                        periode: daily
                        frequency: null
                        interval: null
                        startTime: 2026-09-10 00:00
                        endTime: 2026-12-31 23:59
                        schedules:
                          - time:
                              - '08:00'
                        timeSchedules:
                          - '08:00'
                        isDeleted: false
                        createdBy: ops@acme.com
                        createdTime: '2026-09-09T10:00:00+00:00'
                        updatedTime: '2026-09-09T10:00:00+00:00'
                        logExecuted:
                          status: SUCCESS
                          reason: null
                          message: Success
                          resultId: 66f0b9c8d7e6f5a400000042
                          visitFetched: 342
                          visitTruncated: false
                          visitWithoutCoordinate: 3
                          vehicleTotal: 8
                          dispatch:
                            executed: true
                            success: 339
                            failed: 0
                          lastExecute: '2026-09-10 08:00:04'
                    first_page_url: https://apiweb.mile.app/api/v3/routing/schedules?page=1
                    from: 1
                    last_page: 1
                    last_page_url: https://apiweb.mile.app/api/v3/routing/schedules?page=1
                    next_page_url: null
                    path: https://apiweb.mile.app/api/v3/routing/schedules
                    per_page: 20
                    prev_page_url: null
                    to: 1
                    total: 1
                  dataVersion: '1789000000'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    type: string
                    description: A short message explaining what went wrong.
                  failedCode:
                    type: string
                    description: Internal error code, useful when contacting support.
                example:
                  status: false
                  message: >-
                    Access denied. You do not have permission for view routing
                    schedule. Please contact your admin to request access.
                  failedCode: sys-035
        '422':
          description: Invalid query parameter
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    type: string
                    description: A short message explaining what went wrong.
                  errors:
                    type: object
                    description: Validation messages, keyed by field name.
                  failedCode:
                    type: string
                    description: Internal error code, useful when contacting support.
                example:
                  status: false
                  message: The selected status is invalid.
                  errors:
                    status:
                      - The selected status is invalid.
                  failedCode: sched-001
        '500':
          description: Server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    description: Shows if the request was successful.
                  message:
                    type: string
                    description: A short message explaining what went wrong.
                example:
                  status: false
                  message: Internal server error, please contact support@mile.app.
      deprecated: false
      security:
        - bearerAuth: []
components:
  parameters:
    pageInQuery:
      name: page
      in: query
      schema:
        default: 1
        type: integer
      description: The page number of results to retrieve. **Example:** `2`
    hubIdInQuery:
      name: hubId
      in: query
      schema:
        type: string
      description: >-
        Fundamental entity within an organization, serving as the central point
        for managing various operational components. Use Use [**GET
        /hubs**](#tag/Hub/operation/getHubs) endpoint to get the list of Hub
        IDs.

        **Example:** `634e98498ce07d29474a7e29`
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Use a valid Bearer token to authenticate.

````