Sorting Sessions
11 API calls in this section.
List Sorting Sessions
/warehousing/sorting-sessionsRetrieve sorting sessions for a specific warehouse with optional filtering by status and date range.
Query parameters
| Parameter | Type | Description |
|---|---|---|
tenant_idRequired | string | UUID of the tenant (required) Example: |
warehouse_idRequired | string | Filter by specific warehouse (required) Example: |
status | string | Filter by session status (active, completed) Example: |
date_fromOptional | string | Filter sessions from date (YYYY-MM-DD) Example: |
date_toOptional | string | Filter sessions to date (YYYY-MM-DD) Example: |
page | string | Page number for pagination Example: |
limit | string | Number of items per page Example: |
languageOptional | string | Response language (optional, default: en) Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
Content-Type | string | Example: |
1curl --globoff --request GET "https://staging-api.ondi.io/functions/v1/warehousing/sorting-sessions?tenant_id=${TENANT_ID}&warehouse_id=${WAREHOUSE_ID}&status=active&page=1&limit=20&language=en" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3 --header "Content-Type: application/json"Response examples
1{2 "success": true,3 "message": "Sorting sessions retrieved successfully",4 "sessions": [5 {6 "id": "session-uuid-1",7 "status": "active",8 "started_at": "2024-06-15T08:00:00Z",9 "ended_at": null,10 "warehouse": {11 "id": "warehouse-uuid-1",12 "name": "Main Distribution Center",13 "code": "WH001"14 },15 "assignments": [16 {17 "id": "assignment-uuid-1",18 "destination_type": "city",19 "destination_value": "Baghdad",20 "cage_location": {21 "id": "loc-uuid-1",22 "code": "CAGE-BAGHDAD-001",23 "name": "Baghdad Cage"24 },25 "staff": {26 "id": "user-uuid-1",27 "full_name": "John Doe",28 "employee_id": "EMP001"29 }30 },31 {32 "id": "assignment-uuid-2",33 "destination_type": "zone",34 "destination_value": "Anawa",35 "cage_location": {36 "id": "loc-uuid-2",37 "code": "TROLLEY-ANAWA-001",38 "name": "Anawa Trolley"39 },40 "staff": {41 "id": "user-uuid-2",42 "full_name": "Jane Smith",43 "employee_id": "EMP002"44 }45 }46 ]47 }48 ],49 "page": 1,50 "limit": 20,51 "total": 152}Create Sorting Session with Assignments
/warehousing/sorting-sessionsCreate a new sorting session with assignments. API automatically creates:
CAGE locations for cities and partner areas
TROLLEY locations for zones
Capacity is optional (defaults to 10). Each assignment can have different capacity.
Temporary locations are created with {total_capacity: X, filled_capacity: 0}
Query parameters
| Parameter | Type | Description |
|---|---|---|
tenant_idRequired | string | UUID of the tenant (required) Example: |
language | string | Response language Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
Content-Type | string | Example: |
Body parameters
| Parameter | Type | Description |
|---|---|---|
warehouse_id | string | — |
assignments | array<object> | — |
assignments.staff_id | string | — |
assignments.destination_type | string | — |
assignments.destination_value | string | — |
assignments.capacity | number | — |
1curl --globoff --request POST "https://staging-api.ondi.io/functions/v1/warehousing/sorting-sessions?tenant_id=${TENANT_ID}&language=en" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3 --header "Content-Type: application/json" \4 --data-raw '{5 "warehouse_id": "{{warehouse_id}}",6 "assignments": [7 {8 "staff_id": "{{staff_id_1}}",9 "destination_type": "city",10 "destination_value": "Baghdad",11 "capacity": 2512 },13 {14 "staff_id": "{{staff_id_2}}",15 "destination_type": "zone",16 "destination_value": "Anawa"17 },18 {19 "staff_id": "{{staff_id_3}}",20 "destination_type": "partner_area",21 "destination_value": "Prime_Baghdad",22 "capacity": 1523 }24 ]25}'Replace {{placeholders}} with your own values before sending.
Response examples
1{2 "success": true,3 "message": "Sorting session created successfully",4 "session": {5 "id": "session-uuid-1",6 "tenant_id": "tenant-uuid",7 "warehouse_id": "warehouse-uuid-1",8 "status": "active",9 "started_at": "2024-06-15T08:00:00Z",10 "ended_at": null,11 "created_at": "2024-06-15T08:00:00Z",12 "warehouse": {13 "id": "warehouse-uuid-1",14 "name": "Main Distribution Center",15 "code": "WH001"16 },17 "assignments": [18 {19 "id": "assignment-uuid-1",20 "session_id": "session-uuid-1",21 "staff_id": "staff-uuid-1",22 "destination_type": "city",23 "destination_value": "Baghdad",24 "cage_location_id": "loc-uuid-1",25 "created_at": "2024-06-15T08:00:00Z"26 },27 {28 "id": "assignment-uuid-2",29 "session_id": "session-uuid-1",30 "staff_id": "staff-uuid-2",31 "destination_type": "zone",32 "destination_value": "Anawa",33 "cage_location_id": "loc-uuid-2",34 "created_at": "2024-06-15T08:00:00Z"35 }36 ],37 "temporary_locations": [38 {39 "id": "loc-uuid-1",40 "code": "CAGE-BAGHDAD-001",41 "name": "Baghdad Cage",42 "location_type": "CAGE",43 "total_capacity": 25,44 "filled_capacity": 045 },46 {47 "id": "loc-uuid-2",48 "code": "TROLLEY-ANAWA-001",49 "name": "Anawa Trolley",50 "location_type": "TROLLEY",51 "total_capacity": 10,52 "filled_capacity": 053 }54 ]55 }56}Create Sorting Session (Simple)
/warehousing/sorting-sessionsCreate a new sorting session without assignments. You can add assignments later.
Query parameters
| Parameter | Type | Description |
|---|---|---|
tenant_idRequired | string | UUID of the tenant (required) Example: |
language | string | Response language Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
Content-Type | string | Example: |
Body parameters
| Parameter | Type | Description |
|---|---|---|
warehouse_id | string | — |
1curl --globoff --request POST "https://staging-api.ondi.io/functions/v1/warehousing/sorting-sessions?tenant_id=${TENANT_ID}&language=en" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3 --header "Content-Type: application/json" \4 --data-raw '{5 "warehouse_id": "{{warehouse_id}}"6}'Replace {{placeholders}} with your own values before sending.
Response examples
1{2 "success": true,3 "message": "Sorting session created successfully",4 "session": {5 "id": "session-uuid-1",6 "tenant_id": "tenant-uuid",7 "warehouse_id": "warehouse-uuid-1",8 "status": "active",9 "started_at": "2024-06-15T08:00:00Z",10 "ended_at": null,11 "created_at": "2024-06-15T08:00:00Z",12 "warehouse": {13 "id": "warehouse-uuid-1",14 "name": "Main Distribution Center",15 "code": "WH001"16 },17 "assignments": [],18 "temporary_locations": []19 }20}Get Sorting Session
/warehousing/sorting-sessions/:session_idGet detailed information about a specific sorting session including assignments and temporary locations with their capacity information.
Path parameters
| Parameter | Type | Description |
|---|---|---|
session_idRequired | string | UUID of the sorting session Example: |
Query parameters
| Parameter | Type | Description |
|---|---|---|
tenant_idRequired | string | UUID of the tenant (required) Example: |
language | string | Response language Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
Content-Type | string | Example: |
1curl --globoff --request GET "https://staging-api.ondi.io/functions/v1/warehousing/sorting-sessions/${SESSION_ID}?tenant_id=${TENANT_ID}&language=en" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3 --header "Content-Type: application/json"Response examples
1{2 "success": true,3 "message": "Sorting session retrieved successfully",4 "session": {5 "id": "session-uuid-1",6 "status": "active",7 "started_at": "2024-06-15T08:00:00Z",8 "ended_at": null,9 "warehouse": {10 "id": "warehouse-uuid-1",11 "name": "Main Distribution Center",12 "code": "WH001"13 },14 "assignments": [15 {16 "id": "assignment-uuid-1",17 "destination_type": "city",18 "destination_value": "Baghdad",19 "created_at": "2024-06-15T08:00:00Z",20 "cage_location": {21 "id": "loc-uuid-1",22 "code": "CAGE-BAGHDAD-001",23 "name": "Baghdad Cage",24 "location_type": "CAGE"25 },26 "staff": {27 "id": "user-uuid-1",28 "full_name": "John Doe",29 "employee_id": "EMP001"30 }31 },32 {33 "id": "assignment-uuid-2",34 "destination_type": "zone",35 "destination_value": "Anawa",36 "created_at": "2024-06-15T08:00:00Z",37 "cage_location": {38 "id": "loc-uuid-2",39 "code": "TROLLEY-ANAWA-001",40 "name": "Anawa Trolley",41 "location_type": "TROLLEY"42 },43 "staff": {44 "id": "user-uuid-2",45 "full_name": "Jane Smith",46 "employee_id": "EMP002"47 }48 }49 ]50 }51}Complete Sorting Session
/warehousing/sorting-sessions/:session_idMark a sorting session as completed (automatically sets ended_at timestamp). This would typically trigger cleanup of temporary locations.
Path parameters
| Parameter | Type | Description |
|---|---|---|
session_idRequired | string | UUID of the sorting session Example: |
Query parameters
| Parameter | Type | Description |
|---|---|---|
tenant_idRequired | string | UUID of the tenant (required) Example: |
language | string | Response language Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
Content-Type | string | Example: |
Body parameters
| Parameter | Type | Description |
|---|---|---|
status | string | — |
1curl --globoff --request PUT "https://staging-api.ondi.io/functions/v1/warehousing/sorting-sessions/${SESSION_ID}?tenant_id=${TENANT_ID}&language=en" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3 --header "Content-Type: application/json" \4 --data-raw '{5 "status": "completed"6}'Response examples
1{2 "success": true,3 "message": "Sorting session updated successfully",4 "session": {5 "id": "session-uuid-1",6 "tenant_id": "tenant-uuid",7 "warehouse_id": "warehouse-uuid-1",8 "status": "completed",9 "started_at": "2024-06-15T08:00:00Z",10 "ended_at": "2024-06-15T17:00:00Z",11 "created_at": "2024-06-15T08:00:00Z",12 "updated_at": "2024-06-15T17:00:00Z"13 }14}List Session Assignments
/warehousing/sorting-sessions/:session_id/assignmentsGet all assignments for a specific sorting session with their temporary cage/trolley locations and capacity information.
Path parameters
| Parameter | Type | Description |
|---|---|---|
session_idRequired | string | UUID of the sorting session Example: |
Query parameters
| Parameter | Type | Description |
|---|---|---|
tenant_idRequired | string | UUID of the tenant (required) Example: |
language | string | Response language Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
Content-Type | string | Example: |
1curl --globoff --request GET "https://staging-api.ondi.io/functions/v1/warehousing/sorting-sessions/${SESSION_ID}/assignments?tenant_id=${TENANT_ID}&language=en" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3 --header "Content-Type: application/json"Response examples
1{2 "success": true,3 "message": "Assignments retrieved successfully",4 "assignments": [5 {6 "id": "assignment-uuid-1",7 "session_id": "session-uuid-1",8 "staff_id": "staff-uuid-1",9 "destination_type": "city",10 "destination_value": "Baghdad",11 "cage_location_id": "loc-uuid-1",12 "created_at": "2024-06-15T08:00:00Z"13 },14 {15 "id": "assignment-uuid-2",16 "session_id": "session-uuid-1",17 "staff_id": "staff-uuid-2",18 "destination_type": "zone",19 "destination_value": "Anawa",20 "cage_location_id": "loc-uuid-2",21 "created_at": "2024-06-15T08:00:00Z"22 }23 ]24}Add More Assignments to Session
/warehousing/sorting-sessions/:session_id/assignmentsAdd new assignments to an existing active sorting session. API automatically creates additional temporary locations for each new assignment with specified capacity.
Path parameters
| Parameter | Type | Description |
|---|---|---|
session_idRequired | string | UUID of the sorting session Example: |
Query parameters
| Parameter | Type | Description |
|---|---|---|
tenant_idRequired | string | UUID of the tenant (required) Example: |
language | string | Response language Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
Content-Type | string | Example: |
Body parameters
| Parameter | Type | Description |
|---|---|---|
assignments | array<object> | — |
assignments.staff_id | string | — |
assignments.destination_type | string | — |
assignments.destination_value | string | — |
assignments.capacity | number | — |
1curl --globoff --request POST "https://staging-api.ondi.io/functions/v1/warehousing/sorting-sessions/${SESSION_ID}/assignments?tenant_id=${TENANT_ID}&language=en" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3 --header "Content-Type: application/json" \4 --data-raw '{5 "assignments": [6 {7 "staff_id": "{{staff_id_5}}",8 "destination_type": "partner_area",9 "destination_value": "Aramex_Sulaymaniyah",10 "capacity": 2011 },12 {13 "staff_id": "{{staff_id_6}}",14 "destination_type": "zone",15 "destination_value": "Local_Erbil_North",16 "capacity": 3517 }18 ]19}'Replace {{placeholders}} with your own values before sending.
Response examples
1{2 "success": true,3 "message": "Assignments created successfully",4 "assignments": [5 {6 "id": "assignment-uuid-5",7 "session_id": "session-uuid-1",8 "staff_id": "staff-uuid-5",9 "destination_type": "partner_area",10 "destination_value": "Aramex_Sulaymaniyah",11 "cage_location_id": "loc-uuid-5",12 "created_at": "2024-06-15T10:00:00Z"13 }14 ],15 "temporary_locations": [16 {17 "id": "loc-uuid-5",18 "code": "CAGE-ARAMEX-SULAYMANIYAH-001",19 "name": "Aramex Sulaymaniyah Cage",20 "location_type": "CAGE",21 "total_capacity": 20,22 "filled_capacity": 023 }24 ]25}Example: Multi-City Sorting Session
/warehousing/sorting-sessionsExample
Create a sorting session for multiple cities with varying capacities. Will create separate CAGE locations for each city automatically. Note: Mosul assignment will use default capacity of 10.
Query parameters
| Parameter | Type | Description |
|---|---|---|
tenant_idRequired | string | UUID of the tenant (required) Example: |
language | string | Response language Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
Content-Type | string | Example: |
Body parameters
| Parameter | Type | Description |
|---|---|---|
warehouse_id | string | — |
assignments | array<object> | — |
assignments.staff_id | string | — |
assignments.destination_type | string | — |
assignments.destination_value | string | — |
assignments.capacity | number | — |
1curl --globoff --request POST "https://staging-api.ondi.io/functions/v1/warehousing/sorting-sessions?tenant_id=${TENANT_ID}&language=en" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3 --header "Content-Type: application/json" \4 --data-raw '{5 "warehouse_id": "{{warehouse_id}}",6 "assignments": [7 {8 "staff_id": "{{staff_id_1}}",9 "destination_type": "city",10 "destination_value": "Baghdad",11 "capacity": 5012 },13 {14 "staff_id": "{{staff_id_2}}",15 "destination_type": "city",16 "destination_value": "Sulaymaniyah",17 "capacity": 4018 },19 {20 "staff_id": "{{staff_id_3}}",21 "destination_type": "city",22 "destination_value": "Basrah",23 "capacity": 3024 },25 {26 "staff_id": "{{staff_id_4}}",27 "destination_type": "city",28 "destination_value": "Mosul"29 }30 ]31}'Replace {{placeholders}} with your own values before sending.
Response examples
No saved response example. Use Try it to inspect a staging response.
Update Sorting Session
/warehousing/sorting-sessions/:session_idUpdates a sorting session's status. When status is set to 'completed', the ended_at timestamp is automatically set.
Path parameters
| Parameter | Type | Description |
|---|---|---|
session_idRequired | string | UUID of the sorting session Example: |
Query parameters
| Parameter | Type | Description |
|---|---|---|
tenant_idRequired | string | UUID of the tenant (required) Example: |
language | string | Response language Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
Content-Type | string | Example: |
Body parameters
| Parameter | Type | Description |
|---|---|---|
statusOptional | string | New status for the session ( |
1curl --globoff --request PATCH "https://staging-api.ondi.io/functions/v1/warehousing/sorting-sessions/${SESSION_ID}?tenant_id=${TENANT_ID}&language=en" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3 --header "Content-Type: application/json" \4 --data-raw '{5 "status": "completed"6}'Response examples
1{2 "success": true,3 "message": "Sorting session updated successfully",4 "session": {5 "id": "session-uuid-1",6 "status": "completed",7 "started_at": "2026-05-22T08:00:00Z",8 "ended_at": "2026-05-22T16:00:00Z",9 "warehouse": {10 "id": "wh-uuid",11 "name": "Main Warehouse",12 "code": "WH001"13 }14 }15}Create Sorting Assignments
/warehousing/sorting-sessions/:session_id/assignmentsCreates sorting assignments for an existing session. Automatically creates temporary CAGE locations for each assignment.
Path parameters
| Parameter | Type | Description |
|---|---|---|
session_idRequired | string | UUID of the sorting session Example: |
Query parameters
| Parameter | Type | Description |
|---|---|---|
tenant_idRequired | string | UUID of the tenant (required) Example: |
language | string | Response language Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
Content-Type | string | Example: |
Body parameters
| Parameter | Type | Description |
|---|---|---|
assignmentsRequired | array<object> | Array of assignment objects |
assignments.staff_idRequired | string | UUID of the warehouse staff |
assignments.destination_typeRequired | string | 'city', 'zone', or ' |
assignments.destination_valueRequired | string | The destination name |
assignments.capacityOptional | number | Capacity for the temporary bin (default: 10) |
1curl --globoff --request POST "https://staging-api.ondi.io/functions/v1/warehousing/sorting-sessions/${SESSION_ID}/assignments?tenant_id=${TENANT_ID}&language=en" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3 --header "Content-Type: application/json" \4 --data-raw '{5 "assignments": [6 {7 "staff_id": "staff-uuid-1",8 "destination_type": "city",9 "destination_value": "Baghdad",10 "capacity": 2011 },12 {13 "staff_id": "staff-uuid-2",14 "destination_type": "zone",15 "destination_value": "Anawa",16 "capacity": 1517 }18 ]19}'Response examples
1{2 "success": true,3 "message": "Assignments created successfully",4 "assignments": [5 {6 "id": "assign-uuid-1",7 "destination_type": "city",8 "destination_value": "Baghdad",9 "created_at": "2026-05-22T08:30:00Z",10 "cage_location": {11 "id": "loc-uuid-1",12 "code": "CAGE-Baghdad-1",13 "name": "Sorting Cage - Baghdad",14 "location_type": "cage",15 "location_purpose": "sorting"16 },17 "staff": {18 "id": "staff-uuid-1",19 "full_name": "Ali Hassan",20 "employee_id": "EMP001"21 }22 },23 {24 "id": "assign-uuid-2",25 "destination_type": "zone",26 "destination_value": "Anawa",27 "created_at": "2026-05-22T08:30:00Z",28 "cage_location": {29 "id": "loc-uuid-2",30 "code": "CAGE-Anawa-1",31 "name": "Sorting Cage - Anawa",32 "location_type": "cage",33 "location_purpose": "sorting"34 },35 "staff": {36 "id": "staff-uuid-2",37 "full_name": "Sara Ahmed",38 "employee_id": "EMP002"39 }40 }41 ],42 "temporary_locations": [43 {44 "id": "loc-uuid-1",45 "code": "CAGE-Baghdad-1",46 "name": "Sorting Cage - Baghdad"47 },48 {49 "id": "loc-uuid-2",50 "code": "CAGE-Anawa-1",51 "name": "Sorting Cage - Anawa"52 }53 ]54}List Sorting Assignments
/warehousing/sorting-sessions/:session_id/assignmentsLists all sorting assignments for a specific session.
Path parameters
| Parameter | Type | Description |
|---|---|---|
session_idRequired | string | UUID of the sorting session Example: |
Query parameters
| Parameter | Type | Description |
|---|---|---|
tenant_idRequired | string | UUID of the tenant (required) Example: |
language | string | Response language Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
1curl --globoff --request GET "https://staging-api.ondi.io/functions/v1/warehousing/sorting-sessions/${SESSION_ID}/assignments?tenant_id=${TENANT_ID}&language=en" \2 --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}"Response examples
1{2 "success": true,3 "message": "Assignments retrieved successfully",4 "assignments": [5 {6 "id": "assign-uuid-1",7 "destination_type": "city",8 "destination_value": "Baghdad",9 "created_at": "2026-05-22T08:30:00Z",10 "cage_location": {11 "id": "loc-uuid-1",12 "code": "CAGE-Baghdad-1",13 "name": "Sorting Cage - Baghdad",14 "location_type": "cage"15 },16 "staff": {17 "id": "staff-uuid-1",18 "full_name": "Ali Hassan",19 "employee_id": "EMP001"20 }21 }22 ]23}