Skip to main content

Zones

7 API calls in this section.

List Zones​

Delivery & Last-Mile / Zones
GET/delivery/zones

List delivery zones with pagination, advanced column filters, sorting, and tenant-wide stats. Requires valid authentication.

Query parameters

ParameterTypeDescription
pageOptionalstring

Page number for pagination (default: 1)

Example: 1

limitOptionalstring

Number of items per page (default: 10, max: 100)

Example: 10

is_activeOptionalstring

Filter by active status (true/false)

Example: true

inbound_enabledOptionalstring

Filter zones by inbound external integration status (true/false) Filter by inbound external integration status (true/false)

outbound_enabledOptionalstring

Filter zones by outbound external integration status (true/false) Filter by outbound external integration status (true/false)

external_integrationOptionalstring

Filter zones by external integration enabled/disabled status (true/false) Filter by external integration enabled/disabled status (true/false)

nameOptionalstring

Filter zones by name (partial match)

codeOptionalstring

Filter zones by exact code match

searchOptionalstring

Search by zone name or code

carrier_codeOptionalstring

Filter zones by enabled external carrier code Filter by enabled external carrier code

sort_bystring

Sort by one of: name, code, created_at, is_active, carrier_code One of name, code, created_at, is_active, carrier_code

sort_orderOptionalstring

Sort order: asc or desc. Defaults to desc when sort_by is provided asc or desc (defaults to desc when sort_by is provided)

column_filtersOptionalstring

JSON string with column filters. Supported keys: name, code, is_active, carrier_code, internal_enabled, inbound_enabled, outbound_enabled, external_integration, created_at JSON string with keys name, code, is_active, carrier_code, internal_enabled, inbound_enabled, outbound_enabled, external_integration, created_at

tenant_idOptionalstring

Tenant ID (optional if in auth token) Tenant ID (defaults to authenticated user's tenant)

languageOptionalstring

Preferred language for response messages

Example: en

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

Staging
Request
curl
1curl --globoff --request GET "https://staging-api.ondi.io/functions/v1/delivery/zones?page=1&limit=10&is_active=true&inbound_enabled=&outbound_enabled=&external_integration=&name=&code=&search=&carrier_code=&sort_by=&sort_order=&column_filters=&tenant_id=&language=en" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}"

Response examples

200OK
Response body
json
1{2  "success": true,3  "message": "Zones retrieved successfully",4  "zones": [5    {6      "id": "uuid",7      "name": "Downtown",8      "code": "DT-01",9      "internal_enabled": true,10      "is_active": true,11      "created_at": "2023-01-01T00:00:00Z",12      "updated_at": "2023-01-02T00:00:00Z",13      "boundaries": {14        "type": "polygon",15        "coordinates": []16      },17      "zone_geom": null,18      "zone_metadata": {19        "population_density": "high"20      },21      "tags": [22        "erbil",23        "airport"24      ],25      "external_integration": {26        "carrier_code": "PRIME",27        "is_enabled": true,28        "inbound_enabled": true,29        "outbound_enabled": true,30        "warehouse_id": "uuid"31      }32    }33  ],34  "stats": {35    "totalZones": 5,36    "activeZones": 4,37    "externalZones": 2,38    "recentlyAdded": [39      {40        "name": "Airport Zone",41        "created_at": "2025-10-01T00:00:00Z"42      }43    ]44  },45  "page": 1,46  "limit": 10,47  "total": 548}

Create Zone​

Delivery & Last-Mile / Zones
POST/delivery/zones

Create a new delivery zone. Requires manage:operations:tenant permission.

  • Requires valid authentication token with manage:operations:tenant permission

Query parameters

ParameterTypeDescription
tenant_idOptionalstring

