curl --request POST \
--url https://fleet-api.flatpeak.com/zones \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "NGED Bristol constraint zone",
"definition": {
"country_code": "GB",
"postal_codes": [
"BS1",
"BS2",
"BS3"
]
}
}
'import requests
url = "https://fleet-api.flatpeak.com/zones"
payload = {
"name": "NGED Bristol constraint zone",
"definition": {
"country_code": "GB",
"postal_codes": ["BS1", "BS2", "BS3"]
}
}
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: 'NGED Bristol constraint zone',
definition: {country_code: 'GB', postal_codes: ['BS1', 'BS2', 'BS3']}
})
};
fetch('https://fleet-api.flatpeak.com/zones', 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://fleet-api.flatpeak.com/zones",
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' => 'NGED Bristol constraint zone',
'definition' => [
'country_code' => 'GB',
'postal_codes' => [
'BS1',
'BS2',
'BS3'
]
]
]),
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://fleet-api.flatpeak.com/zones"
payload := strings.NewReader("{\n \"name\": \"NGED Bristol constraint zone\",\n \"definition\": {\n \"country_code\": \"GB\",\n \"postal_codes\": [\n \"BS1\",\n \"BS2\",\n \"BS3\"\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://fleet-api.flatpeak.com/zones")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"NGED Bristol constraint zone\",\n \"definition\": {\n \"country_code\": \"GB\",\n \"postal_codes\": [\n \"BS1\",\n \"BS2\",\n \"BS3\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://fleet-api.flatpeak.com/zones")
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\": \"NGED Bristol constraint zone\",\n \"definition\": {\n \"country_code\": \"GB\",\n \"postal_codes\": [\n \"BS1\",\n \"BS2\",\n \"BS3\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "zon_9b3c5d7e1f2a4b6c8d0e2f4a",
"object": "zone",
"live_mode": true,
"name": "NGED Bristol constraint zone",
"definition": {
"country_code": "GB",
"postal_codes": [
"BS1",
"BS2",
"BS3"
]
},
"device_count": null,
"time_created": "2026-08-12T09:30:00Z",
"account_id": "acc_649d465ede6a785d2fa5f905"
}{
"object": "error",
"type": "invalid_request",
"code": "access_denied",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "access_denied",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "access_denied",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "access_denied",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "access_denied",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "access_denied",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "access_denied",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "access_denied",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}Create a zone
Creates a zone in one country: the whole country, or part of it defined by states, postal codes or a GeoJSON MultiPolygon. Membership is resolved by Flatpeak and re-evaluated continuously; Resolving a new zone can take time, so the response returns device_count as null. zone.membership.update fires when the count is ready, and afterwards whenever devices join or leave.
curl --request POST \
--url https://fleet-api.flatpeak.com/zones \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "NGED Bristol constraint zone",
"definition": {
"country_code": "GB",
"postal_codes": [
"BS1",
"BS2",
"BS3"
]
}
}
'import requests
url = "https://fleet-api.flatpeak.com/zones"
payload = {
"name": "NGED Bristol constraint zone",
"definition": {
"country_code": "GB",
"postal_codes": ["BS1", "BS2", "BS3"]
}
}
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: 'NGED Bristol constraint zone',
definition: {country_code: 'GB', postal_codes: ['BS1', 'BS2', 'BS3']}
})
};
fetch('https://fleet-api.flatpeak.com/zones', 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://fleet-api.flatpeak.com/zones",
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' => 'NGED Bristol constraint zone',
'definition' => [
'country_code' => 'GB',
'postal_codes' => [
'BS1',
'BS2',
'BS3'
]
]
]),
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://fleet-api.flatpeak.com/zones"
payload := strings.NewReader("{\n \"name\": \"NGED Bristol constraint zone\",\n \"definition\": {\n \"country_code\": \"GB\",\n \"postal_codes\": [\n \"BS1\",\n \"BS2\",\n \"BS3\"\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://fleet-api.flatpeak.com/zones")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"NGED Bristol constraint zone\",\n \"definition\": {\n \"country_code\": \"GB\",\n \"postal_codes\": [\n \"BS1\",\n \"BS2\",\n \"BS3\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://fleet-api.flatpeak.com/zones")
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\": \"NGED Bristol constraint zone\",\n \"definition\": {\n \"country_code\": \"GB\",\n \"postal_codes\": [\n \"BS1\",\n \"BS2\",\n \"BS3\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "zon_9b3c5d7e1f2a4b6c8d0e2f4a",
"object": "zone",
"live_mode": true,
"name": "NGED Bristol constraint zone",
"definition": {
"country_code": "GB",
"postal_codes": [
"BS1",
"BS2",
"BS3"
]
},
"device_count": null,
"time_created": "2026-08-12T09:30:00Z",
"account_id": "acc_649d465ede6a785d2fa5f905"
}{
"object": "error",
"type": "invalid_request",
"code": "access_denied",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "access_denied",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "access_denied",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "access_denied",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "access_denied",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "access_denied",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "access_denied",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}{
"object": "error",
"type": "invalid_request",
"code": "access_denied",
"message": "The requested resource could not be found.",
"context": "api.price_get",
"live_mode": true,
"time_created": "2026-01-01T00:00:00Z"
}Authorizations
Authenticate with the bearer_token obtained from the authentication endpoint.
Body
Zone payload.
Zone create payload.
Response
Zone response. device_count is null while membership is being resolved.
An area in one country: the whole country, or part of it defined by states, postal codes or a GeoJSON MultiPolygon. Flatpeak resolves membership from enrollment addresses; you receive counts and device IDs, never addresses. zone.membership.update fires on changes.
Was this page helpful?

