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": "ops@acme.com",
"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 support@mile.app."
}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.
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": "ops@acme.com",
"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 support@mile.app."
}Authorizations
Use a valid Bearer token to authenticate.
Body
startTime and endTime are required for every periode except byDate. frequency and interval are required when periode is custom.
The Configuration Profile every run of this schedule uses. The hub and the vehicles of the run are taken from this profile, so neither is sent here. Editing the profile changes the next run without editing the schedule.
Example: 65c3a1b2c3d4e5f600000009
Name of the schedule. It is also the prefix of the name given to every routing result the schedule produces.
Example: Morning Routing Jakarta
How often the schedule repeats. Example: daily
daily, weekly, monthly, byDate, custom Repetition entries for this schedule. Every entry carries at least one time value in H:i format.
Show child attributes
Show child attributes
When true, every vehicle on the optimized result is dispatched to its field user as soon as the optimization finishes. When false, the result waits in Routing → Result for a manual dispatch.
Unit the interval counts, required when periode is custom and ignored otherwise. Example: monthly
daily, weekly, monthly How many frequency units pass between two runs, required when periode is custom and ignored otherwise. 2 with a monthly frequency means every second month. Example: 2
1 <= x <= 99Start of the active window, in Y-m-d H:i format. The schedule does not run before it. Not used when periode is byDate, because those entries already carry absolute dates.
Example: 2026-09-10 00:00
End of the active window, in Y-m-d H:i format. The schedule stops running after it. Not used when periode is byDate.
Example: 2026-12-31 23:59