Wocart
Wocart API

Shipments

Server

Hand an order to a carrier or to a driver

POST
https://api.wocart.store
/api/orders/{id}/shipment
X-API-Key (header)

kind: "carrier" hands the order to a delivery company (needs delivery:dispatch); kind: "driver" gives it to the store's driver (needs orders:assign).

Carrier. Only a ready order with no shipment can be handed off. The shipment is reserved before the carrier is called, so a second dispatch of the same order is refused (409 ORDER_HAS_SHIPMENT) and never reaches the carrier.

What the carrier's answer proves decides the outcome:

  • accepted — the carrier created the parcel. When the company auto-validates and the carrier needs a separate validation, it is validated too; a refused validation is reported in validationError and kept in the shipment's history.
  • refused — the carrier refused it, the credentials failed, it was throttled, or it could not be reached: nothing was created and the order is ready again.
  • unknown — the carrier may have created it (a timeout, a server error). It is never sent again automatically: resolve it with POST /shipments/{id}/resolve.

Driver. The store's own driver has no carrier to call: the shipment is accepted at once, and the driver's fee for the order's wilaya (0 where none is set) is frozen on it. The driver is not a carrier and has no stop desks: the shipment is always home delivery to the order's street address — an order whose customer chose a stop desk keeps that choice and its price, and the driver brings it to the door (deliveryType: "stop_desk" is refused). Only a ready order with no shipment and a street address (400 MISSING_ADDRESS), and a driver who is not inactive. The driver's progress is then reported with POST /shipments/{id}/events.

Hand an order to a carrier or to a driver › path Parameters

id
​string · required

Resource ID

Resource ID

Hand an order to a carrier or to a driver › Request Body

oneOf
Exactly one variant must match.

Decision Table

VariantMatching Criteria
type = object · requires: kind, companyId
type = object · requires: kind, driverId
Properties for Variant 1:
kind
​string · enum · required
Enum values:
carrier
companyId
​string · minLength: 1 · required

The delivery company to hand the order to

deliveryType
​string · enum

Ship as home or stop-desk delivery instead of what the customer asked for — for a carrier with no desk in the wilaya, or the reverse. The cash to collect does not change.

Enum values:
home
stop_desk
stationCode
​string · minLength: 1

The stop desk, when shipping to one

weight
​number

Parcel weight in kg; otherwise the sum of its variants' weights

fragile
​boolean
remarks
​string · maxLength: 500

For the courier; otherwise the order's notes

Hand an order to a carrier or to a driver › Responses

The carrier has the parcel, or the driver has the order

success
​boolean · required
​HandoffResult · required

Hand many orders to a carrier

POST
https://api.wocart.store
/api/shipments/bulk
X-API-Key (header)

The same handoff as POST /orders/{id}/shipment, for up to 100 orders and one company, with one result per order. The carrier's bulk creation is used when it has one.

Only a ready order with no shipment can be handed off. The shipment is reserved before the carrier is called, so a second dispatch of the same order is refused (409 ORDER_HAS_SHIPMENT) and never reaches the carrier.

What the carrier's answer proves decides the outcome:

  • accepted — the carrier created the parcel. When the company auto-validates and the carrier needs a separate validation, it is validated too; a refused validation is reported in validationError and kept in the shipment's history.
  • refused — the carrier refused it, the credentials failed, it was throttled, or it could not be reached: nothing was created and the order is ready again.
  • unknown — the carrier may have created it (a timeout, a server error). It is never sent again automatically: resolve it with POST /shipments/{id}/resolve.

Hand many orders to a carrier › Request Body

companyId
​string · minLength: 1 · required
orderIds
​string[] · minItems: 1 · maxItems: 100 · required
deliveryType
​string · enum

Ship as home or stop-desk delivery instead of what the customer asked for — for a carrier with no desk in the wilaya, or the reverse. The cash to collect does not change.

Enum values:
home
stop_desk

Hand many orders to a carrier › Responses

One result per order

success
​boolean · required
​BulkHandoffData · required

Give many orders to a driver

POST
https://api.wocart.store
/api/shipments/driver-bulk
X-API-Key (header)

