Skip to main content

Inventory Audits

5 API calls in this section.

List Inventory Audits

Warehousing / Inventory Audits
GET/warehousing/inventory-audits?tenant_id={{tenant_id}}&warehouse_id=&audit_type=&status=&scheduled_date=&page=1&limit=20
Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request GET "$ONDI_BASE_URL/warehousing/inventory-audits?tenant_id={{tenant_id}}&warehouse_id=&audit_type=&status=&scheduled_date=&page=1&limit=20" \2  --header "Authorization: Bearer {{access_token}}" \3  --header "Content-Type: application/json"

Query parameters

tenant_idOptional
query string

{{tenant_id}}

UUID of the tenant (required)

warehouse_idOptional
query string

Filter by warehouse (optional)

audit_typeOptional
query string

Filter by audit type (cycle_count, full_count, spot_check) (optional)

statusOptional
query string

Filter by audit status (scheduled, in_progress, completed, cancelled) (optional)

scheduled_dateOptional
query string

Filter by scheduled date (YYYY-MM-DD) (optional)

pageOptional
query string

1

Page number for pagination (optional)

limitOptional
query string

20

Number of items per page (optional)

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

Content-TypeOptional
header string

application/json

Responses

Success Response200
Response body
json
1{2  "success": true,3  "message": "Inventory audits retrieved successfully",4  "audits": [5    {6      "id": "audit-uuid-1",7      "created_by_user": {8        "id": "user-uuid-1",9        "full_name": "John Doe"10      },11      "audit_type": "cycle_count",12      "status": "scheduled",13      "created_at": "2023-07-01T10:00:00Z",14      "discrepancy_count": 0,15      "notes": "Monthly cycle count for electronics section",16      "scheduled_date": "2023-07-15",17      "completed_by_user": null,18      "completion_date": null,19      "warehouse": {20        "id": "warehouse-uuid",21        "name": "Main Warehouse",22        "code": "WH001"23      }24    },25    {26      "id": "audit-uuid-2",27      "created_by_user": {28        "id": "user-uuid-1",29        "full_name": "John Doe"30      },31      "audit_type": "spot_check",32      "status": "completed",33      "created_at": "2023-06-19T14:30:00Z",34      "discrepancy_count": 1,35      "notes": "Spot check due to reported discrepancy",36      "scheduled_date": "2023-06-20",37      "completed_by_user": {38        "id": "user-uuid-2",39        "full_name": "Jane Smith"40      },41      "completion_date": "2023-06-20",42      "warehouse": {43        "id": "warehouse-uuid",44        "name": "Main Warehouse",45        "code": "WH001"46      }47    }48  ],49  "page": 1,50  "limit": 20,51  "total": 2,52  "stats": {53    "total": 2,54    "scheduled": 1,55    "in_progress": 0,56    "completed": 1,57    "cancelled": 058  },59  "statusCounts": {60    "total": 2,61    "scheduled": 1,62    "in_progress": 0,63    "completed": 1,64    "cancelled": 065  }66}
Error - Tenant Not Found404
Response body
json
1{2  "success": false,3  "message": "Tenant not found"4}
Error - Insufficient Permissions403
Response body
json
1{2  "success": false,3  "message": "Insufficient permissions"4}
Error - Server Error500
Response body
json
1{2  "success": false,3  "message": "Internal server error"4}

Get Single Inventory Audit

Warehousing / Inventory Audits
GET/warehousing/inventory-audits/{{audit_id}}?tenant_id={{tenant_id}}
Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request GET "$ONDI_BASE_URL/warehousing/inventory-audits/{{audit_id}}?tenant_id={{tenant_id}}" \2  --header "Authorization: Bearer {{access_token}}" \3  --header "Content-Type: application/json"

Path parameters

audit_idRequired
path string

Variable used inside the request path.

Query parameters

tenant_idOptional
query string

{{tenant_id}}

UUID of the tenant (required)

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

Content-TypeOptional
header string

application/json

Responses

