addInventoryStocktake
The method allows you to create a new stocktake (inventory count) in draft status. For non-manual scopes, the product list is automatically populated based on the selected scope and warehouse.
Input parameters
| warehouse_id | int | Warehouse identifier. The list of identifiers can be retrieved using the method getInventoryWarehouses. |
| scope | int | Stocktake scope defining which products are included: 0 - all products, 1 - manual product selection, 3 - specific warehouse zones, 4 - specific location prefixes, 5 - random product selection |
| name | varchar(80) | (optional) Stocktake name/description |
| priority | int | (optional) Priority: 0 - low (default), 1 - medium, 2 - high, 3 - urgent |
| assigned_to | int | (optional) Assigned employee identifier |
| date_scheduled | int | (optional) Execution scheduled date (unix timestamp) |
| date_due | int | (optional) Execution due date (unix timestamp). Must be later than or equal to date_scheduled. |
| approval_method | text | (optional) Approval method: "immediate" (default) - stocktake is completed immediately after counting, "confirm" - requires secondary approval step after counting |
| blind_count | bool | (optional) If true, hides the expected quantity from the counter. Default: false |
| confirm_location | bool | (optional) If true, forces the user to scan/confirm the location before counting. Default: false |
| allow_add_remove_items | bool | (optional) If true, allows adding or removing products during the counting phase. Default: false. Always true for manual scope. |
| product_ids | array | (optional) List of simple product or variant identifiers to include. Required when scope is 1 (manual). |
| scope_zones | array | (optional) List of warehouse zone identifiers. Required when scope is 3 (zones). |
| scope_locations_prefix | varchar(255) | (optional) Semicolon-separated location name prefixes to filter by. Required when scope is 4 (locations). Example: "A-1;B-2" |
| scope_random_count | int | (optional) Number of random products to select. Required when scope is 5 (random). Must be a positive integer. |
Output data
The method returns the data in JSON format.
| status | varchar(30) | SUCCESS - request executed correctly ERROR - an error occurred during an API request. Error details will be described in 2 additional returned fields: error_message and error_code |
| stocktake_id | int | Created stocktake identifier |
| stocktake_number | varchar(50) | Generated stocktake document number |
| items_preparation_status | text | Stocktake items preparation status: ready or pending |
Sample
Input data:Output data:
A sample request in PHP: