Sorting Sessions
11 API calls in this section.
List Sorting Sessions
/warehousing/sorting-sessions?tenant_id={{tenant_id}}&warehouse_id={{warehouse_id}}&status=active&page=1&limit=20&language=enRetrieve sorting sessions for a specific warehouse with optional filtering by status and date range.
1curl --request GET "$ONDI_BASE_URL/warehousing/sorting-sessions?tenant_id={{tenant_id}}&warehouse_id={{warehouse_id}}&status=active&page=1&limit=20&language=en" \2 --header "Authorization: Bearer {{access_token}}" \3 --header "Content-Type: application/json"Query parameters
tenant_idOptional{{tenant_id}}
UUID of the tenant (required)
warehouse_idOptional{{warehouse_id}}
Filter by specific warehouse (required)
statusOptionalactive
Filter by session status (active, completed)
pageOptional1
Page number for pagination
limitOptional20
Number of items per page
languageOptionalen
Response language (optional, default: en)
Headers
AuthorizationOptionalBearer {{access_token}}
Content-TypeOptionalapplication/json
Responses
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}1{2 "success": false,3 "message": "Warehouse not found"4}Create Sorting Session with Assignments
/warehousing/sorting-sessions?tenant_id={{tenant_id}}&language=enCreate 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}
1curl --request POST "$ONDI_BASE_URL/warehousing/sorting-sessions?tenant_id={{tenant_id}}&language=en" \2 --header "Authorization: Bearer {{access_token}}" \3 --header "Content-Type: application/json" \4 --header "Content-Type: application/json" \5 --data '{6 "warehouse_id": "{{warehouse_id}}",7 "assignments": [8 {9 "staff_id": "{{staff_id_1}}",10 "destination_type": "city",11 "destination_value": "Baghdad",12 "capacity": 2513 },14 {15 "staff_id": "{{staff_id_2}}",16 "destination_type": "zone",17 "destination_value": "Anawa"18 },19 {20 "staff_id": "{{staff_id_3}}",21 "destination_type": "partner_area",22 "destination_value": "Prime_Baghdad",23 "capacity": 1524 }25 ]26}'1{2 "warehouse_id": "{{warehouse_id}}",3 "assignments": [4 {5 "staff_id": "{{staff_id_1}}",6 "destination_type": "city",7 "destination_value": "Baghdad",8 "capacity": 259 },10 {11 "staff_id": "{{staff_id_2}}",12 "destination_type": "zone",13 "destination_value": "Anawa"14 },15 {16 "staff_id": "{{staff_id_3}}",17 "destination_type": "partner_area",18 "destination_value": "Prime_Baghdad",19 "capacity": 1520 }21 ]22}Query parameters
tenant_idOptional{{tenant_id}}
UUID of the tenant (required)
languageOptionalen
Response language
Request body fields
warehouse_idExampleExample field from the request body.
assignmentsExampleExample field from the request body.
assignments.staff_idExampleExample field from the request body.
assignments.destination_typeExampleExample field from the request body.
assignments.destination_valueExampleExample field from the request body.
assignments.capacityExampleExample field from the request body.
Headers
AuthorizationOptionalBearer {{access_token}}
Content-TypeOptionalapplication/json
Responses
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}1{2 "success": false,3 "message": "warehouse_id is required"4}Create Sorting Session (Simple)
/warehousing/sorting-sessions?tenant_id={{tenant_id}}&language=enCreate a new sorting session without assignments. You can add assignments later.
1curl --request POST "$ONDI_BASE_URL/warehousing/sorting-sessions?tenant_id={{tenant_id}}&language=en" \2 --header "Authorization: Bearer {{access_token}}" \3 --header "Content-Type: application/json" \4 --header "Content-Type: application/json" \5 --data '{6 "warehouse_id": "{{warehouse_id}}"7}'1{2 "warehouse_id": "{{warehouse_id}}"3}Query parameters
tenant_idOptional{{tenant_id}}
UUID of the tenant (required)
languageOptionalen
Response language
Request body fields
warehouse_idExampleExample field from the request body.
Headers
AuthorizationOptionalBearer {{access_token}}
Content-TypeOptionalapplication/json
Responses
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_id?tenant_id={{tenant_id}}&language=enGet detailed information about a specific sorting session including assignments and temporary locations with their capacity information.
1curl --request GET "$ONDI_BASE_URL/warehousing/sorting-sessions/:session_id?tenant_id={{tenant_id}}&language=en" \2 --header "Authorization: Bearer {{access_token}}" \3 --header "Content-Type: application/json"Path parameters
session_idRequired{{session_id}}
UUID of the sorting session
Query parameters
tenant_idOptional{{tenant_id}}
UUID of the tenant (required)
languageOptionalen
Response language
Headers
AuthorizationOptionalBearer {{access_token}}
Content-TypeOptionalapplication/json
Responses
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}1{2 "success": false,3 "message": "Sorting session not found"4}Complete Sorting Session
/warehousing/sorting-sessions/:session_id?tenant_id={{tenant_id}}&language=enMark a sorting session as completed (automatically sets ended_at timestamp). This would typically trigger cleanup of temporary locations.
1curl --request PUT "$ONDI_BASE_URL/warehousing/sorting-sessions/:session_id?tenant_id={{tenant_id}}&language=en" \2 --header "Authorization: Bearer {{access_token}}" \3 --header "Content-Type: application/json" \4 --header "Content-Type: application/json" \5 --data '{6 "status": "completed"7}'1{2 "status": "completed"3}Path parameters
session_idRequired{{session_id}}
UUID of the sorting session
Query parameters
tenant_idOptional{{tenant_id}}
UUID of the tenant (required)
languageOptionalen
Response language
Request body fields
statusExampleExample field from the request body.
Headers
AuthorizationOptionalBearer {{access_token}}
Content-TypeOptionalapplication/json
Responses
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}1{2 "success": false,3 "message": "Sorting session not found"4}List Session Assignments
/warehousing/sorting-sessions/:session_id/assignments?tenant_id={{tenant_id}}&language=enGet all assignments for a specific sorting session with their temporary cage/trolley locations and capacity information.
1curl --request GET "$ONDI_BASE_URL/warehousing/sorting-sessions/:session_id/assignments?tenant_id={{tenant_id}}&language=en" \2 --header "Authorization: Bearer {{access_token}}" \3 --header "Content-Type: application/json"Path parameters
session_idRequired{{session_id}}
UUID of the sorting session
Query parameters
tenant_idOptional{{tenant_id}}
UUID of the tenant (required)
languageOptionalen
Response language
Headers
AuthorizationOptionalBearer {{access_token}}
Content-TypeOptionalapplication/json
Responses
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/assignments?tenant_id={{tenant_id}}&language=enAdd new assignments to an existing active sorting session. API automatically creates additional temporary locations for each new assignment with specified capacity.
1curl --request POST "$ONDI_BASE_URL/warehousing/sorting-sessions/:session_id/assignments?tenant_id={{tenant_id}}&language=en" \2 --header "Authorization: Bearer {{access_token}}" \3 --header "Content-Type: application/json" \4 --header "Content-Type: application/json" \5 --data '{6 "assignments": [7 {8 "staff_id": "{{staff_id_5}}",9 "destination_type": "partner_area",10 "destination_value": "Aramex_Sulaymaniyah",11 "capacity": 2012 },13 {14 "staff_id": "{{staff_id_6}}",15 "destination_type": "zone",16 "destination_value": "Local_Erbil_North",17 "capacity": 3518 }19 ]20}'1{2 "assignments": [3 {4 "staff_id": "{{staff_id_5}}",5 "destination_type": "partner_area",6 "destination_value": "Aramex_Sulaymaniyah",7 "capacity": 208 },9 {10 "staff_id": "{{staff_id_6}}",11 "destination_type": "zone",12 "destination_value": "Local_Erbil_North",13 "capacity": 3514 }15 ]16}Path parameters
session_idRequired{{session_id}}
UUID of the sorting session
Query parameters
tenant_idOptional{{tenant_id}}
UUID of the tenant (required)
languageOptionalen
Response language
Request body fields
assignmentsExampleExample field from the request body.
assignments.staff_idExampleExample field from the request body.
assignments.destination_typeExampleExample field from the request body.
assignments.destination_valueExampleExample field from the request body.
assignments.capacityExampleExample field from the request body.
Headers
AuthorizationOptionalBearer {{access_token}}
Content-TypeOptionalapplication/json
Responses
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}1{2 "success": false,3 "message": "Session is not active"4}Example: Multi-City Sorting Session
/warehousing/sorting-sessions?tenant_id={{tenant_id}}&language=enExample: 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.
1curl --request POST "$ONDI_BASE_URL/warehousing/sorting-sessions?tenant_id={{tenant_id}}&language=en" \2 --header "Authorization: Bearer {{access_token}}" \3 --header "Content-Type: application/json" \4 --header "Content-Type: application/json" \5 --data '{6 "warehouse_id": "{{warehouse_id}}",7 "assignments": [8 {9 "staff_id": "{{staff_id_1}}",10 "destination_type": "city",11 "destination_value": "Baghdad",12 "capacity": 5013 },14 {15 "staff_id": "{{staff_id_2}}",16 "destination_type": "city",17 "destination_value": "Sulaymaniyah",18 "capacity": 4019 },20 {21 "staff_id": "{{staff_id_3}}",22 "destination_type": "city",23 "destination_value": "Basrah",24 "capacity": 3025 },26 {27 "staff_id": "{{staff_id_4}}",28 "destination_type": "city",29 "destination_value": "Mosul"30 }31 ]32}'1{2 "warehouse_id": "{{warehouse_id}}",3 "assignments": [4 {5 "staff_id": "{{staff_id_1}}",6 "destination_type": "city",7 "destination_value": "Baghdad",8 "capacity": 509 },10 {11 "staff_id": "{{staff_id_2}}",12 "destination_type": "city",13 "destination_value": "Sulaymaniyah",14 "capacity": 4015 },16 {17 "staff_id": "{{staff_id_3}}",18 "destination_type": "city",19 "destination_value": "Basrah",20 "capacity": 3021 },22 {23 "staff_id": "{{staff_id_4}}",24 "destination_type": "city",25 "destination_value": "Mosul"26 }27 ]28}Query parameters
tenant_idOptional{{tenant_id}}
UUID of the tenant (required)
languageOptionalen
Response language
Request body fields
warehouse_idExampleExample field from the request body.
assignmentsExampleExample field from the request body.
assignments.staff_idExampleExample field from the request body.
assignments.destination_typeExampleExample field from the request body.
assignments.destination_valueExampleExample field from the request body.
assignments.capacityExampleExample field from the request body.
Headers
AuthorizationOptionalBearer {{access_token}}
Content-TypeOptionalapplication/json
Responses
No response example is available for this endpoint yet.
Update Sorting Session
/warehousing/sorting-sessions/:session_id?tenant_id={{tenant_id}}&language=enUpdates a sorting session's status. When status is set to 'completed', the ended_at timestamp is automatically set. Request Body: - status (optional): New status for the session (e.g. 'completed')
1curl --request PATCH "$ONDI_BASE_URL/warehousing/sorting-sessions/:session_id?tenant_id={{tenant_id}}&language=en" \2 --header "Authorization: Bearer {{access_token}}" \3 --header "Content-Type: application/json" \4 --header "Content-Type: application/json" \5 --data '{6 "status": "completed"7}'1{2 "status": "completed"3}Path parameters
session_idRequiredsession-uuid-1
UUID of the sorting session
Query parameters
tenant_idOptional{{tenant_id}}
UUID of the tenant (required)
languageOptionalen
Response language
Request body fields
statusExampleExample field from the request body.
Headers
AuthorizationOptionalBearer {{access_token}}
Content-TypeOptionalapplication/json
Responses
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}1{2 "success": false,3 "message": "Sorting session not found"4}Create Sorting Assignments
/warehousing/sorting-sessions/:session_id/assignments?tenant_id={{tenant_id}}&language=enCreates sorting assignments for an existing session. Automatically creates temporary CAGE locations for each assignment. Request Body: - assignments (required): Array of assignment objects - staff_id (required): UUID of the warehouse staff - destination_type (required): 'city', 'zone', or 'partner_area' - destination_value (required): The destination name - capacity (optional): Capacity for the temporary bin (default: 10)
1curl --request POST "$ONDI_BASE_URL/warehousing/sorting-sessions/:session_id/assignments?tenant_id={{tenant_id}}&language=en" \2 --header "Authorization: Bearer {{access_token}}" \3 --header "Content-Type: application/json" \4 --header "Content-Type: application/json" \5 --data '{6 "assignments": [7 {8 "staff_id": "staff-uuid-1",9 "destination_type": "city",10 "destination_value": "Baghdad",11 "capacity": 2012 },13 {14 "staff_id": "staff-uuid-2",15 "destination_type": "zone",16 "destination_value": "Anawa",17 "capacity": 1518 }19 ]20}'1{2 "assignments": [3 {4 "staff_id": "staff-uuid-1",5 "destination_type": "city",6 "destination_value": "Baghdad",7 "capacity": 208 },9 {10 "staff_id": "staff-uuid-2",11 "destination_type": "zone",12 "destination_value": "Anawa",13 "capacity": 1514 }15 ]16}Path parameters
session_idRequiredsession-uuid-1
UUID of the sorting session
Query parameters
tenant_idOptional{{tenant_id}}
UUID of the tenant (required)
languageOptionalen
Response language
Request body fields
assignmentsExampleExample field from the request body.
assignments.staff_idExampleExample field from the request body.
assignments.destination_typeExampleExample field from the request body.
assignments.destination_valueExampleExample field from the request body.
assignments.capacityExampleExample field from the request body.
Headers
AuthorizationOptionalBearer {{access_token}}
Content-TypeOptionalapplication/json
Responses
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}1{2 "success": false,3 "message": "Sorting session not found"4}List Sorting Assignments
/warehousing/sorting-sessions/:session_id/assignments?tenant_id={{tenant_id}}&language=enLists all sorting assignments for a specific session. Path Parameters: - session_id (required): UUID of the sorting session
1curl --request GET "$ONDI_BASE_URL/warehousing/sorting-sessions/:session_id/assignments?tenant_id={{tenant_id}}&language=en" \2 --header "Authorization: Bearer {{access_token}}"Path parameters
session_idRequiredsession-uuid-1
UUID of the sorting session
Query parameters
tenant_idOptional{{tenant_id}}
UUID of the tenant (required)
languageOptionalen
Response language
Headers
AuthorizationOptionalBearer {{access_token}}
Responses
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}1{2 "success": false,3 "message": "Sorting session not found"4}