Skip to main content

Service Fulfillment Policies

7 API calls in this section.

CRUD for delivery service fulfillment policy profiles. proof_settings has five independent stages: driver_pickup, client_pickup, driver_delivery, warehouse_pickup, and warehouse_delivery. Each stage accepts photo_required and signature_required. payment_policies.refund_delivery_fee_on_cancel and payment_policies.refund_delivery_fee_on_return control whether a collected delivery fee is credited to the sender wallet for whole-order cancellation or return. Defaults are Cancel = refund (true) and Return = no refund (false). COD settlement is independent. Driver delivery flows enforce driver_pickup for non-warehouse pickup endpoints, warehouse_pickup for warehouse pickup endpoints, driver_delivery for non-warehouse delivery endpoints, and warehouse_delivery for warehouse delivery endpoints.

Get Tenant Default Policy​

Delivery & Last-Mile / Service Fulfillment Policies
GET/delivery/tenant-default-policy

Returns data.effective with all inherited policy values and data.tenant_overrides with the explicitly stored tenant setting. Effective payment defaults are refund_delivery_fee_on_cancel=true and refund_delivery_fee_on_return=false.

Query parameters

ParameterTypeDescription
tenant_idstring

Example: {{tenant_id}}

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/tenant-default-policy?tenant_id=${TENANT_ID}&language=en" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}"

Response examples

200OK
Response body
json
1{2  "success": true,3  "data": {4    "effective": {5      "payment_policies": {6        "allow_cod_on_replacement": true,7        "refund_delivery_fee_on_cancel": true,8        "refund_delivery_fee_on_return": false9      }10    },11    "tenant_overrides": null12  }13}

Update Tenant Default Policy​

Delivery & Last-Mile / Service Fulfillment Policies
PUT/delivery/tenant-default-policy

Stores tenant-level defaults. Both refund fields are booleans. Service policy profiles and custom service overrides may override them per service. Invalid types return HTTP 400 with localized validation_error and a field-specific detail.

Query parameters

ParameterTypeDescription
tenant_idstring

Example: {{tenant_id}}

languagestring

Example: en

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

Content-Typestring

Example: application/json

Body parameters

ParameterTypeDescription
payment_policiesobject—
payment_policies.allow_cod_on_replacementboolean—
payment_policies.refund_delivery_fee_on_cancelboolean—
payment_policies.refund_delivery_fee_on_returnboolean—
Staging
Request
curl
1curl --globoff --request PUT "https://staging-api.ondi.io/functions/v1/delivery/tenant-default-policy?tenant_id=${TENANT_ID}&language=en" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3  --header "Content-Type: application/json" \4  --data-raw '{5  "payment_policies": {6    "allow_cod_on_replacement": true,7    "refund_delivery_fee_on_cancel": true,8    "refund_delivery_fee_on_return": false9  }10}'

Response examples

200OK
Response body
json
1{2  "success": true,3  "message": "Tenant default policy updated successfully",4  "data": {5    "payment_policies": {6      "allow_cod_on_replacement": true,7      "refund_delivery_fee_on_cancel": true,8      "refund_delivery_fee_on_return": false9    }10  }11}

List Fulfillment Policies​

Delivery & Last-Mile / Service Fulfillment Policies
GET/delivery/service-policy-profiles

Browse the tenant’s reusable fulfillment policies, including assignment, proof and payment settings.

Query parameters

ParameterTypeDescription
tenant_idstring

Example: {{tenant_id}}

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/service-policy-profiles?tenant_id=${TENANT_ID}&language=en" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}"

Response examples

200OK
Response body
json
1{2  "success": true,3  "policies": [4    {5      "id": "uuid",6      "name": "Express Policy",7      "assignment_mode": "automatic",8      "proof_settings": {9        "driver_pickup": {10          "photo_required": false,11          "signature_required": false12        },13        "client_pickup": {14          "photo_required": false,15          "signature_required": false16        },17        "driver_delivery": {18          "photo_required": true,19          "signature_required": true20        },21        "warehouse_pickup": {22          "photo_required": false,23          "signature_required": false24        },25        "warehouse_delivery": {26          "photo_required": false,27          "signature_required": false28        }29      },30      "active": true,31      "created_at": "2025-01-01T00:00:00Z",32      "updated_at": "2025-01-01T00:00:00Z"33    }34  ],35  "total": 1,36  "pagination": {37    "page": 1,38    "limit": 20,39    "total": 1,40    "total_pages": 141  }42}

