curl --request POST \
--url https://apiweb.mile.app/api/v3/vehicle-maintenances \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": [
{
"vehicleId": "65f9c1aa77e0b30001aa1122",
"startTime": "2026-11-04T08:00:00+07:00",
"endTime": "2026-11-04T17:00:00+07:00",
"notes": "Annual service"
},
{
"_id": "6720a1f0c2e4b0a1000112ab",
"vehicleId": "65f9c1aa77e0b30001aa1133",
"startTime": "2026-11-06T08:00:00+07:00",
"endTime": "2026-11-07T17:00:00+07:00",
"notes": null
}
],
"deletedIds": [
"6720a1f0c2e4b0a1000112cd"
]
}
'import requests
url = "https://apiweb.mile.app/api/v3/vehicle-maintenances"
payload = {
"data": [
{
"vehicleId": "65f9c1aa77e0b30001aa1122",
"startTime": "2026-11-04T08:00:00+07:00",
"endTime": "2026-11-04T17:00:00+07:00",
"notes": "Annual service"
},
{
"_id": "6720a1f0c2e4b0a1000112ab",
"vehicleId": "65f9c1aa77e0b30001aa1133",
"startTime": "2026-11-06T08:00:00+07:00",
"endTime": "2026-11-07T17:00:00+07:00",
"notes": None
}
],
"deletedIds": ["6720a1f0c2e4b0a1000112cd"]
}
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({
data: [
{
vehicleId: '65f9c1aa77e0b30001aa1122',
startTime: '2026-11-04T08:00:00+07:00',
endTime: '2026-11-04T17:00:00+07:00',
notes: 'Annual service'
},
{
_id: '6720a1f0c2e4b0a1000112ab',
vehicleId: '65f9c1aa77e0b30001aa1133',
startTime: '2026-11-06T08:00:00+07:00',
endTime: '2026-11-07T17:00:00+07:00',
notes: null
}
],
deletedIds: ['6720a1f0c2e4b0a1000112cd']
})
};
fetch('https://apiweb.mile.app/api/v3/vehicle-maintenances', 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/vehicle-maintenances",
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([
'data' => [
[
'vehicleId' => '65f9c1aa77e0b30001aa1122',
'startTime' => '2026-11-04T08:00:00+07:00',
'endTime' => '2026-11-04T17:00:00+07:00',
'notes' => 'Annual service'
],
[
'_id' => '6720a1f0c2e4b0a1000112ab',
'vehicleId' => '65f9c1aa77e0b30001aa1133',
'startTime' => '2026-11-06T08:00:00+07:00',
'endTime' => '2026-11-07T17:00:00+07:00',
'notes' => null
]
],
'deletedIds' => [
'6720a1f0c2e4b0a1000112cd'
]
]),
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/vehicle-maintenances"
payload := strings.NewReader("{\n \"data\": [\n {\n \"vehicleId\": \"65f9c1aa77e0b30001aa1122\",\n \"startTime\": \"2026-11-04T08:00:00+07:00\",\n \"endTime\": \"2026-11-04T17:00:00+07:00\",\n \"notes\": \"Annual service\"\n },\n {\n \"_id\": \"6720a1f0c2e4b0a1000112ab\",\n \"vehicleId\": \"65f9c1aa77e0b30001aa1133\",\n \"startTime\": \"2026-11-06T08:00:00+07:00\",\n \"endTime\": \"2026-11-07T17:00:00+07:00\",\n \"notes\": null\n }\n ],\n \"deletedIds\": [\n \"6720a1f0c2e4b0a1000112cd\"\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/vehicle-maintenances")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"data\": [\n {\n \"vehicleId\": \"65f9c1aa77e0b30001aa1122\",\n \"startTime\": \"2026-11-04T08:00:00+07:00\",\n \"endTime\": \"2026-11-04T17:00:00+07:00\",\n \"notes\": \"Annual service\"\n },\n {\n \"_id\": \"6720a1f0c2e4b0a1000112ab\",\n \"vehicleId\": \"65f9c1aa77e0b30001aa1133\",\n \"startTime\": \"2026-11-06T08:00:00+07:00\",\n \"endTime\": \"2026-11-07T17:00:00+07:00\",\n \"notes\": null\n }\n ],\n \"deletedIds\": [\n \"6720a1f0c2e4b0a1000112cd\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/vehicle-maintenances")
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 \"data\": [\n {\n \"vehicleId\": \"65f9c1aa77e0b30001aa1122\",\n \"startTime\": \"2026-11-04T08:00:00+07:00\",\n \"endTime\": \"2026-11-04T17:00:00+07:00\",\n \"notes\": \"Annual service\"\n },\n {\n \"_id\": \"6720a1f0c2e4b0a1000112ab\",\n \"vehicleId\": \"65f9c1aa77e0b30001aa1133\",\n \"startTime\": \"2026-11-06T08:00:00+07:00\",\n \"endTime\": \"2026-11-07T17:00:00+07:00\",\n \"notes\": null\n }\n ],\n \"deletedIds\": [\n \"6720a1f0c2e4b0a1000112cd\"\n ]\n}"
response = http.request(request)
puts response.read_bodySave vehicle maintenance schedules
Creates, updates and deletes maintenance schedules in one request. data holds the schedules to create or update, and deletedIds the schedules to delete permanently.
All or nothing. Every entry is checked before anything is written, so a rejected request saves nothing. Error messages name the entry by its position in data, starting at 1 (for example Entry 2 ...).
Overlap. Two schedules of the same vehicle may not overlap, neither with a saved schedule nor with another entry of the same request. A schedule may start exactly when another one ends.
Ended schedules are read-only. A schedule whose end time has passed cannot be changed or deleted. Sending it back unchanged is accepted and leaves it as it is. A new entry may lie in the past, to record a service that already happened.
Errors. vehic-001 data missing or empty, or an entry without vehicleId, startTime or endTime; vehic-011 data or deletedIds is not an array; vehic-009 more than 1000 entries, or notes longer than 500 characters; vehic-016 a deletedIds entry or notes that is not a string; vehic-033 the vehicle was not found; vehic-003 a date that cannot be read, or an end that is not later than the start; vehic-043 (404) an _id or deletedIds entry that does not exist; vehic-044 an ended schedule changed or deleted; vehic-041 an overlap.
Requires the Edit Vehicle permission.
curl --request POST \
--url https://apiweb.mile.app/api/v3/vehicle-maintenances \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": [
{
"vehicleId": "65f9c1aa77e0b30001aa1122",
"startTime": "2026-11-04T08:00:00+07:00",
"endTime": "2026-11-04T17:00:00+07:00",
"notes": "Annual service"
},
{
"_id": "6720a1f0c2e4b0a1000112ab",
"vehicleId": "65f9c1aa77e0b30001aa1133",
"startTime": "2026-11-06T08:00:00+07:00",
"endTime": "2026-11-07T17:00:00+07:00",
"notes": null
}
],
"deletedIds": [
"6720a1f0c2e4b0a1000112cd"
]
}
'import requests
url = "https://apiweb.mile.app/api/v3/vehicle-maintenances"
payload = {
"data": [
{
"vehicleId": "65f9c1aa77e0b30001aa1122",
"startTime": "2026-11-04T08:00:00+07:00",
"endTime": "2026-11-04T17:00:00+07:00",
"notes": "Annual service"
},
{
"_id": "6720a1f0c2e4b0a1000112ab",
"vehicleId": "65f9c1aa77e0b30001aa1133",
"startTime": "2026-11-06T08:00:00+07:00",
"endTime": "2026-11-07T17:00:00+07:00",
"notes": None
}
],
"deletedIds": ["6720a1f0c2e4b0a1000112cd"]
}
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({
data: [
{
vehicleId: '65f9c1aa77e0b30001aa1122',
startTime: '2026-11-04T08:00:00+07:00',
endTime: '2026-11-04T17:00:00+07:00',
notes: 'Annual service'
},
{
_id: '6720a1f0c2e4b0a1000112ab',
vehicleId: '65f9c1aa77e0b30001aa1133',
startTime: '2026-11-06T08:00:00+07:00',
endTime: '2026-11-07T17:00:00+07:00',
notes: null
}
],
deletedIds: ['6720a1f0c2e4b0a1000112cd']
})
};
fetch('https://apiweb.mile.app/api/v3/vehicle-maintenances', 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/vehicle-maintenances",
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([
'data' => [
[
'vehicleId' => '65f9c1aa77e0b30001aa1122',
'startTime' => '2026-11-04T08:00:00+07:00',
'endTime' => '2026-11-04T17:00:00+07:00',
'notes' => 'Annual service'
],
[
'_id' => '6720a1f0c2e4b0a1000112ab',
'vehicleId' => '65f9c1aa77e0b30001aa1133',
'startTime' => '2026-11-06T08:00:00+07:00',
'endTime' => '2026-11-07T17:00:00+07:00',
'notes' => null
]
],
'deletedIds' => [
'6720a1f0c2e4b0a1000112cd'
]
]),
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/vehicle-maintenances"
payload := strings.NewReader("{\n \"data\": [\n {\n \"vehicleId\": \"65f9c1aa77e0b30001aa1122\",\n \"startTime\": \"2026-11-04T08:00:00+07:00\",\n \"endTime\": \"2026-11-04T17:00:00+07:00\",\n \"notes\": \"Annual service\"\n },\n {\n \"_id\": \"6720a1f0c2e4b0a1000112ab\",\n \"vehicleId\": \"65f9c1aa77e0b30001aa1133\",\n \"startTime\": \"2026-11-06T08:00:00+07:00\",\n \"endTime\": \"2026-11-07T17:00:00+07:00\",\n \"notes\": null\n }\n ],\n \"deletedIds\": [\n \"6720a1f0c2e4b0a1000112cd\"\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/vehicle-maintenances")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"data\": [\n {\n \"vehicleId\": \"65f9c1aa77e0b30001aa1122\",\n \"startTime\": \"2026-11-04T08:00:00+07:00\",\n \"endTime\": \"2026-11-04T17:00:00+07:00\",\n \"notes\": \"Annual service\"\n },\n {\n \"_id\": \"6720a1f0c2e4b0a1000112ab\",\n \"vehicleId\": \"65f9c1aa77e0b30001aa1133\",\n \"startTime\": \"2026-11-06T08:00:00+07:00\",\n \"endTime\": \"2026-11-07T17:00:00+07:00\",\n \"notes\": null\n }\n ],\n \"deletedIds\": [\n \"6720a1f0c2e4b0a1000112cd\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/vehicle-maintenances")
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 \"data\": [\n {\n \"vehicleId\": \"65f9c1aa77e0b30001aa1122\",\n \"startTime\": \"2026-11-04T08:00:00+07:00\",\n \"endTime\": \"2026-11-04T17:00:00+07:00\",\n \"notes\": \"Annual service\"\n },\n {\n \"_id\": \"6720a1f0c2e4b0a1000112ab\",\n \"vehicleId\": \"65f9c1aa77e0b30001aa1133\",\n \"startTime\": \"2026-11-06T08:00:00+07:00\",\n \"endTime\": \"2026-11-07T17:00:00+07:00\",\n \"notes\": null\n }\n ],\n \"deletedIds\": [\n \"6720a1f0c2e4b0a1000112cd\"\n ]\n}"
response = http.request(request)
puts response.read_body