Zone Pricing
5 API calls in this section.
List Zone Pricing
/delivery/zone-pricingList pricing rules with SQL-side filtering, sorting, exact pagination, and optional tenant KPI stats. Multi-select semantics are (origin zones OR origin tags) AND (destination zones OR destination tags) AND (services). Each row returns origin.preview, destination.preview, and services.preview with at most three active entities plus exact counts. Filter matches are prioritized in each preview and marked matched=true. services is the only service response field.
Query parameters
| Parameter | Type | Description |
|---|---|---|
page | string | Page number for pagination Example: |
limit | string | Number of items per page Example: |
origin_zone_id | string | Legacy single origin-zone filter. Prefer |
origin_zone_ids | string | Comma-separated or repeated origin zone IDs. OR within origin filters. |
destination_zone_id | string | Legacy single destination-zone filter. Prefer |
destination_zone_ids | string | Comma-separated or repeated destination zone IDs. OR within destination filters. |
origin_tag_id | string | Legacy single origin-tag filter. Prefer |
origin_tag_ids | string | Comma-separated or repeated origin tag IDs. Combined with |
destination_tag_id | string | Legacy single destination-tag filter. Prefer |
destination_tag_ids | string | Comma-separated or repeated destination tag IDs. Combined with |
origin_selector_type | string | Filter by origin selector type (zone|tag) |
destination_selector_type | string | Filter by destination selector type (zone|tag) |
service_id | string | Legacy single service filter. Prefer |
service_ids | string | Comma-separated or repeated service IDs. A rule matches any selected service. |
active | string | Filter by active status (true/false) Example: |
include_stats | string | Set false when KPI stats are not rendered. Rows and stats otherwise come from one database call. Example: |
column_filters | string | JSON object for grid column filters. Multi-select arrays: Example: |
sort_by | string | Sort field. Allowed: Example: |
sort_order | string | Sort direction (asc|desc). Defaults to desc. Example: |
tenant_id | string | Tenant ID (defaults to authenticated user's tenant) |
language | string | Preferred language for response messages Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
1curl --globoff --request GET "https://staging-api.ondi.io/functions/v1/delivery/zone-pricing?page=1&limit=10&active=true&include_stats=true&column_filters=%7B%22origin_zone_ids%22%3A%5B%22uuid-origin-1%22%2C%22uuid-origin-2%22%5D%2C%22service_ids%22%3A%5B%22uuid-service-1%22%5D%2C%22status%22%3A%22true%22%7D&sort_by=created_at&sort_order=desc&tenant_id=&language=en" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}"Response examples
1{2 "success": true,3 "message": "Zone pricing retrieved successfully",4 "zonePricing": [5 {6 "id": "pricing-rule-uuid",7 "active": true,8 "base_price": 1000,9 "per_unit_price": 90,10 "origin_selector_type": "zone",11 "destination_selector_type": "tag",12 "origin": {13 "type": "zone",14 "count": 7,15 "preview": [16 {17 "id": "origin-filtered",18 "name": "West Zone",19 "code": "WEST",20 "matched": true21 },22 {23 "id": "origin-2",24 "name": "Central",25 "code": "CTR",26 "matched": false27 },28 {29 "id": "origin-3",30 "name": "North",31 "code": "NTH",32 "matched": false33 }34 ]35 },36 "destination": {37 "type": "tag",38 "count": 4,39 "preview": [40 {41 "id": "tag-priority",42 "name": "priority",43 "code": null,44 "matched": true45 }46 ]47 },48 "services": {49 "count": 5,50 "preview": [51 {52 "id": "service-express",53 "code": "EXP",54 "name": "Express",55 "matched": true56 },57 {58 "id": "service-parcel",59 "code": "PAR",60 "name": "Parcel",61 "matched": false62 },63 {64 "id": "service-same-day",65 "code": "SD",66 "name": "Same Day",67 "matched": false68 }69 ]70 }71 }72 ],73 "stats": {74 "totalRules": 42,75 "activeRules": 30,76 "inactiveRules": 12,77 "recentlyAdded": []78 },79 "page": 1,80 "limit": 10,81 "total": 4282}Get Zone Pricing
/delivery/zone-pricing/:pricingIdGet details for a pricing rule. Response includes services[{id,name,code,unit_min,unit_max}] for edit-form initialization plus full selector arrays. services is the only service response field.
Path parameters
| Parameter | Type | Description |
|---|---|---|
pricingIdRequired | string | ID of the pricing rule to retrieve Example: |
Query parameters
| Parameter | Type | Description |
|---|---|---|
tenant_idOptional | string | Tenant ID (optional if in auth token) |
language | string | Preferred language for response messages Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
1curl --globoff --request GET "https://staging-api.ondi.io/functions/v1/delivery/zone-pricing/${PRICINGID}?tenant_id=&language=en" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}"Response examples
1{2 "success": true,3 "message": "Zone pricing retrieved successfully",4 "pricing": {5 "id": "uuid",6 "active": true,7 "base_price": 10.5,8 "per_unit_price": 0.75,9 "min_transit_time": 30,10 "max_transit_time": 60,11 "pricing_rules": {},12 "effective_from": "2023-01-01",13 "effective_to": null,14 "origin_selector_type": "zone",15 "destination_selector_type": "tag",16 "services": [17 {18 "id": "uuid-standard",19 "name": "Standard Delivery",20 "code": "STD",21 "unit_min": 1,22 "unit_max": 1023 },24 {25 "id": "uuid-express",26 "name": "Express Delivery",27 "code": "EXP",28 "unit_min": 1,29 "unit_max": 530 }31 ],32 "origins": [33 {34 "id": "uuid-origin-1",35 "name": "Downtown",36 "code": "DT-01"37 }38 ],39 "destinations": [],40 "origin_tags": [],41 "destination_tags": [42 {43 "id": "uuid-tag-1",44 "name": "erbil"45 }46 ]47 }48}Create Zone Pricing
/delivery/zone-pricingCreate one pricing rule for one or more delivery services. service_ids is required and must contain at least one tenant service. A legacy service_id string is accepted as a one-item array. All services share the same selectors, prices, effective window, carrier price, transit times, and pricing_rules. The write is atomic; an overlap for any selected service rejects the entire request with HTTP 409. Unit tiers must cover every selected service's unit range. Frontend: submit all chips as service_ids and display the localized message for 400/404/409 responses.
Query parameters
| Parameter | Type | Description |
|---|---|---|
tenant_id | string | Tenant ID (defaults to authenticated user's tenant) |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
Content-Type | string | Example: |
Body parameters
| Parameter | Type | Description |
|---|---|---|
origin_selector_type | string | — |
destination_selector_type | string | — |
origin_zone_ids | array<string> | — |
destination_tag_ids | array<string> | — |
service_ids | array<string> | — |
base_price | number | — |
per_unit_price | number | — |
min_transit_time | number | — |
max_transit_time | number | — |
pricing_rules | object | — |
effective_from | string | — |
effective_to | null | — |
1curl --globoff --request POST "https://staging-api.ondi.io/functions/v1/delivery/zone-pricing?tenant_id=&language=en" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3 --header "Content-Type: application/json" \4 --data-raw '{5 "origin_selector_type": "zone",6 "destination_selector_type": "tag",7 "origin_zone_ids": [8 "uuid-origin-1"9 ],10 "destination_tag_ids": [11 "uuid-tag-erbil"12 ],13 "service_ids": [14 "uuid-service-standard",15 "uuid-service-express"16 ],17 "base_price": 10.5,18 "per_unit_price": 0.75,19 "min_transit_time": 30,20 "max_transit_time": 60,21 "pricing_rules": {},22 "effective_from": "2025-01-01",23 "effective_to": null24}'Response examples
1{\n "success": true,\n "message": "Pricing rule created successfully",\n "pricing_id": "pricing-rule-uuid"\n}Update Zone Pricing
/delivery/zone-pricing/:pricingIdUpdate a pricing rule and its covered services atomically. When service_ids is provided, it becomes the complete active service set: added IDs are activated and omitted IDs are soft-deactivated. Omit both service_ids and service_id to preserve the current set. An explicit empty service_ids array is rejected. The legacy service_id field is accepted as a one-service replacement. Exact zone rules remain prioritized during runtime resolution. Frontend: initialize chips from pricing.services, submit the complete service_ids array, and use code plus localized message for errors.
Path parameters
| Parameter | Type | Description |
|---|---|---|
pricingIdRequired | string | ID of the pricing rule to update Example: |
Query parameters
| Parameter | Type | Description |
|---|---|---|
tenant_idOptional | string | Tenant ID (optional if in auth token) |
language | string | Preferred language for response messages Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
Content-Type | string | Example: |
Body parameters
| Parameter | Type | Description |
|---|---|---|
origin_selector_type | string | — |
destination_selector_type | string | — |
origin_tag_ids | array<string> | — |
destination_zone_ids | array<string> | — |
service_ids | array<string> | — |
base_price | number | — |
per_unit_price | number | — |
min_transit_time | number | — |
max_transit_time | number | — |
pricing_rules | object | — |
effective_from | string | — |
effective_to | null | — |
1curl --globoff --request PUT "https://staging-api.ondi.io/functions/v1/delivery/zone-pricing/${PRICINGID}?tenant_id=&language=en" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3 --header "Content-Type: application/json" \4 --data-raw '{5 "origin_selector_type": "tag",6 "destination_selector_type": "zone",7 "origin_tag_ids": [8 "uuid-tag-erbil"9 ],10 "destination_zone_ids": [11 "uuid-dest-1",12 "uuid-dest-2"13 ],14 "service_ids": [15 "uuid-service-standard",16 "uuid-service-express"17 ],18 "base_price": 12.5,19 "per_unit_price": 0.85,20 "min_transit_time": 24,21 "max_transit_time": 72,22 "pricing_rules": {},23 "effective_from": "2025-01-01",24 "effective_to": null25}'Response examples
1{\n "success": true,\n "message": "Pricing rule updated successfully"\n}Delete Zone Pricing
/delivery/zone-pricing/:pricingIdSoft-delete a pricing rule by setting active=false. Pricing and relationship history are preserved, and the rule no longer participates in order pricing.
Path parameters
| Parameter | Type | Description |
|---|---|---|
pricingIdRequired | string | ID of the pricing rule to delete Example: |
Query parameters
| Parameter | Type | Description |
|---|---|---|
tenant_idOptional | string | Tenant ID (optional if in auth token) |
language | string | Preferred language for response messages Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
1curl --globoff --request DELETE "https://staging-api.ondi.io/functions/v1/delivery/zone-pricing/${PRICINGID}?tenant_id=&language=en" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}"Response examples
No saved response example. Use Try it to inspect a staging response.