Create Cost Entries from Bill Lines
POST/api/bills/:bill/cost-entries
Create one cost entry per selected bill line, each tracking a chosen amount of that line for profitability analysis. This is the scope: "lines" mode of the endpoint; to track the whole remaining bill as a single entry, see "Create Cost Entry from Bill" (same URL, scope: "entire").
purchase-orders:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Each allocation amount may be the full line total or a partial amount, but cannot exceed what is still untracked on that line (check with the lines-availability endpoints first). When more than one line is sent, each entry's description is the name with the line's description appended. Entries inherit the bill's supplier, currency, exchange rate, and invoice number, are dated with the bill's invoice date, and start in pending_allocation status.
Request fields:
scope(required) -linesfor this mode.name(required, max 255) - Base description for the cost entries.cost_entry_type_id(optional) - ID of a cost entry type (seeGET /api/cost-entry-types); applies to every entry created. Omit or send null to leave them untyped.notes(optional, max 1000) - Free-form notes.line_allocations(required in this mode, min 1) - Array of allocations:line_allocations[].bill_line_id(required, integer) - ID of a line on this bill.line_allocations[].amount(required, numeric, min 0.01) - Amount of that line to track.
Returns 422 when a line does not belong to the bill or an amount exceeds the line's untracked remainder.
Authentication: Requires Bearer token. Scope: purchase-orders (read/write).
Request
Responses
- 200
- 401
- 403
- 404
- 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
Response Headers
Unprocessable Entity
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.