Skip to content

Delivery Orders — Overview

A DeliveryOrder is a sub-order that targets a specific fulfillment location. When an order is dispatched, the platform splits it into one or more delivery orders — one per location. Each delivery order tracks its own lines, fulfillment lifecycle, and shipments independently.


Fulfillment Types

TypeDescription
WAREHOUSEDelegated to a connected third-party fulfillment service. The warehouse receives the request, accepts or rejects it, and manages preparation and shipping.
INTERNALManaged directly via the API. Stock movements, preparation, and shipping are handled by your own team.

Delivery Order Status

StatusDescription
DRAFTCreated but not yet sent to the fulfillment location. Lines can still be modified.
PENDINGSubmitted and awaiting processing. No further edits allowed.
OPENEDFulfillment is actively in progress at the location.
COMPLETEDAll lines have been fulfilled and shipments confirmed.

Delivery Order Line Status

StatusDescription
NEWLine just created, not yet processed.
AWAITING_STOCKWaiting for stock to become available.
PENDINGLine submitted and awaiting warehouse action.
CANCELEDLine has been cancelled.
ACCEPTEDWarehouse has accepted the line.
IN_PROGRESSWarehouse is actively preparing this line.
REJECTEDWarehouse rejected the line (e.g. insufficient stock).
FULFILLEDAll requested units have been prepared.
PARTIALLY_FULFILLEDOnly part of the requested quantity was fulfilled.
DELIVEREDUnits have been shipped and confirmed delivered.
ERROREDA processing error occurred on this line.

Fulfillment Events State Machine

Delivery orders move through fulfillment states via events. The state machine below describes the allowed transitions:


Fulfillment Events

Fulfillment events are appended to the fulfillmentData.events array and provide a detailed audit trail of the delivery order lifecycle. Each event has a level indicating its severity.

EventLevelDescription
FULFILLMENT_REQUESTEDNORMALFulfillment request sent to the warehouse.
FULFILLMENT_ACCEPTEDNORMALWarehouse accepted the delivery order.
FULFILLMENT_REJECTEDERRORWarehouse rejected the delivery order.
INTEGRATEDNORMALSuccessfully integrated into the warehouse system.
INTEGRATION_ERRORERRORIntegration into the warehouse system failed.
INSUFFICIENT_STOCKWARNINGOne or more lines could not be fulfilled due to insufficient stock.
FULFILLMENT_IN_PROGRESSNORMALThe warehouse is actively preparing the order.
PACKEDNORMALAll items have been packed and are ready for shipment.
SHIPPEDNORMALThe order has been handed off to a carrier.
CANCELEDWARNINGThe delivery order was cancelled.
HOLDEDWARNINGThe delivery order was put on hold.
RESUMEDNORMALThe delivery order was resumed from hold.
COMPLETEDNORMALThe delivery order has been fully completed.

Event Levels

LevelDescription
NORMALInformational — expected lifecycle progression.
WARNINGRequires attention — fulfillment may be delayed or incomplete.
ERRORCritical failure — manual intervention likely required.

GraphQL Types

DeliveryOrderType

graphql
type DeliveryOrderType {
  id: ID!
  orderNumber: String!
  invoiceNumber: String
  status: DeliveryOrderStatusEnum!
  type: FulfillmentTypeEnum!       # WAREHOUSE | INTERNAL
  priority: PriorityEnum!
  total: Float
  currency: String
  location: LocationType
  deliveryAddress: AddressType
  lines: [DeliveryOrderLineType!]!
  orders: [OrderType!]!
  fulfillmentData: DeliveryOrderFulfillmentData
  shipments: [ShipmentType!]
  createdAt: DateTime!
  updatedAt: DateTime!
}

DeliveryOrderFulfillmentData

graphql
type DeliveryOrderFulfillmentData {
  events: [FulfillmentEventType!]!
}

FulfillmentEventType

graphql
type FulfillmentEventType {
  type: FulfillmentEventTypeEnum!
  level: FulfillmentEventLevelEnum!  # NORMAL | WARNING | ERROR
  message: String
  date: DateTime!
}

Operations

Queries

OperationScopeDescription
deliveryOrderview_delivery_ordersRetrieve a delivery order by ID
deliveryOrdersview_delivery_ordersRetrieve all delivery orders for a given order

Mutations

OperationScopeDescription
deliveryOrderCreatecreate_delivery_ordersManually create a delivery order
deliveryOrderOpenedit_delivery_ordersOpen a draft delivery order
deliveryOrderCanceledit_delivery_ordersCancel a delivery order
deliveryOrderHoldedit_delivery_ordersPause fulfillment
deliveryOrderResumeedit_delivery_ordersResume a held delivery order
deliveryOrderRequestFulfillmentedit_delivery_ordersSend to warehouse for fulfillment

Best Practices

  1. Monitor fulfillment events. Poll fulfillmentData.events regularly or subscribe to webhooks to detect ERROR-level events early.
  2. Handle INTEGRATION_ERROR proactively. When integration fails, the delivery order will not progress until the issue is resolved and fulfillment is re-requested.
  3. Use deliveryOrderHold before modifying related data. If you need to update shipping address or priority, hold the order first to prevent race conditions with warehouse processing.
  4. Check line statuses individually. A delivery order may reach COMPLETED with some lines PARTIALLY_FULFILLED — always inspect line-level statuses for accurate fulfillment reporting.
  5. Use INTERNAL type for direct control. If you manage your own warehouse, use INTERNAL locations and drive the lifecycle via API mutations rather than waiting for warehouse callbacks.

HappyColis API Documentation