Skip to main content

External International Delivery

1 API call in this section.

Create International Delivery

External & Carrier Integrations / Deliveries / External International Delivery
POST/external/international-deliveries?tenant_id={{tenant_id}}

Create an international delivery using a warehouse pickup and a delivery address object. Authentication: - Requires valid authentication token (Authorization header) Key Behavior: - Pickup address is automatically taken from the specified warehouse's address (no pickup address in payload). - Creates inventory items from provided products (bulk insert). - Creates a receiving order with item_details built from created items and product quantities. - Creates a delivery record with status set to 'draft'. Required Fields (Body): - warehouse_id (string): UUID of the warehouse for pickup - delivery_address (object): Must include lat, lng, full_address; contact_info optional - delivery_service_id (string) - payer_type (string): one of ['sender','receiver'] - payment_method (string): one of ['wallet','cod'] - external_reference_id (string): External system reference; must be unique per tenant - products (array<object>): Each item requires name, sku, barcode, unit_size, quantity Conditionally Required: - customer_id (string): Required unless caller is a customer/no-role, in which case it is set from the authenticated user Optional Fields (Body): - cod_amount (number) - notes (string) - scheduled_pickup_time (ISO datetime) - scheduled_delivery_time (ISO datetime) - priority (number 1-4) - unit_size (number) - bulk_group (string) - tracking_provider (string) - package_details (object with weight, dimensions[length,width,height], fragile, description) Receiving Order Fields (Body - root-level): - expected_arrival_date (date, optional) - receiving_details (object, optional) - actual_arrival_date (date, optional) - received_by (uuid, optional) - notes (string, optional) - supplier_id (uuid, optional) Notes: - reference_number for the receiving order is auto-generated (RIO-<timestamp>). - receiving_orders.status is set to 'pending'. - delivery.status is set to 'draft'.

