Orders

Read orders from your connected stores, quote them and mark them fulfilled.

When you connect a store to Envia, its orders flow in automatically. This page covers what you can do with them through the API: read them, decide how to ship them, and report back to the store once they ship.

The lifecycle

Store           Envia                                      Carrier
  │
  │ new order ──► order appears in /v4/orders
  │                     │
  │                     ├─ 1. read       GET  /v4/orders
  │                     ├─ 2. quote      PUT  .../rate          decide service + price
  │                     ├─ 3. label      POST /ship/generate    (Shipping API)
  │                     └─ 4. fulfil     POST .../order-shipments
  │                              │
  │ ◄── fulfilment + tracking ───┘

Steps 1, 2 and 4 are here. Step 3 is the Shipping API.

Which version to use

v4 is the canonical one. Earlier versions are still reachable but are not maintained.

EndpointStatus
GET /v4/orders✅ Use this
GET /v3/orders, GET /orders-v2, GET /orders⚠️ Legacy — no new fields, may change without notice

Build against v4. If you are already on an older version, the fields you rely on exist in v4 too.

1. Read your orders

curl -G https://queries.test.envia.com/v4/orders \
  -H "Authorization: Bearer $ENVIA_TOKEN" \
  -d limit=50 \
  -d status_payment=paid \
  -d fulfillment_status_id=1

The response has two parts:

{
  "orders_info": [ /* the orders */ ],
  "countries":   [ /* destination countries present in the result */ ]
}

countries exists so you can build a destination filter that only offers values that will actually return something.

Filtering. List orders accepts 30+ filters — by date range, payment status, fulfillment status, shop, carrier, destination country, SKU, tags and more. Array filters take either a repeated parameter or a single value:

?shop_id=12&shop_id=44     ✅
?shop_id=12                ✅

For a quick lookup by text — an order number a customer just read out over the phone — use Search orders instead. It is lighter and built for autocomplete.

2. Decide how to ship it

API reference → List quotable services · Set the quoted service for an order

Read the services you can quote with:

curl https://queries.test.envia.com/orders/quote-services \
  -H "Authorization: Bearer $ENVIA_TOKEN"

Then record the choice on the order's package:

curl -X PUT https://queries.test.envia.com/orders/1204/58831/rate \
  -H "Authorization: Bearer $ENVIA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "package_id": 9912, "service_id": 45, "price": 189.50 }'

This does not create a label. It stores the decision so the order is ready to fulfill. To actually buy the label, call Generate a shipping label on the Shipping API.

To clear a previous choice, send "service_id": null and "price": null.

3. Mark it fulfilled

API reference → Fulfill an order

Once the parcel is on its way, tell the store:

curl -X POST https://queries.test.envia.com/orders/1204/58831/fulfillment/order-shipments \
  -H "Authorization: Bearer $ENVIA_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "package_id": 9912, "shipment_id": 778123 }'
{
  "success": true,
  "id": 44120,
  "packages_fulfillment": [ /* state of each package */ ],
  "isFulfillmentOrder": true,
  "completed": true
}

completed tells you whether every package in the order is now fulfilled — useful for orders that ship in several parcels.

⚠️

This writes to the connected store. The buyer may receive a shipping notification from the store as a direct result. Confirm before wiring it into an automated flow.

Which field do I send?

You shipped…Send
With a label created through Enviashipment_id
Outside Envia, and only want the store updatedtracking_number

Fixing a mistake. Use Update a fulfillment to correct a tracking number, or Delete a fulfillment to detach it. Deleting the fulfillment does not cancel the shipment — cancel it with Cancel a shipment if that is what you mean.

Fulfilled outside Envia entirely? If someone marked the order shipped directly in the store, call Sync fulfillment status so Envia catches up.

Common mistakes

SymptomCause
404 on an order you can see in the storeshop_id and order_id must both belong to your company. The order id is Envia's, not the store's — take it from orders_info
Fulfillment succeeds but the store shows nothingThe store was updated but its own webhook may lag. Check the store before retrying; a second call creates a second fulfillment
Filters return nothingArray filters are exact matches. destination_country_code takes ISO alpha-2 (MX, not Mexico)
422 on ratepackage_id must belong to that order. Read it from the order first

Endpoints

Next steps


Did this page help you?