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.
purchase-orders:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Body:
product_id(integer, existing product) — required unlessleave_unallocatedis 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 methodmanual, confidence null, and the AI's pick kept inoriginal_target.leave_unallocated(boolean, optional) — true, orproduct_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
- 200
- 401
- 403
- 404
- 409
- 422
- 429
OK
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Not found — no record with the given identifier (or the route does not exist). Verify the ID before retrying.
Conflict
Response Headers
Unprocessable Content
Response Headers
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.