Get Fulfillment Policy​

Delivery & Last-Mile / Service Fulfillment Policies
GET/delivery/service-policy-profiles/:id

Read one tenant fulfillment policy and its linked delivery services before changing the policy’s rules.

Path parameters

ParameterTypeDescription
idRequiredstring

Fulfillment policy profile UUID

Query parameters

ParameterTypeDescription
tenant_idstring

Example: {{tenant_id}}

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/service-policy-profiles/${ID}?tenant_id=${TENANT_ID}&language=en" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}"

Response examples

200OK
Response body
json
1{2  "success": true,3  "policy": {4    "id": "uuid",5    "tenant_id": "uuid",6    "name": "Express Policy",7    "assignment_mode": "automatic",8    "proof_settings": {9      "driver_pickup": {10        "photo_required": false,11        "signature_required": false12      },13      "client_pickup": {14        "photo_required": false,15        "signature_required": false16      },17      "driver_delivery": {18        "photo_required": true,19        "signature_required": true20      },21      "warehouse_pickup": {22        "photo_required": false,23        "signature_required": false24      },25      "warehouse_delivery": {26        "photo_required": false,27        "signature_required": false28      }29    },30    "active": true,31    "created_at": "2025-01-01T00:00:00Z",32    "updated_at": "2025-01-01T00:00:00Z"33  },34  "linked_services": []35}

Create Fulfillment Policy​

Delivery & Last-Mile / Service Fulfillment Policies
POST/delivery/service-policy-profiles

Save a reusable set of assignment, proof-of-delivery and payment rules for delivery services.

Query parameters

ParameterTypeDescription
tenant_idstring

Example: {{tenant_id}}

languagestring

Example: en

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

Content-Typestring

Example: application/json

Body parameters

ParameterTypeDescription
namestring—
assignment_modestring—
proof_settingsobject—
proof_settings.driver_pickupobject—
proof_settings.driver_pickup.photo_requiredboolean—
proof_settings.driver_pickup.signature_requiredboolean—
proof_settings.client_pickupobject—
proof_settings.client_pickup.photo_requiredboolean—
proof_settings.client_pickup.signature_requiredboolean—
proof_settings.driver_deliveryobject—
proof_settings.driver_delivery.photo_requiredboolean—
proof_settings.driver_delivery.signature_requiredboolean—
Show 10 more body fields

Additional body parameters

ParameterTypeDescription
proof_settings.warehouse_pickupobject—
proof_settings.warehouse_pickup.photo_requiredboolean—
proof_settings.warehouse_pickup.signature_requiredboolean—
proof_settings.warehouse_deliveryobject—
proof_settings.warehouse_delivery.photo_requiredboolean—
proof_settings.warehouse_delivery.signature_requiredboolean—
payment_policiesobject—
payment_policies.allow_cod_on_replacementboolean—
payment_policies.refund_delivery_fee_on_cancelboolean—
payment_policies.refund_delivery_fee_on_returnboolean—
Staging
Request
curl
1curl --globoff --request POST "https://staging-api.ondi.io/functions/v1/delivery/service-policy-profiles?tenant_id=${TENANT_ID}&language=en" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3  --header "Content-Type: application/json" \4  --data-raw '{5  "name": "Express Policy",6  "assignment_mode": "automatic",7  "proof_settings": {8    "driver_pickup": {9      "photo_required": false,10      "signature_required": false11    },12    "client_pickup": {13      "photo_required": false,14      "signature_required": false15    },16    "driver_delivery": {17      "photo_required": true,18      "signature_required": true19    },20    "warehouse_pickup": {21      "photo_required": false,22      "signature_required": false23    },24    "warehouse_delivery": {25      "photo_required": false,26      "signature_required": false27    }28  },29  "payment_policies": {30    "allow_cod_on_replacement": true,31    "refund_delivery_fee_on_cancel": true,32    "refund_delivery_fee_on_return": false33  }34}'