Tenant ID (optional if in auth token) Tenant ID (defaults to authenticated user's tenant)

languageOptionalstring

Preferred language for response messages

Example: en

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

Content-Typestring

Example: application/json

Body parameters

ParameterTypeDescription
namestring—
codestring—
boundariesobject—
boundaries.typestring—
boundaries.coordinatesarray—
zone_metadataobject—
zone_metadata.population_densitystring—
tagsarray<string>—
is_activeboolean—
Staging
Request
curl
1curl --globoff --request POST "https://staging-api.ondi.io/functions/v1/delivery/zones?tenant_id=&language=en" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3  --header "Content-Type: application/json" \4  --data-raw '{5  "name": "Downtown",6  "code": "DT-01",7  "boundaries": {8    "type": "polygon",9    "coordinates": []10  },11  "zone_metadata": {12    "population_density": "high"13  },14  "tags": [15    "Erbil",16    "Airport"17  ],18  "is_active": true19}'
Other request examples (1)
Request example 1
json
1{2  "name": "Downtown",3  "code": "DT-01",4  "boundaries": {5    "type": "polygon",6    "coordinates": []7  },8  "zone_metadata": {9    "population_density": "high"10  },11  "is_active": true12}

Response examples

201Created
Response body
json
1{2  "success": true,3  "message": "Zone created successfully"4}

Get Zone​

Delivery & Last-Mile / Zones
GET/delivery/zones/:zoneId

Get details of a specific delivery zone. Requires view:tenant permission.

Path parameters

ParameterTypeDescription
zoneIdRequiredstring

ID of the zone to retrieve

Example: uuid

Query parameters

ParameterTypeDescription
tenant_idOptionalstring

Tenant ID (optional if in auth token) Tenant ID (defaults to authenticated user's tenant)

languageOptionalstring

Preferred language for response messages

Example: en

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

Staging
Request
curl
1curl --globoff --request GET "https://staging-api.ondi.io/functions/v1/delivery/zones/${ZONEID}?tenant_id=&language=en" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}"

Response examples

200OK
Response body
json
1{2  "success": true,3  "message": "Zone retrieved successfully",4  "zone": {5    "id": "uuid",6    "tenant_id": "uuid",7    "name": "Downtown",8    "code": "DT-01",9    "boundaries": {10      "type": "polygon",11      "coordinates": []12    },13    "zone_metadata": {14      "population_density": "high"15    },16    "tags": [17      "erbil",18      "airport"19    ],20    "is_active": true,21    "created_at": "2023-01-01T00:00:00Z",22    "updated_at": "2023-01-02T00:00:00Z"23  }24}

Update Zone​

Delivery & Last-Mile / Zones
PUT/delivery/zones/:zoneId

Update an existing delivery zone. Requires manage:operations:tenant permission.

Path parameters

ParameterTypeDescription
zoneIdRequiredstring

ID of the zone to update

Example: uuid

Query parameters

ParameterTypeDescription
tenant_idOptionalstring

Tenant ID (optional if in auth token)

languagestring

Preferred language for response messages

Example: en

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

Content-Typestring

Example: application/json

Body parameters

ParameterTypeDescription
namestring—
codestring—
boundariesobject—
boundaries.typestring—
boundaries.coordinatesarray—
zone_metadataobject—
zone_metadata.population_densitystring—
tagsarray<string>—
is_activeboolean—
Staging
Request
curl
1curl --globoff --request PUT "https://staging-api.ondi.io/functions/v1/delivery/zones/${ZONEID}?tenant_id=&language=en" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3  --header "Content-Type: application/json" \4  --data-raw '{5  "name": "Downtown Updated",6  "code": "DT-01-UPD",7  "boundaries": {8    "type": "polygon",9    "coordinates": []10  },11  "zone_metadata": {12    "population_density": "medium"13  },14  "tags": [15    "Erbil",16    "Out Of City"17  ],18  "is_active": true19}'

Response examples

200OK
Response body
json
1{2  "success": true,3  "message": "Zone updated successfully",4  "zone": {5    "id": "uuid",6    "name": "Downtown Updated",7    "tags": [8      "erbil",9      "out of city"10    ],11    "updated_at": "2023-01-02T00:00:00Z"12  }13}

Delete Zone​

Delivery & Last-Mile / Zones
DELETE/delivery/zones/:zoneId

Hard-delete a delivery zone after checks

blocks if any non-terminal delivery (status not delivered/failed/cancelled/returned) references the zone as pickup or dropoff zone, or if the zone appears in zone pricing origin/destination rules. Clears the zone id from all drivers' preferred_zone_ids for the tenant. Requires manage:operations:tenant permission. Apply migration 20260331130000_zone_delete_driver_preferences_and_delivery_zone_fk so remove_zone_from_tenant_driver_preferences exists and historical deliveries can release FKs (SET NULL).

Path parameters

ParameterTypeDescription
zoneIdRequiredstring

ID of the zone to delete

Example: uuid

Query parameters

ParameterTypeDescription
tenant_idOptionalstring

Tenant ID (optional if in auth token)

languagestring

Preferred language for response messages

Example: en

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

Staging
Request
curl
1curl --globoff --request DELETE "https://staging-api.ondi.io/functions/v1/delivery/zones/${ZONEID}?tenant_id=&language=en" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}"

