Skip to main content
POST
/
routes
Add Route
curl --request POST \
  --url https://api.crosoftware.com/v0/routes \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-tenant-id: <x-tenant-id>' \
  --data '
{
  "location_id": 123,
  "name": "<string>",
  "truck_id": 123,
  "auto_decline": true,
  "days_interval": 123,
  "end_at_lat": "<string>",
  "end_at_lng": "<string>",
  "end_time": "2023-11-07T05:31:56Z",
  "friday_on": true,
  "interface_color": "<string>",
  "last_dispatched": "2023-11-07T05:31:56Z",
  "monday_on": true,
  "recure_date": "2023-11-07T05:31:56Z",
  "route_zone_id": 123,
  "saturday_on": true,
  "start_at_lat": "<string>",
  "start_at_lng": "<string>",
  "start_time": "2023-11-07T05:31:56Z",
  "sunday_on": true,
  "thursday_on": true,
  "tuesday_on": true,
  "visualize_round_trip": true,
  "wednesday_on": true,
  "will_rollover": true
}
'
import requests

url = "https://api.crosoftware.com/v0/routes"

payload = {
    "location_id": 123,
    "name": "<string>",
    "truck_id": 123,
    "auto_decline": True,
    "days_interval": 123,
    "end_at_lat": "<string>",
    "end_at_lng": "<string>",
    "end_time": "2023-11-07T05:31:56Z",
    "friday_on": True,
    "interface_color": "<string>",
    "last_dispatched": "2023-11-07T05:31:56Z",
    "monday_on": True,
    "recure_date": "2023-11-07T05:31:56Z",
    "route_zone_id": 123,
    "saturday_on": True,
    "start_at_lat": "<string>",
    "start_at_lng": "<string>",
    "start_time": "2023-11-07T05:31:56Z",
    "sunday_on": True,
    "thursday_on": True,
    "tuesday_on": True,
    "visualize_round_trip": True,
    "wednesday_on": True,
    "will_rollover": True
}
headers = {
    "x-tenant-id": "<x-tenant-id>",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {
    'x-tenant-id': '<x-tenant-id>',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    location_id: 123,
    name: '<string>',
    truck_id: 123,
    auto_decline: true,
    days_interval: 123,
    end_at_lat: '<string>',
    end_at_lng: '<string>',
    end_time: '2023-11-07T05:31:56Z',
    friday_on: true,
    interface_color: '<string>',
    last_dispatched: '2023-11-07T05:31:56Z',
    monday_on: true,
    recure_date: '2023-11-07T05:31:56Z',
    route_zone_id: 123,
    saturday_on: true,
    start_at_lat: '<string>',
    start_at_lng: '<string>',
    start_time: '2023-11-07T05:31:56Z',
    sunday_on: true,
    thursday_on: true,
    tuesday_on: true,
    visualize_round_trip: true,
    wednesday_on: true,
    will_rollover: true
  })
};

fetch('https://api.crosoftware.com/v0/routes', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.crosoftware.com/v0/routes",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'location_id' => 123,
    'name' => '<string>',
    'truck_id' => 123,
    'auto_decline' => true,
    'days_interval' => 123,
    'end_at_lat' => '<string>',
    'end_at_lng' => '<string>',
    'end_time' => '2023-11-07T05:31:56Z',
    'friday_on' => true,
    'interface_color' => '<string>',
    'last_dispatched' => '2023-11-07T05:31:56Z',
    'monday_on' => true,
    'recure_date' => '2023-11-07T05:31:56Z',
    'route_zone_id' => 123,
    'saturday_on' => true,
    'start_at_lat' => '<string>',
    'start_at_lng' => '<string>',
    'start_time' => '2023-11-07T05:31:56Z',
    'sunday_on' => true,
    'thursday_on' => true,
    'tuesday_on' => true,
    'visualize_round_trip' => true,
    'wednesday_on' => true,
    'will_rollover' => true
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json",
    "x-tenant-id: <x-tenant-id>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.crosoftware.com/v0/routes"

	payload := strings.NewReader("{\n  \"location_id\": 123,\n  \"name\": \"<string>\",\n  \"truck_id\": 123,\n  \"auto_decline\": true,\n  \"days_interval\": 123,\n  \"end_at_lat\": \"<string>\",\n  \"end_at_lng\": \"<string>\",\n  \"end_time\": \"2023-11-07T05:31:56Z\",\n  \"friday_on\": true,\n  \"interface_color\": \"<string>\",\n  \"last_dispatched\": \"2023-11-07T05:31:56Z\",\n  \"monday_on\": true,\n  \"recure_date\": \"2023-11-07T05:31:56Z\",\n  \"route_zone_id\": 123,\n  \"saturday_on\": true,\n  \"start_at_lat\": \"<string>\",\n  \"start_at_lng\": \"<string>\",\n  \"start_time\": \"2023-11-07T05:31:56Z\",\n  \"sunday_on\": true,\n  \"thursday_on\": true,\n  \"tuesday_on\": true,\n  \"visualize_round_trip\": true,\n  \"wednesday_on\": true,\n  \"will_rollover\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-tenant-id", "<x-tenant-id>")
	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.crosoftware.com/v0/routes")
  .header("x-tenant-id", "<x-tenant-id>")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"location_id\": 123,\n  \"name\": \"<string>\",\n  \"truck_id\": 123,\n  \"auto_decline\": true,\n  \"days_interval\": 123,\n  \"end_at_lat\": \"<string>\",\n  \"end_at_lng\": \"<string>\",\n  \"end_time\": \"2023-11-07T05:31:56Z\",\n  \"friday_on\": true,\n  \"interface_color\": \"<string>\",\n  \"last_dispatched\": \"2023-11-07T05:31:56Z\",\n  \"monday_on\": true,\n  \"recure_date\": \"2023-11-07T05:31:56Z\",\n  \"route_zone_id\": 123,\n  \"saturday_on\": true,\n  \"start_at_lat\": \"<string>\",\n  \"start_at_lng\": \"<string>\",\n  \"start_time\": \"2023-11-07T05:31:56Z\",\n  \"sunday_on\": true,\n  \"thursday_on\": true,\n  \"tuesday_on\": true,\n  \"visualize_round_trip\": true,\n  \"wednesday_on\": true,\n  \"will_rollover\": true\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.crosoftware.com/v0/routes")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-tenant-id"] = '<x-tenant-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"location_id\": 123,\n  \"name\": \"<string>\",\n  \"truck_id\": 123,\n  \"auto_decline\": true,\n  \"days_interval\": 123,\n  \"end_at_lat\": \"<string>\",\n  \"end_at_lng\": \"<string>\",\n  \"end_time\": \"2023-11-07T05:31:56Z\",\n  \"friday_on\": true,\n  \"interface_color\": \"<string>\",\n  \"last_dispatched\": \"2023-11-07T05:31:56Z\",\n  \"monday_on\": true,\n  \"recure_date\": \"2023-11-07T05:31:56Z\",\n  \"route_zone_id\": 123,\n  \"saturday_on\": true,\n  \"start_at_lat\": \"<string>\",\n  \"start_at_lng\": \"<string>\",\n  \"start_time\": \"2023-11-07T05:31:56Z\",\n  \"sunday_on\": true,\n  \"thursday_on\": true,\n  \"tuesday_on\": true,\n  \"visualize_round_trip\": true,\n  \"wednesday_on\": true,\n  \"will_rollover\": true\n}"