The same handoff as POST /orders/{id}/shipment with kind: "driver", for up to 100 orders and one driver, with one result per order: accepted or refused (never unknown).

The store's own driver has no carrier to call: the shipment is accepted at once, and the driver's fee for the order's wilaya (0 where none is set) is frozen on it. The driver is not a carrier and has no stop desks: the shipment is always home delivery to the order's street address — an order whose customer chose a stop desk keeps that choice and its price, and the driver brings it to the door (deliveryType: "stop_desk" is refused). Only a ready order with no shipment and a street address (400 MISSING_ADDRESS), and a driver who is not inactive. The driver's progress is then reported with POST /shipments/{id}/events.

Give many orders to a driver › Request Body

driverId
​string · minLength: 1 · required
orderIds
​string[] · minItems: 1 · maxItems: 100 · required
deliveryType
​string · enum

Always home: the store's own driver brings the parcel to the customer's street address, even when the customer chose a stop desk (the order keeps that choice and its price). A stop desk is refused.

Enum values:
home

Give many orders to a driver › Responses

One result per order

success
​boolean · required
​BulkHandoffData · required

Get a shipment

GET
https://api.wocart.store
/api/shipments/{id}
X-API-Key (header)

The shipment with its full history (carrier statuses as reported, and what Wocart concluded from them) and the actions available now.

Get a shipment › path Parameters

id
​string · required

Resource ID

Resource ID

Get a shipment › Responses

The shipment

success
​boolean · required
​Shipment · required

Edit a parcel at the carrier

PATCH
https://api.wocart.store
/api/shipments/{id}
X-API-Key (header)

Changes the customer's details, the destination, the cash to collect, the weight or fragility — at the carrier first, then in Wocart: the order's contact and destination (with its customer, like an order edit) and the shipment's cash, weight and fragility. Only before the parcel leaves (and, at a carrier that validates separately, before validation). A new destination needs both wilayaId and communeId.

Edit a parcel at the carrier › path Parameters

id
​string · required

Resource ID

Resource ID

Edit a parcel at the carrier › Request Body

customerName
​string · minLength: 1
phone
​string · minLength: 9
address
​string
wilayaId
​integer · min: 1 · max: 58
communeId
​string · minLength: 1
amount
​number · min: 0

The cash to collect

weight
​number
fragile
​boolean
remarks
​string · maxLength: 500

Edit a parcel at the carrier › Responses

The shipment after the operation

success
​boolean · required
​ShipmentOperationResult · required

Resolve a handoff whose outcome is unknown

POST
https://api.wocart.store
/api/shipments/{id}/resolve
X-API-Key (header)
  • lookup — ask the carrier for a parcel with this order's number (carriers that support it). not_found leaves the shipment unresolved.
  • attach — the parcel was found at the carrier: record its tracking number.
  • release — the carrier has no parcel: the shipment is removed and the order is ready to hand off again.

Resolve a handoff whose outcome is unknown › path Parameters

id
​string · required

Resource ID

Resource ID

Resolve a handoff whose outcome is unknown › Request Body

oneOf
Exactly one variant must match.

Decision Table

VariantMatching Criteria
type = object · requires: action
type = object · requires: action, trackingNumber
type = object · requires: action
Properties for Variant 1:
action
​string · enum · required
Enum values:
lookup

Resolve a handoff whose outcome is unknown › Responses

How it was resolved

success
​boolean · required
​HandoffResolution · required

Validate a parcel at the carrier

POST
https://api.wocart.store
/api/shipments/{id}/validate
X-API-Key (header)

For carriers that hold a created parcel until it is validated (EcoTrack, NOEST). After validation it can no longer be edited or cancelled.

Validate a parcel at the carrier › path Parameters

id
​string · required

Resource ID

Resource ID

Validate a parcel at the carrier › Request Body

requestPickup
​boolean

Ask the carrier to collect the parcel (EcoTrack)

Validate a parcel at the carrier › Responses

The shipment after the operation

success
​boolean · required
​ShipmentOperationResult · required

Void a shipment

POST
https://api.wocart.store
/api/shipments/{id}/void
X-API-Key (header)

