Skip to main content

Update Cost Entry AI Allocation Proposal

PATCH 

/api/cost-entries/:costEntry/ai-allocation/:batch/proposals/:proposal

Points a proposal at a different product, or leaves its source line unallocated. Only proposals with status ready, held, or rejected after an edit can be changed, and only while the batch is completed and not stale.

Required scope: purchase-orders:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

Body:

  • product_id (integer, existing product) — required unless leave_unallocated is sent. The product is re-checked against its stock and sales in the line's billed period; an ineligible product is refused with 422. On success the proposal becomes ready with method manual, confidence null, and the AI's pick kept in original_target.
  • leave_unallocated (boolean, optional) — true, or product_id: null, sets the proposal to rejected with no target so its line is left unallocated.

Returns the updated proposal in data.

Errors: 409 with code: stale when the source lines changed since proposing (propose again); 422 with errors.product_id when the product is not eligible or the proposal can no longer be changed; 422 validation errors; 404 when the batch or proposal does not belong to the cost entry.

Required permission: cost_entries.ai_allocate (Allocate with AI).

Authentication: Requires Bearer token (scope purchase-orders:write).

Request​

Responses​

OK

Response Headers
    Content-Type