Submitting Purchase Orders

Submitting purchase orders is a multi-step process that mirrors the flow of the Apicbase user interface. To transition an order from draft to delivered, follow each step sequentially.

Currently, the Apicbase API only allows you to receive existing (sent) purchase orders, not to create or send new ones.

Retrieve the Purchase Order and the Ordered Packages

Endpoint reference: Get Purchase Orders

Use the Get Purchase Orders endpoint to retrieve the ID number of the purchase order for which you will submit a delivery. Note that this ID is different from the order number. By using the optional query parameter filters, you can specify details such as the order number to retrieve only the relevant purchase order.

Create Delivery Draft

Endpoint reference: Create Delivery Draft

The first step in submitting a purchase order is creating a delivery in draft state. Purchase orders can include multiple delivery moments, and each one can be submitted individually. In this step, you will specify the delivered packages, including their quantities, prices, and optional details such as intake reasons or any discounts applied.

Note that the packages you specify here do not necessarily have to be the same as those in the original purchase order. The delivery can include additional or different packages.

A successful response will include the delivery draft object along with its ID. Save this ID for use in the subsequent steps.

Executing this step is equivalent to saving a delivery in draft state in the user interface. This API call will not update your inventory with the delivered packages yet.

Submit Delivery Draft

Endpoint reference: Submit Delivery Draft

This action commits the delivery and updates your inventory with the delivered package quantities. You can optionally specify the time and date of delivery. After executing this step, it is no longer possible to edit or cancel the delivery draft.

This will also transition the purchase order from ORDERED to DELIVERED state (if it was still in the ORDERED state), but it will not close the order for subsequent deliveries. It will still be possible to add more deliveries to the same order after executing this call.

Close Deliveries

Endpoint reference: Close Deliveries

This action signals that the order is finally complete and that no more deliveries are expected. After executing this step, it will no longer be possible to create additional deliveries for the specified purchase order. You can close a purchase order for deliveries without delivering all of the ordered packages.