Success Response200
Response body
json
1{2  "success": true,3  "message": "Inventory audit retrieved successfully",4  "audit": {5    "id": "audit-uuid-1",6    "tenant_id": "tenant-uuid",7    "warehouse_id": "warehouse-uuid",8    "audit_type": "cycle_count",9    "status": "in_progress",10    "scheduled_date": "2023-07-15",11    "completed_date": null,12    "created_by": "user-uuid-1",13    "completed_by": null,14    "audit_items": [15      {16        "item_id": "item-uuid-1",17        "bin_id": "bin-uuid-1",18        "expected_quantity": 100,19        "actual_quantity": 98,20        "discrepancy": -2,21        "notes": "Found 2 items missing"22      },23      {24        "item_id": "item-uuid-2",25        "bin_id": "bin-uuid-2",26        "expected_quantity": 50,27        "actual_quantity": null,28        "discrepancy": null,29        "notes": null30      }31    ],32    "discrepancies": [33      {34        "item_id": "item-uuid-1",35        "bin_id": "bin-uuid-1",36        "expected_quantity": 100,37        "actual_quantity": 98,38        "discrepancy": -2,39        "notes": "Found 2 items missing"40      }41    ],42    "discrepancy_count": 1,43    "notes": "Monthly cycle count for electronics section",44    "created_at": "2023-07-01T10:00:00Z",45    "updated_at": "2023-07-15T09:30:00Z",46    "created_by_user": {47      "id": "user-uuid-1",48      "full_name": "John Doe",49      "email": "john.doe@example.com"50    },51    "completed_by_user": null,52    "warehouse": {53      "id": "warehouse-uuid",54      "name": "Main Warehouse",55      "code": "WH001",56      "address": "123 Warehouse St, Industrial District"57    }58  }59}
Error - Audit Not Found404
Response body
json
1{2  "success": false,3  "message": "Audit not found"4}
Error - Audit ID Required400
Response body
json
1{2  "success": false,3  "message": "Audit ID required"4}
Error - Insufficient Permissions403
Response body
json
1{2  "success": false,3  "message": "Insufficient permissions"4}

Record Item Count in Audit

Warehousing / Inventory Audits
PUT/warehousing/inventory-audits/{{audit_id}}/record-count?tenant_id={{tenant_id}}
Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request PUT "$ONDI_BASE_URL/warehousing/inventory-audits/{{audit_id}}/record-count?tenant_id={{tenant_id}}" \2  --header "Authorization: Bearer {{access_token}}" \3  --header "Content-Type: application/json" \4  --header "Content-Type: application/json" \5  --data '{6  "item_counts": [7    {8      "item_id": "{{item_id}}",9      "bin_id": "{{bin_id}}",10      "actual_quantity": 98,11      "notes": "Found 2 items missing from expected count"12    },13    {14      "item_id": "item-uuid-2",15      "bin_id": "bin-uuid-2",16      "actual_quantity": 52,17      "notes": "Found 2 extra items"18    }19  ]20}'
Request body
json
1{2  "item_counts": [3    {4      "item_id": "{{item_id}}",5      "bin_id": "{{bin_id}}",6      "actual_quantity": 98,7      "notes": "Found 2 items missing from expected count"8    },9    {10      "item_id": "item-uuid-2",11      "bin_id": "bin-uuid-2",12      "actual_quantity": 52,13      "notes": "Found 2 extra items"14    }15  ]16}

Path parameters

audit_idRequired
path string

Variable used inside the request path.

Query parameters

tenant_idOptional
query string

{{tenant_id}}

UUID of the tenant (required)

Request body fields

item_countsExample
array<object>

Example field from the request body.

item_counts.item_idExample
string

Example field from the request body.

item_counts.bin_idExample
string

Example field from the request body.

item_counts.actual_quantityExample
number

Example field from the request body.

item_counts.notesExample
string

Example field from the request body.

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

Content-TypeOptional
header string

application/json

Responses

Success Response200
Response body
json
1{2  "success": true,3  "message": "Item counts recorded successfully",4  "audit": {5    "id": "audit-uuid-1",6    "tenant_id": "tenant-uuid",7    "warehouse_id": "warehouse-uuid",8    "audit_type": "cycle_count",9    "status": "in_progress",10    "scheduled_date": "2023-07-15",11    "completed_date": null,12    "created_by": "user-uuid-1",13    "completed_by": null,14    "audit_items": [15      {16        "item_id": "item-uuid-1",17        "bin_id": "bin-uuid-1",18        "expected_quantity": 100,19        "actual_quantity": 98,20        "discrepancy": -2,21        "notes": "Found 2 items missing from expected count"22      },23      {24        "item_id": "item-uuid-2",25        "bin_id": "bin-uuid-2",26        "expected_quantity": 50,27        "actual_quantity": 52,28        "discrepancy": 2,29        "notes": "Found 2 extra items"30      }31    ],32    "discrepancies": [33      {34        "item_id": "item-uuid-1",35        "bin_id": "bin-uuid-1",36        "expected_quantity": 100,37        "actual_quantity": 98,38        "discrepancy": -2,39        "notes": "Found 2 items missing from expected count"40      },41      {42        "item_id": "item-uuid-2",43        "bin_id": "bin-uuid-2",44        "expected_quantity": 50,45        "actual_quantity": 52,46        "discrepancy": 2,47        "notes": "Found 2 extra items"48      }49    ],50    "discrepancy_count": 2,51    "notes": "Monthly cycle count for electronics section",52    "created_at": "2023-07-01T10:00:00Z",53    "updated_at": "2023-07-15T09:30:00Z"54  }55}
Error - Item Counts Required400
Response body
json
1{2  "success": false,3  "message": "Field required: item_counts"4}
Error - Invalid Item Count Structure400
Response body
json
1{2  "success": false,3  "message": "Invalid item count structure"4}
Error - Item Not Found In Audit404
Response body
json
1{2  "success": false,3  "message": "Item not found in audit (item_id: item-uuid, bin_id: bin-uuid)"4}
Error - Cannot Record Counts For Completed Audit400
Response body
json
1{2  "success": false,3  "message": "Cannot record counts for completed audit"4}
Error - Audit Not Found404
Response body
json
1{2  "success": false,3  "message": "Audit not found"4}
Error - Insufficient Permissions403
Response body
json
1{2  "success": false,3  "message": "Insufficient permissions"4}