response = http.request(request)
puts response.read_body
{
  "auto_decline": true,
  "days_interval": 123,
  "end_at_lat": "<string>",
  "end_at_lng": "<string>",
  "end_time": "2023-11-07T05:31:56Z",
  "friday_on": true,
  "id": 123,
  "interface_color": "<string>",
  "last_dispatched": "2023-11-07T05:31:56Z",
  "location_id": 123,
  "monday_on": true,
  "name": "<string>",
  "recure_date": "2023-11-07T05:31:56Z",
  "route_zone_id": 123,
  "saturday_on": true,
  "start_at_lat": "<string>",
  "start_at_lng": "<string>",
  "start_time": "2023-11-07T05:31:56Z",
  "sunday_on": true,
  "thursday_on": true,
  "truck_id": 123,
  "tuesday_on": true,
  "visualize_round_trip": true,
  "wednesday_on": true,
  "will_rollover": true
}

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Headers

x-api-version
string

Version identifier (date format).

x-tenant-id
integer<int64>
required

Tenant identifier. Contact CRO Software for more info if you don't already have this id. See list tenant ids for info on listing the tenants you have access to.

Body

application/json

Create new route request body model.

location_id
integer<int64>
required

Location identifier.

name
string
required

Route name.

truck_id
integer<int64>
required

Truck identifier.

auto_decline
boolean

Auto decline.

days_interval
integer

Days interval.

end_at_lat
string

Latitude.

end_at_lng
string

Longitude.

end_time
string<date-time>

Scheduled job completion date.

friday_on
boolean

Friday on.

interface_color
string

Interface color.

last_dispatched
string<date-time>

Last time this route had a job dispatched.

monday_on
boolean

Monday on.

recure_date
string<date-time>

Recure date.

route_zone_id
integer

Route zone id

saturday_on
boolean

Saturday on.

start_at_lat
string

Latitude.

start_at_lng
string

Longitude.

start_time
string<date-time>

Scheduled job completion date.

sunday_on
boolean

Sunday on.

thursday_on
boolean

Thursday on.

tuesday_on
boolean

Tuesday on.

visualize_round_trip
boolean

Visualize round trip.

wednesday_on
boolean

Wednesday on.

will_rollover
boolean

Will rollover.

Response

200 - application/json

Success

Route model.

auto_decline
boolean
required

Auto decline.

days_interval
integer
required

Days interval.

end_at_lat
string
required

Latitude.

end_at_lng
string
required

Longitude.

end_time
string<date-time>
required

Scheduled job completion date.

friday_on
boolean
required

Friday on.

id
integer<int64>
required

Trailer record identifier.

interface_color
string
required

Interface color.

last_dispatched
string<date-time>
required

Last time this route had a job dispatched.

location_id
integer<int64>
required

Location identifier.

monday_on
boolean
required

Monday on.

name
string
required

Route name.

recure_date
string<date-time>
required

Recure date.

route_zone_id
integer
required

Route zone id

saturday_on
boolean
required

Saturday on.

start_at_lat
string
required

Latitude.

start_at_lng
string
required

Longitude.

start_time
string<date-time>
required

Scheduled job completion date.

sunday_on
boolean
required

Sunday on.

thursday_on
boolean
required

Thursday on.

truck_id
integer<int64>
required

Truck identifier.

tuesday_on
boolean
required

Tuesday on.

visualize_round_trip
boolean
required

Visualize round trip.

wednesday_on
boolean
required

Wednesday on.

will_rollover
boolean
required

Will rollover.