curl --request POST \
--url https://apiweb.mile.app/api/v3/geofence \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Warehouse A",
"type": "string",
"dwellMinutes": 5,
"groupId": "66e0a0b1c2d3e4f5a6b7c8d9",
"isActive": true,
"color": "#1E88E5",
"geometry": {
"type": "string",
"coordinates": [
[
[
106.815,
-6.201
],
[
106.818,
-6.201
],
[
106.818,
-6.199
],
[
106.815,
-6.199
]
]
]
}
}
'import requests
url = "https://apiweb.mile.app/api/v3/geofence"
payload = {
"name": "Warehouse A",
"type": "string",
"dwellMinutes": 5,
"groupId": "66e0a0b1c2d3e4f5a6b7c8d9",
"isActive": True,
"color": "#1E88E5",
"geometry": {
"type": "string",
"coordinates": [[[106.815, -6.201], [106.818, -6.201], [106.818, -6.199], [106.815, -6.199]]]
}
}
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({
name: 'Warehouse A',
type: 'string',
dwellMinutes: 5,
groupId: '66e0a0b1c2d3e4f5a6b7c8d9',
isActive: true,
color: '#1E88E5',
geometry: {
type: 'string',
coordinates: [[[106.815, -6.201], [106.818, -6.201], [106.818, -6.199], [106.815, -6.199]]]
}
})
};
fetch('https://apiweb.mile.app/api/v3/geofence', 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/geofence",
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([
'name' => 'Warehouse A',
'type' => 'string',
'dwellMinutes' => 5,
'groupId' => '66e0a0b1c2d3e4f5a6b7c8d9',
'isActive' => true,
'color' => '#1E88E5',
'geometry' => [
'type' => 'string',
'coordinates' => [
[
[
106.815,
-6.201
],
[
106.818,
-6.201
],
[
106.818,
-6.199
],
[
106.815,
-6.199
]
]
]
]
]),
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/geofence"
payload := strings.NewReader("{\n \"name\": \"Warehouse A\",\n \"type\": \"string\",\n \"dwellMinutes\": 5,\n \"groupId\": \"66e0a0b1c2d3e4f5a6b7c8d9\",\n \"isActive\": true,\n \"color\": \"#1E88E5\",\n \"geometry\": {\n \"type\": \"string\",\n \"coordinates\": [\n [\n [\n 106.815,\n -6.201\n ],\n [\n 106.818,\n -6.201\n ],\n [\n 106.818,\n -6.199\n ],\n [\n 106.815,\n -6.199\n ]\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/geofence")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Warehouse A\",\n \"type\": \"string\",\n \"dwellMinutes\": 5,\n \"groupId\": \"66e0a0b1c2d3e4f5a6b7c8d9\",\n \"isActive\": true,\n \"color\": \"#1E88E5\",\n \"geometry\": {\n \"type\": \"string\",\n \"coordinates\": [\n [\n [\n 106.815,\n -6.201\n ],\n [\n 106.818,\n -6.201\n ],\n [\n 106.818,\n -6.199\n ],\n [\n 106.815,\n -6.199\n ]\n ]\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/geofence")
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 \"name\": \"Warehouse A\",\n \"type\": \"string\",\n \"dwellMinutes\": 5,\n \"groupId\": \"66e0a0b1c2d3e4f5a6b7c8d9\",\n \"isActive\": true,\n \"color\": \"#1E88E5\",\n \"geometry\": {\n \"type\": \"string\",\n \"coordinates\": [\n [\n [\n 106.815,\n -6.201\n ],\n [\n 106.818,\n -6.201\n ],\n [\n 106.818,\n -6.199\n ],\n [\n 106.815,\n -6.199\n ]\n ]\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Data successfully created.",
"data": {
"_id": "66e0a1b2c3d4e5f6a7b8c9d0",
"name": "Warehouse A",
"organizationId": "64d99303be0ad015c461c932",
"groupId": "66e0a0b1c2d3e4f5a6b7c8d9",
"type": "string",
"geometry": {
"type": "string",
"coordinates": [
[
[
106.815,
-6.201
],
[
106.818,
-6.201
],
[
106.818,
-6.199
],
[
106.815,
-6.199
],
[
106.815,
-6.201
]
]
]
},
"center": null,
"radius": null,
"dwellMinutes": 5,
"isActive": true,
"color": "#1E88E5",
"createdBy": "[email protected]",
"updatedTime": "2026-10-01T03:00:00.000000Z",
"createdTime": "2026-10-01T03:00:00.000000Z"
}
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Internal server error, please contact [email protected]."
}Create geofence
Creates a geofence. name, type and dwellMinutes are required, plus geometry for a polygon or center and radius for a circle. A name already used in your organization or a self-crossing polygon returns 400.
A circle is also stored as a 64-point polygon in geometry, so both shapes work the same way for detection.
Requires permission add/geofence.
curl --request POST \
--url https://apiweb.mile.app/api/v3/geofence \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Warehouse A",
"type": "string",
"dwellMinutes": 5,
"groupId": "66e0a0b1c2d3e4f5a6b7c8d9",
"isActive": true,
"color": "#1E88E5",
"geometry": {
"type": "string",
"coordinates": [
[
[
106.815,
-6.201
],
[
106.818,
-6.201
],
[
106.818,
-6.199
],
[
106.815,
-6.199
]
]
]
}
}
'import requests
url = "https://apiweb.mile.app/api/v3/geofence"
payload = {
"name": "Warehouse A",
"type": "string",
"dwellMinutes": 5,
"groupId": "66e0a0b1c2d3e4f5a6b7c8d9",
"isActive": True,
"color": "#1E88E5",
"geometry": {
"type": "string",
"coordinates": [[[106.815, -6.201], [106.818, -6.201], [106.818, -6.199], [106.815, -6.199]]]
}
}
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({
name: 'Warehouse A',
type: 'string',
dwellMinutes: 5,
groupId: '66e0a0b1c2d3e4f5a6b7c8d9',
isActive: true,
color: '#1E88E5',
geometry: {
type: 'string',
coordinates: [[[106.815, -6.201], [106.818, -6.201], [106.818, -6.199], [106.815, -6.199]]]
}
})
};
fetch('https://apiweb.mile.app/api/v3/geofence', 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/geofence",
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([
'name' => 'Warehouse A',
'type' => 'string',
'dwellMinutes' => 5,
'groupId' => '66e0a0b1c2d3e4f5a6b7c8d9',
'isActive' => true,
'color' => '#1E88E5',
'geometry' => [
'type' => 'string',
'coordinates' => [
[
[
106.815,
-6.201
],
[
106.818,
-6.201
],
[
106.818,
-6.199
],
[
106.815,
-6.199
]
]
]
]
]),
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/geofence"
payload := strings.NewReader("{\n \"name\": \"Warehouse A\",\n \"type\": \"string\",\n \"dwellMinutes\": 5,\n \"groupId\": \"66e0a0b1c2d3e4f5a6b7c8d9\",\n \"isActive\": true,\n \"color\": \"#1E88E5\",\n \"geometry\": {\n \"type\": \"string\",\n \"coordinates\": [\n [\n [\n 106.815,\n -6.201\n ],\n [\n 106.818,\n -6.201\n ],\n [\n 106.818,\n -6.199\n ],\n [\n 106.815,\n -6.199\n ]\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/geofence")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Warehouse A\",\n \"type\": \"string\",\n \"dwellMinutes\": 5,\n \"groupId\": \"66e0a0b1c2d3e4f5a6b7c8d9\",\n \"isActive\": true,\n \"color\": \"#1E88E5\",\n \"geometry\": {\n \"type\": \"string\",\n \"coordinates\": [\n [\n [\n 106.815,\n -6.201\n ],\n [\n 106.818,\n -6.201\n ],\n [\n 106.818,\n -6.199\n ],\n [\n 106.815,\n -6.199\n ]\n ]\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiweb.mile.app/api/v3/geofence")
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 \"name\": \"Warehouse A\",\n \"type\": \"string\",\n \"dwellMinutes\": 5,\n \"groupId\": \"66e0a0b1c2d3e4f5a6b7c8d9\",\n \"isActive\": true,\n \"color\": \"#1E88E5\",\n \"geometry\": {\n \"type\": \"string\",\n \"coordinates\": [\n [\n [\n 106.815,\n -6.201\n ],\n [\n 106.818,\n -6.201\n ],\n [\n 106.818,\n -6.199\n ],\n [\n 106.815,\n -6.199\n ]\n ]\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"status": true,
"message": "Data successfully created.",
"data": {
"_id": "66e0a1b2c3d4e5f6a7b8c9d0",
"name": "Warehouse A",
"organizationId": "64d99303be0ad015c461c932",
"groupId": "66e0a0b1c2d3e4f5a6b7c8d9",
"type": "string",
"geometry": {
"type": "string",
"coordinates": [
[
[
106.815,
-6.201
],
[
106.818,
-6.201
],
[
106.818,
-6.199
],
[
106.815,
-6.199
],
[
106.815,
-6.201
]
]
]
},
"center": null,
"radius": null,
"dwellMinutes": 5,
"isActive": true,
"color": "#1E88E5",
"createdBy": "[email protected]",
"updatedTime": "2026-10-01T03:00:00.000000Z",
"createdTime": "2026-10-01T03:00:00.000000Z"
}
}{
"status": false,
"message": "Bad request - invalid parameters provided."
}{
"status": false,
"message": "Internal server error, please contact [email protected]."
}Authorizations
Use a valid Bearer token to authenticate.
Body
Name of the geofence. Maximum 100 characters, unique within your organization.
Example: Warehouse A
100Minutes a driver must stay inside before an enter alert is raised. 0 to 1440.
Example: 5
0 <= x <= 1440The input type of the component (e.g., string, number, date, etc.)
Geofence group id, or null for no group.
Example: 66e0a0b1c2d3e4f5a6b7c8d9
Only active geofences raise alerts.
Example: true
Display color. Maximum 9 characters.
Example: #1E88E5
9Polygon shape, required when type is polygon. GeoJSON Polygon with exactly one ring of at least 3 points; the ring is closed automatically and must not cross itself. Coordinates are [longitude, latitude]; longitude between -180 and 180, latitude between -90 and 90.
Show child attributes
Show child attributes
Circle center, required when type is circle. Coordinates are [longitude, latitude]; longitude between -180 and 180, latitude between -90 and 90.
Show child attributes
Show child attributes
Circle radius in meters, required when type is circle. 1 to 50000.
Example: 250
1 <= x <= 50000