Undo a shipment that never reached the customer, so the order can be handed off again: a carrier parcel is cancelled at the carrier first (unless the carrier already cancelled it); a driver's order is taken back from the driver. Refused once it is out for delivery. A carrier shipment needs delivery:dispatch, a driver's orders:assign.

Void a shipment › path Parameters

id
​string · required

Resource ID

Resource ID

Void a shipment › Responses

Voided; the order is ready to hand off again

success
​boolean · required
​object · required

Read the parcel's remarks at the carrier

GET
https://api.wocart.store
/api/shipments/{id}/remarks
X-API-Key (header)

Read the parcel's remarks at the carrier › path Parameters

id
​string · required

Resource ID

Resource ID

Read the parcel's remarks at the carrier › Responses

Remarks from the merchant and the courier

success
​boolean · required
​CarrierRemark[] · required

Add a remark for the courier

POST
https://api.wocart.store
/api/shipments/{id}/remarks
X-API-Key (header)

Add a remark for the courier › path Parameters

id
​string · required

Resource ID

Resource ID

Add a remark for the courier › Request Body

content
​string · minLength: 1 · maxLength: 500 · required

Add a remark for the courier › Responses

The shipment after the operation

success
​boolean · required
​ShipmentOperationResult · required

The parcel's label

GET
https://api.wocart.store
/api/shipments/{id}/label
X-API-Key (header)

Fetched from the carrier for the merchant: carrier labels sit behind the company's credentials or an expiring link.

The parcel's label › path Parameters

id
​string · required

Resource ID

Resource ID

The parcel's label › Responses

The label

string · binary

Ask the carrier to return the parcel

POST
https://api.wocart.store
/api/shipments/{id}/ask-return
X-API-Key (header)

A request the courier may decline; it is noted in the history and changes nothing until the carrier reports the return.

Ask the carrier to return the parcel › path Parameters

id
​string · required

Resource ID

Resource ID

Ask the carrier to return the parcel › Responses

The shipment after the operation

success
​boolean · required
​ShipmentOperationResult · required

Ask the carrier to try delivering again

POST
https://api.wocart.store
/api/shipments/{id}/request-new-attempt
X-API-Key (header)

After a failed attempt (NOEST). Noted in the history.

Ask the carrier to try delivering again › path Parameters

id
​string · required

Resource ID

Resource ID

Ask the carrier to try delivering again › Responses

The shipment after the operation

success
​boolean · required
​ShipmentOperationResult · required

Confirm at the carrier that the return reached you

POST
https://api.wocart.store
/api/shipments/{id}/confirm-return
X-API-Key (header)

EcoTrack's return confirmation, then the return is recorded: the goods go back in stock and the customer's spend is rolled back.

Confirm at the carrier that the return reached you › path Parameters

id
​string · required

Resource ID

Resource ID

Confirm at the carrier that the return reached you › Responses

The shipment after the operation

success
​boolean · required
​ShipmentOperationResult · required

Read the carrier's history now

POST
https://api.wocart.store
/api/shipments/{id}/sync
X-API-Key (header)

Records every status the carrier reports that the shipment does not have yet; a status already recorded (by webhook or an earlier sync) is not recorded twice.

Read the carrier's history now › path Parameters

id
​string · required

Resource ID

Resource ID

Read the carrier's history now › Responses

The shipment after the operation

success
​boolean · required
​ShipmentOperationResult · required

Report what happened

POST
https://api.wocart.store
/api/shipments/{id}/events
X-API-Key (header)

What the merchant saw. On a driver's shipment: the driver's progress (out_for_delivery, failed_attempt, delivered, returned) — needs orders:assign. On a carrier shipment only returned: the goods are back with the merchant (the carrier alone can say a parcel was delivered) — needs delivery:dispatch.

Report what happened › path Parameters

id
​string · required

Resource ID

Resource ID

Report what happened › Request Body

status
​string · enum · required

A driver's progress; on a carrier shipment only returned (the goods are back with the merchant)

Enum values:
out_for_delivery
failed_attempt
delivered
returned
reason
​string · maxLength: 500

Why — a refusal, no answer…

occurredAt
​string · date-time

When it happened, if not now

Report what happened › Responses

The shipment after the operation

success
​boolean · required
​ShipmentOperationResult · required