---
title: "[beta] Update a route template"
method: PATCH
path: "/hub/route-templates"
tags: ["Beta APIs"]
---

# \[beta\] Update a route template

`PATCH /hub/route-templates`

## Request

- Base URL: `https://api.samsara.com`
- URL: `https://api.samsara.com/hub/route-templates`
- Auth: HTTP bearer

Update an existing route template by its unique identifier. Only the fields provided in the request body are changed.

 <b>Rate limit:</b> 5 requests/sec (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).

To use this endpoint, select **Write Routes** under the Driver Workflow category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
 

 **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.

## Query parameters

- `id` string, required

## Request body

- HubRouteTemplatesUpdateHubRouteTemplateRequestBody: Request body for updating a hub route template. All fields are optional; only provided fields are changed.
  - `defaultDepotEndExternalId` string: The external identifier of the default end depot, as configured in the hub. Send an empty string to clear it.
  - `defaultDepotStartExternalId` string: The external identifier of the default start depot, as configured in the hub. Send an empty string to clear it.
  - `defaultStartTimeOfDay` string: Default start time in HH:MM format in the hub's local timezone (e.g. '08:00'). Send an empty string to clear it.
  - `locationsByExternalIds` string[]: Full replacement of the ordered stop list, referenced by external ID. Omit to leave stops unchanged; send an empty array to clear all stops.
  - `name` string: The new name of the route template.

## Response `200`

OK response.

- HubRouteTemplatesUpdateHubRouteTemplateResponseBody
  - `data` HubRouteTemplateObjectResponseBody, required: A route template for a hub.
    - `createdAtTime` string, date-time, required: The timestamp when the route template was created, in RFC 3339 format.
    - `defaultDepotEnd` HubRouteTemplateDepotObjectResponseBody: A depot location for a route template.
      - `externalId` string: The customer-provided external identifier for the depot location.
      - `formattedAddress` string, required: The formatted address of the depot location.
      - `id` string, required: The unique identifier for the depot location.
      - `latitude` number, double, required: Latitude coordinate of the depot location.
      - `longitude` number, double, required: Longitude coordinate of the depot location.
      - `name` string, required: The name of the depot location.
    - `defaultDepotStart` HubRouteTemplateDepotObjectResponseBody: A depot location for a route template.
      - `externalId` string: The customer-provided external identifier for the depot location.
      - `formattedAddress` string, required: The formatted address of the depot location.
      - `id` string, required: The unique identifier for the depot location.
      - `latitude` number, double, required: Latitude coordinate of the depot location.
      - `longitude` number, double, required: Longitude coordinate of the depot location.
      - `name` string, required: The name of the depot location.
    - `defaultStartTimeOfDay` string: Default start time of day for the route template, in HH:MM format in the hub's local timezone (e.g. '08:00').
    - `distanceMeters` integer, required: Total distance of the route in meters.
    - `durationSeconds` integer, required: Total duration of the route in seconds.
    - `hubId` string, required: The hub identifier this route template belongs to.
    - `hubTimezone` string, required: The IANA timezone of the hub (e.g. 'America/Los_Angeles').
    - `id` string, required: The unique identifier for the route template.
    - `locations` HubRouteTemplateLocationObjectResponseBody[], required: Ordered list of stop locations in the route template.
      - `externalId` string: The customer-provided identifier for the location.
      - `formattedAddress` string, required: The formatted address of the location.
      - `latitude` number, double, required: Latitude coordinate of the location.
      - `longitude` number, double, required: Longitude coordinate of the location.
      - `name` string, required: The name of the location.
      - `position` integer, required: The 1-based position of this stop in the route template.
    - `name` string, required: The name of the route template.
    - `updatedAtTime` string, date-time, required: The timestamp when the route template was last updated, in RFC 3339 format.

## Other responses

- `401`: Unauthorized response.
- `404`: Not Found response.
- `405`: Method Not Allowed response.
- `413`: Content Too Large response.
- `429`: Too Many Requests response.
- `500`: Internal Server Error response.
- `501`: Not Implemented response.
- `502`: Bad Gateway response.
- `503`: Service Unavailable response.
- `504`: Gateway Timeout response.
- `default`: Bad Request response.

---

[API](https://skmtc.dev/samsara/apis/samsara-api.md) - [All operations](https://skmtc.dev/samsara/apis/samsara-api/llms.txt) - [OpenAPI document](https://skmtc.dev/samsara/apis/samsara-api/revisions/a9e35d4999be?raw)
