Create Route
Create a new route with stops and assignments in Samsara.
Operation
Section titled “Operation”createRoute
Resource
Section titled “Resource”route
Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| Name | string | Yes | - | The name of the route |
| Stops (JSON) | json | Yes | [] | Array of route stops |
Additional Fields
Section titled “Additional Fields”| Field | Type | Default | Description |
|---|---|---|---|
| Driver ID | string | - | The ID of the driver assigned to the route |
| Vehicle ID | string | - | The ID of the vehicle assigned to the route |
| Notes | string | - | Notes about the route |
| Route Starting Condition | options | arriveFirstStop | Condition that marks the route as started |
| Route Completion Condition | options | arriveLastStop | Condition that marks the route as completed |
| External IDs (JSON) | json | {} | External IDs as a JSON object |
Route Starting Condition Options
Section titled “Route Starting Condition Options”| Value | Description |
|---|---|
arriveFirstStop | Route starts when arriving at first stop |
departFirstStop | Route starts when departing first stop |
Route Completion Condition Options
Section titled “Route Completion Condition Options”| Value | Description |
|---|---|
arriveLastStop | Route completes when arriving at last stop |
departLastStop | Route completes when departing last stop |
Stops Schema
Section titled “Stops Schema”Each stop in the stops array should have:
{ "scheduledArrivalTime": "2024-01-15T10:00:00Z", "addressId": "address_123", "notes": "Deliver to loading dock"}Or for single-use locations:
{ "scheduledArrivalTime": "2024-01-15T10:00:00Z", "singleUseLocation": { "latitude": 32.7767, "longitude": -96.7970, "address": "123 Main St, Dallas, TX" }}Response
Section titled “Response”Success
Section titled “Success”{ "id": "route_123", "name": "Morning Delivery Route", "driverId": "driver_456", "vehicleId": "vehicle_789", "stops": [], "settings": { "routeStartingCondition": "arriveFirstStop", "routeCompletionCondition": "arriveLastStop" }}{ "success": false, "error": "Invalid stops format", "name": "Morning Delivery Route"}Error Handling
Section titled “Error Handling”- Missing API Token: Samsara credential is missing apiToken
- Invalid Stops Format: Stops JSON is malformed
- Invalid Address ID: Referenced address does not exist
- Invalid Driver/Vehicle ID: Referenced driver or vehicle does not exist