Complete Inventory Audit

Warehousing / Inventory Audits
PUT/warehousing/inventory-audits/{{audit_id}}/complete?tenant_id={{tenant_id}}
Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request PUT "$ONDI_BASE_URL/warehousing/inventory-audits/{{audit_id}}/complete?tenant_id={{tenant_id}}" \2  --header "Authorization: Bearer {{access_token}}" \3  --header "Content-Type: application/json" \4  --header "Content-Type: application/json" \5  --data '{6  "apply_stock_adjustments": true,7  "completion_notes": "Audit completed successfully. Applied stock adjustments for all discrepancies found."8}'
Request body
json
1{2  "apply_stock_adjustments": true,3  "completion_notes": "Audit completed successfully. Applied stock adjustments for all discrepancies found."4}

Path parameters

audit_idRequired
path string

Variable used inside the request path.

Query parameters

tenant_idOptional
query string

{{tenant_id}}

UUID of the tenant (required)

Request body fields

apply_stock_adjustmentsExample
boolean

Example field from the request body.

completion_notesExample
string

Example field from the request body.

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

Content-TypeOptional
header string

application/json

Responses

Success Response200
Response body
json
1{2  "success": true,3  "message": "Inventory audit completed successfully",4  "audit": {5    "id": "audit-uuid-1",6    "tenant_id": "tenant-uuid",7    "warehouse_id": "warehouse-uuid",8    "audit_type": "cycle_count",9    "status": "completed",10    "scheduled_date": "2023-07-15",11    "completed_date": "2023-07-15T14:30:00Z",12    "created_by": "user-uuid-1",13    "completed_by": "user-uuid-2",14    "audit_items": [15      {16        "item_id": "item-uuid-1",17        "bin_id": "bin-uuid-1",18        "expected_quantity": 100,19        "actual_quantity": 98,20        "discrepancy": -2,21        "notes": "Found 2 items missing from expected count"22      },23      {24        "item_id": "item-uuid-2",25        "bin_id": "bin-uuid-2",26        "expected_quantity": 50,27        "actual_quantity": 52,28        "discrepancy": 2,29        "notes": "Found 2 extra items"30      }31    ],32    "discrepancies": [33      {34        "item_id": "item-uuid-1",35        "bin_id": "bin-uuid-1",36        "expected_quantity": 100,37        "actual_quantity": 98,38        "discrepancy": -2,39        "notes": "Found 2 items missing from expected count"40      },41      {42        "item_id": "item-uuid-2",43        "bin_id": "bin-uuid-2",44        "expected_quantity": 50,45        "actual_quantity": 52,46        "discrepancy": 2,47        "notes": "Found 2 extra items"48      }49    ],50    "discrepancy_count": 2,51    "notes": "Monthly cycle count for electronics section\n\nCompletion Notes: Audit completed successfully. Applied stock adjustments for all discrepancies found.",52    "created_at": "2023-07-01T10:00:00Z",53    "updated_at": "2023-07-15T14:30:00Z"54  },55  "stock_adjustments_applied": true56}
Success Response - No Stock Adjustments200
Response body
json
1{2  "success": true,3  "message": "Inventory audit completed successfully",4  "audit": {5    "id": "audit-uuid-1",6    "tenant_id": "tenant-uuid",7    "warehouse_id": "warehouse-uuid",8    "audit_type": "cycle_count",9    "status": "completed",10    "scheduled_date": "2023-07-15",11    "completed_date": "2023-07-15T14:30:00Z",12    "created_by": "user-uuid-1",13    "completed_by": "user-uuid-2",14    "notes": "Monthly cycle count for electronics section\n\nCompletion Notes: Audit completed for reporting purposes only. No stock adjustments applied."15  },16  "stock_adjustments_applied": false17}
Error - Audit Already Completed400
Response body
json
1{2  "success": false,3  "message": "Audit already completed"4}
Error - Cannot Complete Cancelled Audit400
Response body
json
1{2  "success": false,3  "message": "Cannot complete cancelled audit"4}
Error - Audit Not Found404
Response body
json
1{2  "success": false,3  "message": "Audit not found"4}
Error - Insufficient Permissions403
Response body
json
1{2  "success": false,3  "message": "Insufficient permissions"4}

