Stock items and catalogue maintenance
Find stock allocation rows
/a/Stock_find
Read the stock-container rows associated with one catalogue item.
When to use this endpoint
Pass a stock item ID to inspect allocation records; this is not a search by item name or code.
Authentication and permissions
Authenticate with a signed API key or a logged-in CRM session on the account’s routed host. API keys act as their owner; session calls require dispatcher CSRF protection where configured. IDs address the authenticated tenant.
The handler checks that the tenant database context is defined rather than calling Core_requireLogin. Use normal authenticated dispatcher access; this is not a public or cross-tenant endpoint. No extra Stock page-action/CRM2 role check is added here.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer-compatible | Yes | Positive stock catalogue ID. It is not a stock-container row ID, category ID or supplier ID. |
Example request
$result = FM_api('Stock_find', ['id'=>'18']);
Example response
[
{
"id": "52",
"stock_id": "18",
"container_id": "37",
"container_type": "1",
"amt": "2.5",
"last_edited": "2026-11-17 09:00:00",
"amt_trigger": "",
"inventory_id": "0",
"meta": null
}
]
Application errors can use HTTP 200. Inspect error/warning fields; database numeric values can be strings unless this handler explicitly converts them.
Errors and unusual responses
| Response | Condition |
|---|---|
{"error":"not logged in"} | No authenticated tenant context is available. Invalid signed credentials can be rejected by the dispatcher before the handler runs. |
{"error":"missing or invalid parameter: id"} | ID is absent or integer-converts below 1. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Returns whole stock_container rows in a bare array, with no catalogue join, deleted/archive filter, container-type exclusion, ordering or pagination. Missing stock/allocation rows return [].
- container_id interpretation depends on container_type. Common types: 0 warehouse, 1 user ID, 2 vehicle UUID, 3 location ID, 7 Job ID; these are not stock-container row IDs. Amounts remain database values and can be fractional.
Side effects
- Read only; does not reserve, move or decrement stock.
See it in Fieldmotion
CRM1
Source search found no current direct CRM1 Stock_find caller. The Stock grid loads stock-container summaries through Stocks_getContainers instead.
CRM2
Source search found no current direct CRM2 Stock_find caller. Mapped allocated/container projections and logistics APIs supply the stock allocation display.
Related endpoints
Stock_get— Read the full saved stock row, with selected manufacturing metadata flattened for the legacy editor.Stock_updateStockLevels— Add a signed quantity to a legacy stock/container balance without balancing warehouse stock.Stock_getRequestedDetails— Return projected stock rows with optional supplier and allocation summaries.