Response examples

200OK
Response body
json
1{2  "success": true,3  "message": "Zone deleted successfully",4  "data": null5}

List Zone Tags​

Delivery & Last-Mile / Zones
GET/delivery/zone-tags

List tenant zone tags for tag autocomplete.

Query parameters

ParameterTypeDescription
pagestring

Example: 1

limitstring

Example: 20

searchstring—
tenant_idstring—
languagestring

Example: en

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

Staging
Request
curl
1curl --globoff --request GET "https://staging-api.ondi.io/functions/v1/delivery/zone-tags?page=1&limit=20&search=&tenant_id=&language=en" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}"

Response examples

200OK
Response body
json
1{2  "success": true,3  "message": "Zone tags retrieved successfully",4  "tags": [5    {6      "id": "uuid-tag-1",7      "name": "erbil"8    },9    {10      "id": "uuid-tag-2",11      "name": "airport"12    }13  ],14  "page": 1,15  "limit": 20,16  "total": 217}

Show Zone Pricing (Perspective)​

Delivery & Last-Mile / Zones
GET/delivery/zones/:zoneId/pricing

Show all pricing rules related to this zone. Each row is projected from the zone perspective: the matched side contains only the main zone, the counterparty side contains all zones/tags, and rule.services contains every active service covered by the rule. service_id filters by membership in that array. rule.services is the only service response field.

Path parameters

ParameterTypeDescription
zoneIdRequiredstring

ID of the zone to show pricing for

Example: uuid

Query parameters

ParameterTypeDescription
pagestring

Example: 1

limitstring

Example: 50

service_idstring—
activestring—
tenant_idstring—
languagestring

Example: en

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

Staging
Request
curl
1curl --globoff --request GET "https://staging-api.ondi.io/functions/v1/delivery/zones/${ZONEID}/pricing?page=1&limit=50&service_id=&active=&tenant_id=&language=en" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}"

Response examples

200OK
Response body
json
1{2  "success": true,3  "message": "Zone Pricing Retrieved Successfully",4  "zone": {5    "id": "uuid",6    "name": "Downtown",7    "code": "DT-01"8  },9  "pricing": [10    {11      "rule": {12        "id": "uuid",13        "active": true,14        "base_price": 10.5,15        "per_unit_price": 0.75,16        "effective_from": "2025-01-01",17        "effective_to": null,18        "origin_selector_type": "zone",19        "destination_selector_type": "tag",20        "origin_zones_count": 2,21        "destination_tags_count": 1,22        "services": [23          {24            "id": "uuid-standard",25            "name": "Standard Delivery",26            "code": "STD"27          },28          {29            "id": "uuid-express",30            "name": "Express Delivery",31            "code": "EXP"32          }33        ]34      },35      "match": {36        "matched_side": "origin",37        "matched_by": "zone",38        "matched_tags": []39      },40      "origin": {41        "selector_type": "zone",42        "zones": [43          {44            "id": "uuid",45            "name": "Downtown",46            "code": "DT-01"47          }48        ],49        "tags": []50      },51      "destination": {52        "selector_type": "tag",53        "zones": [],54        "tags": [55          {56            "id": "uuid",57            "name": "erbil"58          }59        ]60      }61    }62  ],63  "page": 1,64  "limit": 50,65  "total": 166}