Stock allocations and movement records
Remove an allocation row
/a/StockContainer_delete
Remove one saved allocation directly without returning its quantity to warehouse.
When to use this endpoint
This is a legacy allocation-row removal, not a stock return or catalogue deletion. Inspect the allocation first; the route does not reconcile balances.
Authentication and permissions
Authenticate with a signed API key or a logged-in CRM session on the account’s routed host. Signed requests act as the key owner. Session requests must include the dispatcher CSRF value when configured. All record identifiers belong to the authenticated tenant.
The dispatcher and these handlers do not impose an additional CRM2 Stock role or Stock TeamAccess record scope. CRM2 screen permissions are separate controls and must not be assumed to apply to CRM1. These routes do not become public because an individual legacy handler checks only the tenant context.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer-compatible | Yes | The saved allocation row ID, not its stock ID or owner ID. |
Example request
$result = FM_api('StockContainer_delete', ['id'=>'2081']);
Example response
{"ok":1}
Examples show one representative result; database numeric scalars can be JSON strings. Application errors can use HTTP 200: inspect error and warning in the decoded response.
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"} | Missing/nonpositive row ID. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Uses allocation id only. The row is physically removed; no warehouse increment, batch update, movement/history row, delete log or owner timestamp is created.
- No existence or write-result check is made. A missing row also returns ok:1. No transaction or availability check is added.
Side effects
- Deletes the allocation row. This handler does not request cache invalidation.
See it in Fieldmotion
CRM1
No direct CRM1 caller was found in the source search. CRM1 uses its legacy Stock grid and stockContainerEdit allocation editor instead.
CRM2
No direct CRM2 caller for this route was found. Its allocation screens use StockContainers_getDataTable and StockContainer_getRequestedDetails; inspect those requests instead.
Related endpoints
StockContainer_getRequestedDetails— identify the row and balance first.StockReturned_createData— record a real return to warehouse instead.