Create delivery zone
Creates a delivery zone for a connected location. Zone names must be unique per location. Requires delivery_zones:write and an active connection to the location.
curl --request POST \
--url https://api.maple.inc/v1/locations/{locationId}/delivery_zones \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"polygon": {
"type": "Polygon",
"coordinates": [
[
[
123,
123
]
]
]
},
"delivery_fee_cents": 123,
"min_order_cents": 123,
"max_distance_miles": 123,
"is_active": true,
"priority": 123,
"radius_miles": 123
}
'import requests
url = "https://api.maple.inc/v1/locations/{locationId}/delivery_zones"
payload = {
"name": "<string>",
"polygon": {
"type": "Polygon",
"coordinates": [[[123, 123]]]
},
"delivery_fee_cents": 123,
"min_order_cents": 123,
"max_distance_miles": 123,
"is_active": True,
"priority": 123,
"radius_miles": 123
}
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: '<string>',
polygon: {type: 'Polygon', coordinates: [[[123, 123]]]},
delivery_fee_cents: 123,
min_order_cents: 123,
max_distance_miles: 123,
is_active: true,
priority: 123,
radius_miles: 123
})
};
fetch('https://api.maple.inc/v1/locations/{locationId}/delivery_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://api.maple.inc/v1/locations/{locationId}/delivery_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' => '<string>',
'polygon' => [
'type' => 'Polygon',
'coordinates' => [
[
[
123,
123
]
]
]
],
'delivery_fee_cents' => 123,
'min_order_cents' => 123,
'max_distance_miles' => 123,
'is_active' => true,
'priority' => 123,
'radius_miles' => 123
]),
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://api.maple.inc/v1/locations/{locationId}/delivery_zones"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"polygon\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n 123,\n 123\n ]\n ]\n ]\n },\n \"delivery_fee_cents\": 123,\n \"min_order_cents\": 123,\n \"max_distance_miles\": 123,\n \"is_active\": true,\n \"priority\": 123,\n \"radius_miles\": 123\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://api.maple.inc/v1/locations/{locationId}/delivery_zones")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"polygon\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n 123,\n 123\n ]\n ]\n ]\n },\n \"delivery_fee_cents\": 123,\n \"min_order_cents\": 123,\n \"max_distance_miles\": 123,\n \"is_active\": true,\n \"priority\": 123,\n \"radius_miles\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.maple.inc/v1/locations/{locationId}/delivery_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\": \"<string>\",\n \"polygon\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n 123,\n 123\n ]\n ]\n ]\n },\n \"delivery_fee_cents\": 123,\n \"min_order_cents\": 123,\n \"max_distance_miles\": 123,\n \"is_active\": true,\n \"priority\": 123,\n \"radius_miles\": 123\n}"
response = http.request(request)
puts response.read_body{
"object": "delivery_zone",
"id": "<string>",
"location_id": "<string>",
"name": "<string>",
"zone_type": "polygon",
"polygon": {
"type": "Polygon",
"coordinates": [
[
[
123,
123
]
]
]
},
"radius_miles": 123,
"delivery_fee_cents": 123,
"min_order_cents": 123,
"max_distance_miles": 123,
"is_active": true,
"priority": 123,
"created_at": "<string>",
"updated_at": "<string>"
}{
"_tag": "DeveloperApiBadRequest",
"message": "<string>",
"code": "<string>"
}{
"_tag": "DeveloperApiUnauthorized",
"message": "<string>"
}{
"_tag": "DeveloperApiForbidden",
"code": "insufficient_scope",
"message": "<string>"
}{
"_tag": "DeveloperApiNotFound",
"message": "<string>"
}{
"_tag": "DeveloperApiRateLimited",
"message": "<string>",
"retry_after": 123
}Authorizations
API key — mpk_test_… for the sandbox, mpk_live_… for production. Issued by Maple during partner onboarding.
Path Parameters
Body
1^\S[\s\S]*\S$|^\S$|^$A GeoJSON Polygon. Coordinates are [longitude, latitude] rings; the first ring must be closed.
Show child attributes
Show child attributes
polygon, circle Response
A delivery zone. delivery_fee_cents and min_order_cents are integer USD cents; created_at / updated_at are ISO 8601 timestamps.
A delivery zone. delivery_fee_cents and min_order_cents are integer USD cents; created_at / updated_at are ISO 8601 timestamps.
delivery_zone polygon, circle A GeoJSON Polygon. Coordinates are [longitude, latitude] rings; the first ring must be closed.
Show child attributes
Show child attributes
Was this page helpful?
curl --request POST \
--url https://api.maple.inc/v1/locations/{locationId}/delivery_zones \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"polygon": {
"type": "Polygon",
"coordinates": [
[
[
123,
123
]
]
]
},
"delivery_fee_cents": 123,
"min_order_cents": 123,
"max_distance_miles": 123,
"is_active": true,
"priority": 123,
"radius_miles": 123
}
'import requests
url = "https://api.maple.inc/v1/locations/{locationId}/delivery_zones"
payload = {
"name": "<string>",
"polygon": {
"type": "Polygon",
"coordinates": [[[123, 123]]]
},
"delivery_fee_cents": 123,
"min_order_cents": 123,
"max_distance_miles": 123,
"is_active": True,
"priority": 123,
"radius_miles": 123
}
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: '<string>',
polygon: {type: 'Polygon', coordinates: [[[123, 123]]]},
delivery_fee_cents: 123,
min_order_cents: 123,
max_distance_miles: 123,
is_active: true,
priority: 123,
radius_miles: 123
})
};
fetch('https://api.maple.inc/v1/locations/{locationId}/delivery_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://api.maple.inc/v1/locations/{locationId}/delivery_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' => '<string>',
'polygon' => [
'type' => 'Polygon',
'coordinates' => [
[
[
123,
123
]
]
]
],
'delivery_fee_cents' => 123,
'min_order_cents' => 123,
'max_distance_miles' => 123,
'is_active' => true,
'priority' => 123,
'radius_miles' => 123
]),
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://api.maple.inc/v1/locations/{locationId}/delivery_zones"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"polygon\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n 123,\n 123\n ]\n ]\n ]\n },\n \"delivery_fee_cents\": 123,\n \"min_order_cents\": 123,\n \"max_distance_miles\": 123,\n \"is_active\": true,\n \"priority\": 123,\n \"radius_miles\": 123\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://api.maple.inc/v1/locations/{locationId}/delivery_zones")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"polygon\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n 123,\n 123\n ]\n ]\n ]\n },\n \"delivery_fee_cents\": 123,\n \"min_order_cents\": 123,\n \"max_distance_miles\": 123,\n \"is_active\": true,\n \"priority\": 123,\n \"radius_miles\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.maple.inc/v1/locations/{locationId}/delivery_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\": \"<string>\",\n \"polygon\": {\n \"type\": \"Polygon\",\n \"coordinates\": [\n [\n [\n 123,\n 123\n ]\n ]\n ]\n },\n \"delivery_fee_cents\": 123,\n \"min_order_cents\": 123,\n \"max_distance_miles\": 123,\n \"is_active\": true,\n \"priority\": 123,\n \"radius_miles\": 123\n}"
response = http.request(request)
puts response.read_body{
"object": "delivery_zone",
"id": "<string>",
"location_id": "<string>",
"name": "<string>",
"zone_type": "polygon",
"polygon": {
"type": "Polygon",
"coordinates": [
[
[
123,
123
]
]
]
},
"radius_miles": 123,
"delivery_fee_cents": 123,
"min_order_cents": 123,
"max_distance_miles": 123,
"is_active": true,
"priority": 123,
"created_at": "<string>",
"updated_at": "<string>"
}{
"_tag": "DeveloperApiBadRequest",
"message": "<string>",
"code": "<string>"
}{
"_tag": "DeveloperApiUnauthorized",
"message": "<string>"
}{
"_tag": "DeveloperApiForbidden",
"code": "insufficient_scope",
"message": "<string>"
}{
"_tag": "DeveloperApiNotFound",
"message": "<string>"
}{
"_tag": "DeveloperApiRateLimited",
"message": "<string>",
"retry_after": 123
}