Create Inventory Audit

Warehousing / Inventory Audits
POST/warehousing/inventory-audits?tenant_id={{tenant_id}}
Send a bearer token in the Authorization header for an authenticated OnDi user session.
Request
curl
1curl --request POST "$ONDI_BASE_URL/warehousing/inventory-audits?tenant_id={{tenant_id}}" \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  "audit_type": "spot_check",8  "scheduled_date": "2023-07-15",9  "audit_items": [10    {11      "item_id": "{{item_id}}",12      "bin_id": "{{bin_id}}",13      "expected_quantity": 10014    }15  ],16  "notes": "Spot check for high-value electronics"17}'
Request body
json
1{2  "warehouse_id": "{{warehouse_id}}",3  "audit_type": "spot_check",4  "scheduled_date": "2023-07-15",5  "audit_items": [6    {7      "item_id": "{{item_id}}",8      "bin_id": "{{bin_id}}",9      "expected_quantity": 10010    }11  ],12  "notes": "Spot check for high-value electronics"13}

Query parameters

tenant_idOptional
query string

{{tenant_id}}

UUID of the tenant (required)

Request body fields

warehouse_idExample
string

Example field from the request body.

audit_typeExample
string

Example field from the request body.

scheduled_dateExample
string

Example field from the request body.

audit_itemsExample
array<object>

Example field from the request body.

audit_items.item_idExample
string

Example field from the request body.

audit_items.bin_idExample
string

Example field from the request body.

audit_items.expected_quantityExample
number

Example field from the request body.

notesExample
string

Example field from the request body.

Headers

AuthorizationOptional
header string

Bearer {{access_token}}

Content-TypeOptional
header string

application/json

Responses

Success Response201
Response body
json
1{2  "success": true,3  "message": "Inventory audit created successfully",4  "audit": {5    "id": "audit-uuid",6    "tenant_id": "tenant-uuid",7    "warehouse_id": "warehouse-uuid",8    "audit_type": "spot_check",9    "status": "scheduled",10    "scheduled_date": "2023-07-15",11    "completed_date": null,12    "created_by": "user-uuid",13    "completed_by": null,14    "audit_items": [15      {16        "item_id": "item-uuid",17        "bin_id": "bin-uuid",18        "expected_quantity": 100,19        "actual_quantity": null,20        "discrepancy": null,21        "notes": null22      }23    ],24    "discrepancies": [],25    "discrepancy_count": 0,26    "notes": "Spot check for high-value electronics",27    "created_at": "2023-07-01T10:00:00Z",28    "updated_at": "2023-07-01T10:00:00Z"29  }30}
Error - Field Required400
Response body
json
1{2  "success": false,3  "message": "Field required: warehouse_id"4}
Error - Invalid Audit Type400
Response body
json
1{2  "success": false,3  "message": "Invalid audit type"4}
Error - Invalid Scheduled Date400
Response body
json
1{2  "success": false,3  "message": "Invalid scheduled date"4}
Error - Audit Items Must Be Array400
Response body
json
1{2  "success": false,3  "message": "Audit items must be array"4}
Error - Audit Item Missing Fields400
Response body
json
1{2  "success": false,3  "message": "Audit item must have item_id and bin_id"4}
Error - Spot Check Requires Audit Items400
Response body
json
1{2  "success": false,3  "message": "Spot check requires audit items"4}
Error - Item Not Found404
Response body
json
1{2  "success": false,3  "message": "Item not found (item_id: item-uuid)"4}
Error - Bin Not Found404
Response body
json
1{2  "success": false,3  "message": "Bin not found (bin_id: bin-uuid)"4}
Error - Location Not A Bin400
Response body
json
1{2  "success": false,3  "message": "Location not a bin (bin_id: bin-uuid)"4}
Error - Warehouse Not Found404
Response body
json
1{2  "success": false,3  "message": "Warehouse not found"4}
Error - Error Fetching Stock Items500
Response body
json
1{2  "success": false,3  "message": "Error fetching stock items"4}
Error - Tenant Not Found404
Response body
json
1{2  "success": false,3  "message": "Tenant not found"4}
Error - Insufficient Permissions403
Response body
json
1{2  "success": false,3  "message": "Insufficient permissions"4}