Response examples

201Created
Response body
json
1{2  "success": true,3  "policy": {4    "id": "uuid",5    "tenant_id": "uuid",6    "name": "Express Policy",7    "assignment_mode": "automatic",8    "proof_settings": {9      "driver_pickup": {10        "photo_required": false,11        "signature_required": false12      },13      "client_pickup": {14        "photo_required": false,15        "signature_required": false16      },17      "driver_delivery": {18        "photo_required": true,19        "signature_required": true20      },21      "warehouse_pickup": {22        "photo_required": false,23        "signature_required": false24      },25      "warehouse_delivery": {26        "photo_required": false,27        "signature_required": false28      }29    },30    "active": true,31    "created_at": "2025-01-01T00:00:00Z",32    "updated_at": "2025-01-01T00:00:00Z"33  }34}

Update Fulfillment Policy​

Delivery & Last-Mile / Service Fulfillment Policies
PUT/delivery/service-policy-profiles/:id

Change the name or fulfillment rules of an existing policy.

Path parameters

ParameterTypeDescription
idRequiredstring

Fulfillment policy profile UUID

Query parameters

ParameterTypeDescription
tenant_idstring

Example: {{tenant_id}}

languagestring

Example: en

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

Content-Typestring

Example: application/json

Body parameters

ParameterTypeDescription
namestring—
proof_settingsobject—
proof_settings.driver_pickupobject—
proof_settings.driver_pickup.photo_requiredboolean—
proof_settings.driver_pickup.signature_requiredboolean—
proof_settings.warehouse_deliveryobject—
proof_settings.warehouse_delivery.photo_requiredboolean—
proof_settings.warehouse_delivery.signature_requiredboolean—
payment_policiesobject—
payment_policies.allow_cod_on_replacementboolean—
payment_policies.refund_delivery_fee_on_cancelboolean—
payment_policies.refund_delivery_fee_on_returnboolean—
Staging
Request
curl
1curl --globoff --request PUT "https://staging-api.ondi.io/functions/v1/delivery/service-policy-profiles/${ID}?tenant_id=${TENANT_ID}&language=en" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3  --header "Content-Type: application/json" \4  --data-raw '{5  "name": "Updated Express Policy",6  "proof_settings": {7    "driver_pickup": {8      "photo_required": true,9      "signature_required": true10    },11    "warehouse_delivery": {12      "photo_required": false,13      "signature_required": false14    }15  },16  "payment_policies": {17    "allow_cod_on_replacement": true,18    "refund_delivery_fee_on_cancel": true,19    "refund_delivery_fee_on_return": true20  }21}'

Response examples

200OK
Response body
json
1{2  "success": true,3  "policy": {4    "id": "uuid",5    "tenant_id": "uuid",6    "name": "Express Policy",7    "assignment_mode": "automatic",8    "proof_settings": {9      "driver_pickup": {10        "photo_required": false,11        "signature_required": false12      },13      "client_pickup": {14        "photo_required": false,15        "signature_required": false16      },17      "driver_delivery": {18        "photo_required": true,19        "signature_required": true20      },21      "warehouse_pickup": {22        "photo_required": false,23        "signature_required": false24      },25      "warehouse_delivery": {26        "photo_required": false,27        "signature_required": false28      }29    },30    "active": true,31    "created_at": "2025-01-01T00:00:00Z",32    "updated_at": "2025-01-01T00:00:00Z"33  }34}

Delete (Deactivate) Fulfillment Policy​

Delivery & Last-Mile / Service Fulfillment Policies
DELETE/delivery/service-policy-profiles/:id

Deactivate a fulfillment policy. A policy still used by a service cannot be deactivated.

Path parameters

ParameterTypeDescription
idRequiredstring

Fulfillment policy profile UUID

Query parameters

ParameterTypeDescription
tenant_idstring

Example: {{tenant_id}}

languagestring

Example: en

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

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

Response examples

200OK
Response body
json
1{2  "success": true,3  "message": "deactivated"4}