Ship and deliver a shipment

Operation ID: commitShipment

Group: Inventory › Shipments

Open in the interactive reference

POST /inventory/shipments/{id}/commit

Retry-safe: A write that accepts Idempotency-Key: repeating a request with the same key replays the stored answer instead of executing twice.

Ships and delivers a shipment in one request. Moves a draft or packed shipment to 'DELIVERED': the stock leaves the warehouse and the cost of sale is recorded in a journal entry. The response gives the new status and, when a journal entry was created, its id in journalEntryId.

Every line must leave from the same warehouse. The check runs before any stock leaves or any journal entry is created, and a shipment with lines in more than one warehouse fails the request with MIXED_LOCATIONS.

A delivered shipment can't be changed or deleted, and no endpoint cancels it.

Parameters

Name In Type Required Description
Api-Version header string · v1 yes The API version this request targets, named by its public identifier. Required on every request; omitting it, or naming a version this company does not have, is answered with 400. This document describes version v1.
Idempotency-Key header string no An opaque caller-chosen string (1-255 characters) that makes this request safe to retry. Repeating the same key with an identical request body replays the original response instead of re-executing - but only once that original request succeeded; a failed attempt re-executes on retry. Repeating the key with a different body is answered with 422. A key still in flight is answered with 409 - as is a key whose original request was interrupted before it finished, for a few minutes afterwards, until that attempt is presumed dead. A completed response stays replayable for 24 hours. The key is scoped to the caller, not to the action: reusing it for a different action is answered with 409 or 422 rather than treated independently. On read actions this header is ignored. On write actions that cannot offer the guarantee it is answered with 400 IDEMPOTENCY_NOT_SUPPORTED rather than silently ignored.
id path string yes The unique identifier of the shipment you want to commit.

Request body

Required, application/json: commitShipmentInput.

Field Type Required Description
cogsChoice any no Whether the cost of sale is amortized. AMORTIZED requests COGS amortization schedules, which are created only for service lines, so on a shipment of goods it changes nothing. Defaults to NON_AMORTIZED. One of: "NON_AMORTIZED", "AMORTIZED".
{
  "cogsChoice": "NON_AMORTIZED"
}

Response

200 Success

Under data (commitShipmentOutput):

Field Type Required Description
id string yes The unique identifier for the shipment. Example: "2f7c9b31-8a05-4d16-b47e-903c5f1a86d2".
documentStatus string yes The status the shipment is now in, read back from the document. Possible values: 'DRAFT', 'PACKED', 'PARTIALLY_SHIPPED', 'SHIPPED', 'COMMITTED', 'DELIVERED', 'COMPLETED', 'CANCELLED', 'INVOICED', 'PARTIALLY_INVOICED', 'RETURNED', 'PARTIALLY_RETURNED'. Example: "DELIVERED".
journalEntryId string no The unique identifier for the journal entry this step posted, when it posted one. See id on GET accounting/journal-entries/:id. Example: "6b2d90f1-4c37-4e85-a019-8d3f5c72b6e4".
warnings array<string> yes Non-fatal advisories from the step. An empty array on a clean run. The step succeeded regardless of what is listed here. Example: [].
{
  "data": {
    "id": "2f7c9b31-8a05-4d16-b47e-903c5f1a86d2",
    "documentStatus": "DELIVERED",
    "journalEntryId": "6b2d90f1-4c37-4e85-a019-8d3f5c72b6e4",
    "warnings": []
  },
  "diagnostics": [
    {
      "code": "<code>",
      "message": "<message>",
      "severity": "error",
      "path": [
        "<path>"
      ],
      "details": "<details>"
    }
  ]
}

Response headers

Errors

Code Status
NOT_FOUND 400
WRONG_STATUS 400
NO_LINES 400
SOURCE_LINE_NOT_PROJECTED 400
MIXED_LOCATIONS 400
POSTING_REJECTED 400
IDEMPOTENCY_KEY_CONFLICT 409
IDEMPOTENCY_PAYLOAD_MISMATCH 422

Statuses