Skip to main content

Customer Preferences

4 API calls in this section.

Endpoints for managing customer delivery preferences. These preferences define how, when, and where customers wish to receive their deliveries.

List Customer Preferences​

Delivery & Last-Mile / Customer Preferences
GET/delivery/customer-preferences

List customer delivery preferences with pagination, sorting, column filters and stats.

Query parameters

ParameterTypeDescription
pagestring

Page number (default: 1)

Example: 1

limitstring

Items per page (default: 10)

Example: 10

customer_idstring

Filter by customer UUID (standalone param)

location_idstring

Filter by address UUID (standalone param)

searchstring

Search across customer full_name and address full_address (ILIKE)

sort_bystring

Sort column: customer_id (sorts by full_name) | preferred_day_of_week | preferred_time_start | preferred_time_end | created_at (default)

sort_orderstring

asc or desc (default: desc)

Example: desc

column_filtersstring

JSON object. Keys: customer_id (uuid string), location_id (uuid string), preferred_day_of_week ("0"–"6"), delivery_instructions (ILIKE), delivery_location ("true"/"false" → leave_at_door), signature_required ("true"/"false"). Example: {"preferred_day_of_week":"1","signature_required":"true"}

tenant_idOptionalstring

Tenant ID (optional if in auth token)

languagestring

Preferred language

Example: en

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

Staging
Request
curl
1curl --globoff --request GET "https://staging-api.ondi.io/functions/v1/delivery/customer-preferences?page=1&limit=10&customer_id=&location_id=&search=&sort_by=&sort_order=desc&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": "Customer preferences retrieved successfully",4  "preferences": [5    {6      "id": "uuid",7      "preferred_day_of_week": "1",8      "preferred_time_start": "09:00",9      "preferred_time_end": "17:00",10      "delivery_instructions": "Leave at door",11      "delivery_options": {12        "signature_required": false,13        "leave_at_door": true14      },15      "created_at": "2025-01-15T08:00:00Z",16      "customer": {17        "id": "uuid",18        "full_name": "Jane Doe"19      },20      "location": {21        "id": "uuid",22        "full_address": "123 Main St"23      }24    }25  ],26  "page": 1,27  "limit": 10,28  "total": 25,29  "stats": {30    "totalPreferences": 100,31    "signatureRequiredCount": 30,32    "leaveAtDoorCount": 55,33    "recentlyAddedCount": 734  }35}

Create Customer Preference​

Delivery & Last-Mile / Customer Preferences
POST/delivery/customer-preferences

Create a new customer delivery preference. Customers can only create preferences for themselves, while admin users can create preferences for any customer.

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
customer_idstring—
location_idstring—
preferred_day_of_weeknumber—
preferred_time_startstring—
preferred_time_endstring—
delivery_instructionsstring—
delivery_optionsobject—
delivery_options.signature_requiredboolean—
delivery_options.leave_with_neighborboolean—
delivery_options.leave_at_doorboolean—
delivery_options.requires_appointmentboolean—
delivery_options.package_handlingobject—
Show 19 more body fields

Additional body parameters

ParameterTypeDescription
delivery_options.package_handling.fragileboolean—
delivery_options.package_handling.temperature_sensitiveboolean—
delivery_options.authorized_receiversarray<object>—
delivery_options.authorized_receivers.namestring—
delivery_options.authorized_receivers.relationshipstring—
delivery_options.authorized_receivers.contactstring—
contact_preferencesobject—
contact_preferences.notification_methodsarray<object>—
contact_preferences.notification_methods.typestring—
contact_preferences.notification_methods.enabledboolean—
contact_preferences.notification_methods.contactstring—
contact_preferences.notification_eventsobject—
contact_preferences.notification_events.on_dispatchboolean—
contact_preferences.notification_events.day_beforeboolean—
contact_preferences.notification_events.day_ofboolean—
contact_preferences.notification_events.hour_beforeboolean—
contact_preferences.notification_events.on_arrivalboolean—
contact_preferences.notification_events.on_completionboolean—
contact_preferences.languagestring—
Staging
Request
curl
1curl --globoff --request POST "https://staging-api.ondi.io/functions/v1/delivery/customer-preferences?tenant_id=&language=en" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3  --header "Content-Type: application/json" \4  --data-raw '{5  "customer_id": "uuid",6  "location_id": "uuid",7  "preferred_day_of_week": 1,8  "preferred_time_start": "09:00",9  "preferred_time_end": "17:00",10  "delivery_instructions": "Leave packages at the front door",11  "delivery_options": {12    "signature_required": false,13    "leave_with_neighbor": true,14    "leave_at_door": true,15    "requires_appointment": false,16    "package_handling": {17      "fragile": true,18      "temperature_sensitive": false19    },20    "authorized_receivers": [21      {22        "name": "John Smith",23        "relationship": "Neighbor",24        "contact": "+1987654321"25      }26    ]27  },28  "contact_preferences": {29    "notification_methods": [30      {31        "type": "sms",32        "enabled": true,33        "contact": "+1234567890"34      },35      {36        "type": "email",37        "enabled": true,38        "contact": "[email protected]"39      }40    ],41    "notification_events": {42      "on_dispatch": true,43      "day_before": false,44      "day_of": true,45      "hour_before": true,46      "on_arrival": true,47      "on_completion": true48    },49    "language": "en"50  }51}'

