POST
Declare damaged stock
Company space For: Stock keeper, Manager · Permission: inventory_damages.create Conditions
  • At least one item is required, and each item needs at least one stock source.
  • purchase_id and purchase_reception_id cannot both be sent; when sent, the purchase or reception must belong to the current company.
  • A purchase reception can only be targeted when its status is confirmed.
  • damage_reason is required and must be ordinary or exceptional.
  • reference, when sent, must be unique among the damage records of the company, whatever their status.
  • Each item must be tracked in inventory, and an item cannot appear twice in the same record.
  • A stockable_unit_id must be an active unit of that item whose measurement category matches the item.
  • Each stock source must name exactly one of asset_id or group_id, and the same source cannot be listed twice for an item.
  • A source asset must be a location the company is eligible to use, and the source must hold stock of the item; when the record is tied to a purchase or reception, only stock coming from that purchase or reception counts.
  • The quantity declared on a source cannot exceed the stock available there, after subtracting the quantities already reserved by other draft damage records.
What else happens
  • Creates the record in draft status together with its items; the cost of each item is 0 until the record is confirmed.
  • Stock levels do not change until the record is confirmed.
Part of Correct stock and declare damage.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
purchase_id
string

Optional purchase the damage relates to, as a 27-character identifier of a purchase of the current company. Accepted on creation only and cannot be sent together with purchase_reception_id. When set, only stock coming from this purchase can be declared.

purchase_reception_id
string

Optional confirmed purchase reception the damage relates to, as a 27-character identifier of a reception of the current company. Accepted on creation only and cannot be sent together with purchase_id. When set, only stock received through it can be declared.

reference
string | null

Optional free reference of the record, up to 255 characters, unique among the company's damage records. Can be changed while the record is a draft.

Maximum string length: 255
damage_reason
enum<string>

Why the stock was damaged: ordinary (expected loss) or exceptional. Required on creation, optional on update.

Available options:
ordinary,
exceptional
items
object[]

Damaged items of the record, at least one. Accepted on creation only; on update use the items endpoints.

Response

InventoryDamageResource

id
string
required

Identifier of the damage record (27-character KSUID).

purchase_id
string | null
required

Purchase the damage is tied to; null when the record has no purchase origin.

purchase_reception_id
string | null
required

Purchase reception the damage is tied to; null when the record has no reception origin.

reference
string | null
required

Free reference of the record; null when none was given.

status
string
required

State of the record: draft (editable, no stock moved) or confirmed (stock removed, no more changes).

damage_reason
string
required

Reason of the damage: ordinary or exceptional.

confirmed_at
string<date-time> | null
required

Date and time of confirmation (ISO 8601); null while the record is a draft.

created_at
string<date-time>
required

Date and time the record was created (ISO 8601, UTC).

updated_at
string<date-time>
required

Date and time the record was last changed (ISO 8601, UTC).

items
InventoryDamageItemResource · object[]

Damaged items of the record.