curl --request GET \
--url https://apiweb.mile.app/api/v4/roles \
--header 'Authorization: Bearer <token>'import requests
url = "https://apiweb.mile.app/api/v4/roles"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://apiweb.mile.app/api/v4/roles', 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/v4/roles",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://apiweb.mile.app/api/v4/roles"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://apiweb.mile.app/api/v4/roles")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v4/roles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": true,
"data": [
{
"_id": "68db98a7094228379a0d74d4",
"name": "Driver",
"isAdmin": false,
"isDefault": false,
"isDeleted": false,
"permissionList": [
"5f2b8c1e9d3a4b0012345678"
],
"permissionDetails": [
{
"permissionName": "view/task",
"items": []
}
],
"permissions": [],
"organizationId": "65c1f4eeca7c4816d94587b2",
"passwordPolicyId": null,
"updatedTime": "2026-10-01T03:00:00.000000Z",
"createdTime": "2026-10-01T03:00:00.000000Z",
"extendedData": {
"_id": "6abd0f00143a6b09ec0bf801",
"dataTypeId": "6abd0ee0a138a6318d023f20",
"entityId": "68db98a7094228379a0d74d4",
"dataId": "role:68db98a7094228379a0d74d4",
"shiftAllowance": 50000,
"organizationId": "65c1f4eeca7c4816d94587b2"
}
}
]
}{
"status": false,
"message": "Data not found"
}{
"status": false,
"message": "Internal server error, please contact support@mile.app."
}Read roles
Returns every role of your organization that is not deleted, the owner role first, then oldest first. There is no paging.
When no role matches, the response is 404 with failedCode role-033.
extendedData is returned only when it holds a record: a role with no extension record has no extendedData key at all, unlike hubs, users and vehicles where it is null.
Same as GET /api/v3/roles, plus the include parameter.
Requires permission view/role.
curl --request GET \
--url https://apiweb.mile.app/api/v4/roles \
--header 'Authorization: Bearer <token>'import requests
url = "https://apiweb.mile.app/api/v4/roles"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://apiweb.mile.app/api/v4/roles', 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/v4/roles",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://apiweb.mile.app/api/v4/roles"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://apiweb.mile.app/api/v4/roles")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v4/roles")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": true,
"data": [
{
"_id": "68db98a7094228379a0d74d4",
"name": "Driver",
"isAdmin": false,
"isDefault": false,
"isDeleted": false,
"permissionList": [
"5f2b8c1e9d3a4b0012345678"
],
"permissionDetails": [
{
"permissionName": "view/task",
"items": []
}
],
"permissions": [],
"organizationId": "65c1f4eeca7c4816d94587b2",
"passwordPolicyId": null,
"updatedTime": "2026-10-01T03:00:00.000000Z",
"createdTime": "2026-10-01T03:00:00.000000Z",
"extendedData": {
"_id": "6abd0f00143a6b09ec0bf801",
"dataTypeId": "6abd0ee0a138a6318d023f20",
"entityId": "68db98a7094228379a0d74d4",
"dataId": "role:68db98a7094228379a0d74d4",
"shiftAllowance": 50000,
"organizationId": "65c1f4eeca7c4816d94587b2"
}
}
]
}{
"status": false,
"message": "Data not found"
}{
"status": false,
"message": "Internal server error, please contact support@mile.app."
}Query Parameters
Pass extendedData to add each role's extendedData: the record of your organization's role extension data type (the custom fields added under Extended data). Off by default, and only the exact value extendedData turns it on.
When your organization has no role extension, the field is left out. When it has one but this role has no record yet, the field is null.
Example: extendedData
extendedData Response
Success
The response is of type object.