Response examples

201Created
Response body
json
1{2  "success": true,3  "message": "Preference created successfully",4  "id": "uuid"5}

Update Customer Preference​

Delivery & Last-Mile / Customer Preferences
PUT/delivery/customer-preferences/:preferenceId

Update an existing customer delivery preference. Customers can only update their own preferences, while admin users can update any customer's preferences. The customer_id cannot be changed.

Path parameters

ParameterTypeDescription
preferenceIdRequiredstring

ID of the preference to update

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
location_idstring—
preferred_day_of_weeknumber—
preferred_time_startstring—
preferred_time_endstring—
delivery_instructionsstring—
delivery_optionsobject—
delivery_options.signature_requiredboolean—
delivery_options.leave_with_neighborboolean—
delivery_options.leave_at_doorboolean—
contact_preferencesobject—
contact_preferences.notification_methodsarray<object>—
contact_preferences.notification_methods.typestring—
Show 9 more body fields

Additional body parameters

ParameterTypeDescription
contact_preferences.notification_methods.enabledboolean—
contact_preferences.notification_methods.contactstring—
contact_preferences.notification_eventsobject—
contact_preferences.notification_events.on_dispatchboolean—
contact_preferences.notification_events.day_beforeboolean—
contact_preferences.notification_events.day_ofboolean—
contact_preferences.notification_events.hour_beforeboolean—
contact_preferences.notification_events.on_arrivalboolean—
contact_preferences.notification_events.on_completionboolean—
Staging
Request
curl
1curl --globoff --request PUT "https://staging-api.ondi.io/functions/v1/delivery/customer-preferences/${PREFERENCEID}?tenant_id=&language=en" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3  --header "Content-Type: application/json" \4  --data-raw '{5  "location_id": "uuid",6  "preferred_day_of_week": 2,7  "preferred_time_start": "10:00",8  "preferred_time_end": "18:00",9  "delivery_instructions": "Updated delivery instructions",10  "delivery_options": {11    "signature_required": true,12    "leave_with_neighbor": false,13    "leave_at_door": false14  },15  "contact_preferences": {16    "notification_methods": [17      {18        "type": "sms",19        "enabled": true,20        "contact": "+1234567890"21      },22      {23        "type": "email",24        "enabled": false,25        "contact": "[email protected]"26      }27    ],28    "notification_events": {29      "on_dispatch": true,30      "day_before": true,31      "day_of": true,32      "hour_before": true,33      "on_arrival": true,34      "on_completion": true35    }36  }37}'

Response examples

200OK
Response body
json
1{2  "success": true,3  "message": "Preference updated successfully",4  "preference": {5    "id": "uuid",6    "tenant_id": "uuid",7    "customer_id": "uuid",8    "location_id": "uuid",9    "preferred_day_of_week": 2,10    "preferred_time_start": "10:00",11    "preferred_time_end": "18:00",12    "delivery_instructions": "Updated delivery instructions",13    "delivery_options": {14      "signature_required": true,15      "leave_with_neighbor": false,16      "leave_at_door": false17    },18    "contact_preferences": {19      "notification_methods": [20        {21          "type": "sms",22          "enabled": true,23          "contact": "+1234567890"24        },25        {26          "type": "email",27          "enabled": false,28          "contact": "[email protected]"29        }30      ],31      "notification_events": {32        "on_dispatch": true,33        "day_before": true,34        "day_of": true,35        "hour_before": true,36        "on_arrival": true,37        "on_completion": true38      }39    },40    "created_at": "2023-08-01T12:00:00Z",41    "updated_at": "2023-08-02T14:30:00Z"42  }43}

Get Customer Preference​

Delivery & Last-Mile / Customer Preferences
GET/delivery/customer-preferences/:preferenceId

Get a single customer delivery preference by ID. Customers can only view their own preferences, while admin users can view any preference.

Path parameters

ParameterTypeDescription
preferenceIdRequiredstring

ID of the preference to retrieve

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 GET "https://staging-api.ondi.io/functions/v1/delivery/customer-preferences/${PREFERENCEID}?tenant_id=&language=en" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}"

Response examples

200OK
Response body
json
1{2  "success": true,3  "message": "Preference retrieved successfully",4  "preference": {5    "id": "uuid",6    "preferred_day_of_week": 1,7    "preferred_time_start": "09:00",8    "preferred_time_end": "17:00",9    "delivery_instructions": "Leave packages at the front door",10    "delivery_options": {11      "signature_required": false,12      "leave_with_neighbor": true,13      "leave_at_door": true14    },15    "contact_preferences": {16      "notification_methods": [17        {18          "type": "sms",19          "enabled": true,20          "contact": "+1234567890"21        }22      ]23    },24    "created_at": "2023-08-01T12:00:00Z",25    "updated_at": "2023-08-01T12:00:00Z",26    "customer": {27      "id": "uuid",28      "full_name": "John Doe"29    },30    "location": {31      "id": "uuid",32      "full_address": "123 Main St, City, State 12345"33    }34  }35}