Integrating your Routes

Overview

The Routes API allows you to ingest and manage multi-segment journeys, such as delivery routes, patrol paths, or other sequential activities. It supports complex multi-leg routes, real-time updates, and feed-based organization for efficient route management.

Endpoint

POST: https://api.tomorrow.io/v4/connect/routes/{feedId}

Path Parameters

ParameterTypeRequiredDescriptionExample
feedIdstringIdentifier for the feed to ingest route data into. Organizes routes in a feed by fleet, region, or route type.delivery-routes

Request Body

Routes Request

The request body must contain a data array with one or more route objects.

FieldTypeConstraintsDescription
dataarray<RouteItem>Max amount of items- 200Array of route items to ingest

Route Item

FieldTypeRequiredDescription
idstringUnique route identifier.
namestringHuman-readable route name.
legsarray<Leg>Route legs. Minimum of 1 leg.
startTimestring (date-time)Start of validity period (defaults to current time).
endTimestring (date-time)End of validity period (defaults to 1 day later).
attributesobjectCustom metadata for the route.

Leg

FieldTypeRequiredDescription
idstringUnique leg identifier.
locationsarray

GeoJSON locations (minimum of one item). Each location is one of two formats-
(1){ "geojsonGeometry": { "type": "Feature", "geometry": <geom>, "properties": {} } }

(2){ "geojsonGeometry": <geom> }

startstring (date-time)Start of leg (defaults to current time).
endstring (date-time)End of leg (defaults to 1 day later).
attributesobject (free-form)Custom metadata for the leg.

Sample Request

{
  "data": [
    {
      "id": "route_123",
      "name": "Morning Delivery Route",
      "startTime": "2024-01-15T09:00:00Z",
      "endTime": "2024-01-15T17:00:00Z",
      "attributes": {
        "vehicle_type": "delivery_truck",
        "priority": "high",
        "estimated_duration": 480
      },
      "legs": [
        {
          "id": "leg1",
          "start": "2024-01-15T09:00:00Z",
          "end": "2024-01-15T10:00:00Z",
          "locations": [
            {
              "geojsonGeometry": {
                "type": "LineString",
                "coordinates": [
                  [-73.985, 40.748],
                  [-73.987, 40.749],
                  [-73.989, 40.750]
                ]
              }
            }
          ],
          "attributes": { "leg_type": "pickup" }
        },
        {
          "id": "leg2",
          "start": "2024-01-15T10:00:00Z",
          "end": "2024-01-15T11:00:00Z",
          "locations": [
            {
              "geojsonGeometry": {
                "type": "Feature",
                "geometry": {
                  "type": "Point",
                  "coordinates": [-73.990, 40.750]
                }
              }
            }
          ],
          "attributes": { "leg_type": "delivery", "packages": 3 }
        }
      ]
    }
  ]
}

Responses

CodeDescriptionBody
200Routes ingested successfully{ "message": string, "timestamp": date-time }
400Bad request — invalid data format
401Unauthorized — authentication required
500Internal server error

Integration Details

  • Authentication: You must include a valid API key in the request. Contact your account manager to obtain credentials and integration access.
  • Feed ID: A feed is used to organize and manage groups of related routes within the Tomorrow.io platform. Before uploading any asset data via the API, a feed must be created in your account. Each feed acts as a dedicated layer through which assets are ingested, displayed, and managed.
  • Limitations: You can submit up to 200 routes per API request.
  • Attributes: Used to store custom metadata. Each attribute must include a key and a value.