Send a bearer token in Authorization and a tenant API key when the integration requires X-APIKey or X-API-Key.
Request
curl
1curl --request POST "$ONDI_BASE_URL/external/international-deliveries?tenant_id={{tenant_id}}" \2  --header "Authorization: Bearer {{access_token}}" \3  --header "X-API-Key: {{api_key}}" \4  --header "Content-Type: application/json" \5  --header "Content-Type: application/json" \6  --data '{7  "warehouse_id": "{{warehouse_id}}",8  "delivery_address": {9    "lat": {{delivery_lat}},10    "lng": {{delivery_lng}},11    "full_address": "{{delivery_full_address}}",12    "city": "{{delivery_city}}",13    "state": "{{delivery_state}}",14    "country": "{{delivery_country}}",15    "postal_code": "{{delivery_postal_code}}",16    "contact_info": {17      "name": "{{receiver_name}}",18      "phone": "{{receiver_phone}}",19      "email": "{{receiver_email}}",20      "tel_phone": "{{receiver_tel}}"21    }22  },23  "customer_id": "{{customer_id}}",24  "delivery_service_id": "{{delivery_service_id}}",25  "payer_type": "sender",26  "payment_method": "wallet",27  "external_reference_id": "{{external_reference_id}}",28  "cod_amount": 0,29  "notes": "International shipment",30  "scheduled_pickup_time": "2024-01-15T10:00:00Z",31  "scheduled_delivery_time": "2024-01-20T18:00:00Z",32  "priority": 1,33  "unit_size": 1,34  "bulk_group": "GROUP-INTL-001",35  "tracking_provider": "internal",36  "package_details": {37    "special_instructions": "International shipment - handle with care",38    "items": [39      {40        "name": "{{item_name}}",41        "description": "{{item_description}}",42        "quantity": 1,43        "weight": 2.5,44        "length": 30,45        "width": 20,46        "height": 1547      }48    ]49  },50  "products": [51    {52      "name": "Widget A",53      "sku": "WIDGET-A",54      "barcode": "1234567890123",55      "unit_size": 1,56      "quantity": 2,57      "description": "Blue widget",58      "brand": "Acme",59      "model": "A1",60      "category": "Widgets",61      "subcategory": "Standard"62    },63    {64      "name": "Gadget B",65      "sku": "GADGET-B",66      "barcode": "9876543210987",67      "unit_size": 1,68      "quantity": 169    }70  ],71  "expected_arrival_date": "2024-01-19",72  "receiving_details": {73    "carrier": "DHL",74    "incoterms": "DAP"75  },76  "actual_arrival_date": null,77  "received_by": null,78  "supplier_id": null79}'
Request body
json
1{2  "warehouse_id": "{{warehouse_id}}",3  "delivery_address": {4    "lat": {{delivery_lat}},5    "lng": {{delivery_lng}},6    "full_address": "{{delivery_full_address}}",7    "city": "{{delivery_city}}",8    "state": "{{delivery_state}}",9    "country": "{{delivery_country}}",10    "postal_code": "{{delivery_postal_code}}",11    "contact_info": {12      "name": "{{receiver_name}}",13      "phone": "{{receiver_phone}}",14      "email": "{{receiver_email}}",15      "tel_phone": "{{receiver_tel}}"16    }17  },18  "customer_id": "{{customer_id}}",19  "delivery_service_id": "{{delivery_service_id}}",20  "payer_type": "sender",21  "payment_method": "wallet",22  "external_reference_id": "{{external_reference_id}}",23  "cod_amount": 0,24  "notes": "International shipment",25  "scheduled_pickup_time": "2024-01-15T10:00:00Z",26  "scheduled_delivery_time": "2024-01-20T18:00:00Z",27  "priority": 1,28  "unit_size": 1,29  "bulk_group": "GROUP-INTL-001",30  "tracking_provider": "internal",31  "package_details": {32    "special_instructions": "International shipment - handle with care",33    "items": [34      {35        "name": "{{item_name}}",36        "description": "{{item_description}}",37        "quantity": 1,38        "weight": 2.5,39        "length": 30,40        "width": 20,41        "height": 1542      }43    ]44  },45  "products": [46    {47      "name": "Widget A",48      "sku": "WIDGET-A",49      "barcode": "1234567890123",50      "unit_size": 1,51      "quantity": 2,52      "description": "Blue widget",53      "brand": "Acme",54      "model": "A1",55      "category": "Widgets",56      "subcategory": "Standard"57    },58    {59      "name": "Gadget B",60      "sku": "GADGET-B",61      "barcode": "9876543210987",62      "unit_size": 1,63      "quantity": 164    }65  ],66  "expected_arrival_date": "2024-01-19",67  "receiving_details": {68    "carrier": "DHL",69    "incoterms": "DAP"70  },71  "actual_arrival_date": null,72  "received_by": null,73  "supplier_id": null74}

Query parameters

tenant_idOptional
query string

{{tenant_id}}

ID of the tenant (Required)

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

X-API-KeyOptional
header string

{{api_key}}

Content-TypeOptional
header string

application/json

Responses

Success - Created201Created
Response body
json
1{2  "success": true,3  "message": "delivery_created_successfully",4  "delivery": {5    "id": "DEL-000001"6  },7  "pickup_address_id": "warehouse-address-uuid",8  "delivery_address": {9    "id": "address-uuid",10    "full_address": "456 Broadway..."11  },12  "inventory_item": {13    "id": "item-uuid-1",14    "sku": "WIDGET-A",15    "name": "Widget A"16  },17  "receiving_order": {18    "id": "ro-uuid",19    "reference_number": "RIO-1700000000000",20    "status": "pending"21  }22}
Error - Missing tenant_id400Bad Request
Response body
json
1{2  "success": false,3  "message": "tenant_id is required"4}
Error - Validation (products array)400Bad Request
Response body
json
1{2  "success": false,3  "message": "products_array_cannot_be_empty"4}
Error - Warehouse Not Found404Not Found
Response body
json
1{2  "success": false,3  "message": "warehouse_not_found"4}
Error - Delivery Address Creation Failed400Bad Request
Response body
json
1{2  "success": false,3  "message": "delivery_address_creation_failed"4}
Error - External Reference Already Exists400Bad Request
Response body
json
1{2  "success": false,3  "message": "external_reference_id_already_exists"4}
Error - Server Error (inventory creation)500Internal Server Error
Response body
json
1{2  "success": false,3  "message": "internal_server_error"4}