Create routing schedule
curl --request POST \
--url https://apiweb.mile.app/api/v3/routing/schedule \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"configurationId": "65c3a1b2c3d4e5f600000009",
"name": "Morning Routing Jakarta",
"autoDispatch": true,
"periode": "daily",
"startTime": "2026-09-10 00:00",
"endTime": "2026-12-31 23:59",
"schedules": [
{
"time": [
"08:00"
]
}
]
}
'import requests
url = "https://apiweb.mile.app/api/v3/routing/schedule"
payload = {
"configurationId": "65c3a1b2c3d4e5f600000009",
"name": "Morning Routing Jakarta",
"autoDispatch": True,
"periode": "daily",
"startTime": "2026-09-10 00:00",
"endTime": "2026-12-31 23:59",
"schedules": [{ "time": ["08:00"] }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
configurationId: '65c3a1b2c3d4e5f600000009',
name: 'Morning Routing Jakarta',
autoDispatch: true,
periode: 'daily',
startTime: '2026-09-10 00:00',
endTime: '2026-12-31 23:59',
schedules: [{time: ['08:00']}]
})
};
fetch('https://apiweb.mile.app/api/v3/routing/schedule', 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://apiweb.mile.app/api/v3/routing/schedule",
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([
'configurationId' => '65c3a1b2c3d4e5f600000009',
'name' => 'Morning Routing Jakarta',
'autoDispatch' => true,
'periode' => 'daily',
'startTime' => '2026-09-10 00:00',
'endTime' => '2026-12-31 23:59',
'schedules' => [
[
'time' => [
'08:00'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://apiweb.mile.app/api/v3/routing/schedule"
payload := strings.NewReader("{\n \"configurationId\": \"65c3a1b2c3d4e5f600000009\",\n \"name\": \"Morning Routing Jakarta\",\n \"autoDispatch\": true,\n \"periode\": \"daily\",\n \"startTime\": \"2026-09-10 00:00\",\n \"endTime\": \"2026-12-31 23:59\",\n \"schedules\": [\n {\n \"time\": [\n \"08:00\"\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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://apiweb.mile.app/api/v3/routing/schedule")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"configurationId\": \"65c3a1b2c3d4e5f600000009\",\n \"name\": \"Morning Routing Jakarta\",\n \"autoDispatch\": true,\n \"periode\": \"daily\",\n \"startTime\": \"2026-09-10 00:00\",\n \"endTime\": \"2026-12-31 23:59\",\n \"schedules\": [\n {\n \"time\": [\n \"08:00\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/routing/schedule")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"configurationId\": \"65c3a1b2c3d4e5f600000009\",\n \"name\": \"Morning Routing Jakarta\",\n \"autoDispatch\": true,\n \"periode\": \"daily\",\n \"startTime\": \"2026-09-10 00:00\",\n \"endTime\": \"2026-12-31 23:59\",\n \"schedules\": [\n {\n \"time\": [\n \"08:00\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Routing schedule created.",
"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": "[email protected]",
"createdTime": "2026-09-09T10:00:00+00:00",
"updatedTime": "2026-09-09T10:00:00+00:00"
}
}{
"status": false,
"message": "Configuration not found",
"failedCode": "sched-033"
}{
"status": false,
"message": "Access denied. You do not have permission for add routing schedule. Please contact your admin to request access.",
"failedCode": "sys-035"
}{
"status": false,
"message": "The configuration id field is required.",
"errors": {
"configurationId": [
"The configuration id field is required."
],
"name": [
"The name field is required."
],
"periode": [
"The periode field is required."
]
},
"failedCode": "sched-001"
}{
"status": false,
"message": "Internal server error, please contact [email protected]."
}Routing Schedule
Create routing schedule
Creates a schedule that runs route optimization for a hub automatically at the times you set.
The hub and the vehicles are not sent here — both come from the Configuration Profile named by configurationId, which is read again on every run. Editing the profile therefore changes what the next run does, with no change to the schedule.
Requires the add/routing-schedule permission.
POST
/
routing
/
schedule
Create routing schedule
curl --request POST \
--url https://apiweb.mile.app/api/v3/routing/schedule \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"configurationId": "65c3a1b2c3d4e5f600000009",
"name": "Morning Routing Jakarta",
"autoDispatch": true,
"periode": "daily",
"startTime": "2026-09-10 00:00",
"endTime": "2026-12-31 23:59",
"schedules": [
{
"time": [
"08:00"
]
}
]
}
'import requests
url = "https://apiweb.mile.app/api/v3/routing/schedule"
payload = {
"configurationId": "65c3a1b2c3d4e5f600000009",
"name": "Morning Routing Jakarta",
"autoDispatch": True,
"periode": "daily",
"startTime": "2026-09-10 00:00",
"endTime": "2026-12-31 23:59",
"schedules": [{ "time": ["08:00"] }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
configurationId: '65c3a1b2c3d4e5f600000009',
name: 'Morning Routing Jakarta',
autoDispatch: true,
periode: 'daily',
startTime: '2026-09-10 00:00',
endTime: '2026-12-31 23:59',
schedules: [{time: ['08:00']}]
})
};
fetch('https://apiweb.mile.app/api/v3/routing/schedule', 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://apiweb.mile.app/api/v3/routing/schedule",
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([
'configurationId' => '65c3a1b2c3d4e5f600000009',
'name' => 'Morning Routing Jakarta',
'autoDispatch' => true,
'periode' => 'daily',
'startTime' => '2026-09-10 00:00',
'endTime' => '2026-12-31 23:59',
'schedules' => [
[
'time' => [
'08:00'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://apiweb.mile.app/api/v3/routing/schedule"
payload := strings.NewReader("{\n \"configurationId\": \"65c3a1b2c3d4e5f600000009\",\n \"name\": \"Morning Routing Jakarta\",\n \"autoDispatch\": true,\n \"periode\": \"daily\",\n \"startTime\": \"2026-09-10 00:00\",\n \"endTime\": \"2026-12-31 23:59\",\n \"schedules\": [\n {\n \"time\": [\n \"08:00\"\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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://apiweb.mile.app/api/v3/routing/schedule")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"configurationId\": \"65c3a1b2c3d4e5f600000009\",\n \"name\": \"Morning Routing Jakarta\",\n \"autoDispatch\": true,\n \"periode\": \"daily\",\n \"startTime\": \"2026-09-10 00:00\",\n \"endTime\": \"2026-12-31 23:59\",\n \"schedules\": [\n {\n \"time\": [\n \"08:00\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/routing/schedule")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"configurationId\": \"65c3a1b2c3d4e5f600000009\",\n \"name\": \"Morning Routing Jakarta\",\n \"autoDispatch\": true,\n \"periode\": \"daily\",\n \"startTime\": \"2026-09-10 00:00\",\n \"endTime\": \"2026-12-31 23:59\",\n \"schedules\": [\n {\n \"time\": [\n \"08:00\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Routing schedule created.",
"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": "[email protected]",
"createdTime": "2026-09-09T10:00:00+00:00",
"updatedTime": "2026-09-09T10:00:00+00:00"
}
}{
"status": false,
"message": "Configuration not found",
"failedCode": "sched-033"
}{
"status": false,
"message": "Access denied. You do not have permission for add routing schedule. Please contact your admin to request access.",
"failedCode": "sys-035"
}{
"status": false,
"message": "The configuration id field is required.",
"errors": {
"configurationId": [
"The configuration id field is required."
],
"name": [
"The name field is required."
],
"periode": [
"The periode field is required."
]
},
"failedCode": "sched-001"
}{
"status": false,
"message": "Internal server error, please contact [email protected]."
}Body
application/json
startTime and endTime are required for every periode except byDate. frequency and interval are required when periode is custom.