API - Orders

/orders
This endpoint is used to query your orders in the Lengow API. Select accepted parameters/filters in your query to refine your request.

/orders/actions
This endpoint allows you to perform actions on your orders.

GET orders and conventions

GET /orders/

This is the main entrance of our API! This endpoint will deliver you a list of all your orders. Complete this GET request with parameters/filters to get exactly what you are looking for. 

Conventions

Find below some convention points you should know before making a request to the Lengow API.

  • 1. Pagination

The orders endpoint supports pagination. When omitted, the default value for page is 1.
The API can show a maximum of 100 results per page with page_size parameter. 

Exemple
/orders/?account_id=1 → Page 1 - implicit (by default)
/orders/?account_id=1&page=5&page_size=50 → Page 5 - explicit (5 pages with max 50 results per pages)

  • 2. Ordering

You can control the ordering of results with the ordering parameter. To reverse the ordering, your can prefix your field by -List of supported ordering fields here.  

The default ordering is:marketplace-marketplace_order_date-imported_at
Example:  /orders/?account_id=1&ordering=marketplace,-updated_at

  • 3. Query parameters (Filtering)

You can send query parameters with your requests using the URL field and the Params tab.
account_id is a mandatory parameter. Use it for any request/action you send to the API
These query parameters will help you get a specific order for example, adding the "&marketplace_order_id" or get all orders from a specific marketplace.Example: /orders/?account_id=1&marketplace=menlook 

  • 4.  Changing the currency

By default, all amount fields are returned in your account’s currency.

If you want to change the currency, you can use the set_currency parameter. The value must be specified as three characters (ISO 4217).
Example:  /orders/?account_id=1&set_currency=USD  

Use as many parameters as you like with the symbol "&".
Example:  /orders/?account_id=1&lengow_status=waiting_shipment&marketplace_order_id=1123456789  

 

Typical GET order API response

The information retrieved differs from one marketplace to another.
The marketplace decides which data they make available in their API and in which fields. In the Lengow API, this data is displayed as provided.

Example of API response:

{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"marketplace": "amazon_uk",
"account_id": 1,
"marketplace_country_iso2": "GB",
"marketplace_order_id": "order1",
"merchant_order_id": null,
"marketplace_status": "Shipped",
"lengow_status": "shipped",
"workflow_rank": 6,
"marketplace_order_date": "2019-03-22T17:54:34.369000Z",
"total_order": 809.2900000000001,
"total_tax": "134.45",
"shipping": 2.6,
"discount": 0,
"commission": "-56.47",
"processing_fee": null,
"currency": {
"iso_a3": "EUR",
"symbol": "€",
"name": "Euro"
},
"original_currency": {
"iso_a3": "GBP",
"symbol": "£",
"name": "British Pound"
},
"original_total_order": 701.25,
"original_total_tax": "116.50",
"original_shipping": 2.25,
"original_discount": 0,
"original_commission": "-48.93",
"original_processing_fee": null,
"comments": null,
"invoice_number": null,
"invoice_url": null,
"payments": [
{
"id": 1,
"checkout": null,
"status": null,
"type": "Other: Standard",
"settled_at": null,
"payment_terms": null,
"channel_order_marketplace": 1
}
],
"packages": [
{
"cart": [
{
"id": 1,
"marketplace_order_line_id": "line1",
"marketplace_product_id": "product1",
"merchant_product_id": {
"field": "ID_PRODUCT",
"id": "Product1"
},
"feed_id": 1,
"marketplace_package_id": null,
"marketplace_status": "Shipped",
"lengow_status": "shipped",
"title": "Product TEST",
"category": null,
"url_product": null,
"url_image": null,
"order_line_meta": {
},
"amount": "806.69",
"tax": "134.45",
"discount": null,
"shipping": "2.60",
"original_amount": "699.00",
"original_tax": "116.50",
"original_discount": null,
"original_shipping": "2.25",
"quantity": 1,
"created_at": null,
"updated_at": null
}
],
"delivery": {
"id": 1,
"type": "delivery",
"first_line": "1 Rue de la Paix",
"zipcode": "44",
"city": "Nantes",
"company": null,
"civility": null,
"first_name": null,
"last_name": null,
"second_line": null,
"complement": null,
"phone_home": null,
"phone_office": null,
"phone_mobile": null,
"full_address": null,
"full_name": "Dupont",
"email": "test@lengow.amazon.co.uk",
"metas": null,
"state_region": "",
"common_country_iso_a2": "GB",
"trackings": [
{
"number": null,
"method": "Standard",
"carrier": null,
"url": null,
"is_delivered_by_marketplace": true,
"parcel_weight": null,
"shipped_at": null,
"relay": {
"name": null,
"id": null
},
"marketplace_order_line_ids": [
"line1"
]
}
]
}
}
],
"billing_address": {
"id": 2,
"type": "billing",
"first_line": null,
"zipcode": "44",
"city": "Nantes",
"company": null,
"civility": null,
"first_name": null,
"last_name": null,
"second_line": null,
"complement": null,
"phone_home": null,
"phone_office": null,
"phone_mobile": null,
"full_address": null,
"full_name": "Dupont",
"email": "test@lengow.amazon.co.uk",
"metas": null,
"state_region": "",
"common_country_iso_a2": "GB"
},
"contact_address": null,
"imported_at": "2019-03-22T20:05:35.196060Z",
"updated_at": "2019-03-25T11:48:09.071000Z",
"order_meta": {
"checksum": "fffffffggghghhgu"
},
"anonymized": false
}
]
}

In the response, you will find several elements sent by the marketplace all classified in different object with multiple variables.

All the details of the order sent by the marketplace such as the marketplace_order_id, marketplace_status (status of the order), total_ordermarketplace_order_date will help you take action on your order.

All the order items that are part of the order. There can be only one item (in case the customer orders only 1 item), or more in case the customer orders more than one item within the same customer order. 

Tip: Find the "is_delivered_by_marketplace" info in the object "tracking".

List of supported parameters

GET /orders/?account_id=1&marketplace=amazon_uk,darty

Find below the list of possible parameters you can add to your requests for this endpoint to filter results:

  • account_id: id of your Lengow account. Mandatory filter. Use it for any request or action
  • marketplace: marketplace name, can be multiple but separate them with coma. Example: "amazon_uk", or "amazon_uk,darty"  
  • marketplace_order_id: ID of the order
  • merchant_order_id
  • lengow_status: The Lengow status, can be one or multiple statuses but separate them with coma. Example: "shipped", "shipped, waiting_shipment"
  • marketplace_status
  • lengow_line_status: To get orders with at least one order line at the requested status. Example: "lengow_line_status=refunded"
  • marketplace_order_date_from:  Mandatory. By default, set to current day - 7 days. 
  • marketplace_order_date_to:  By default, set to current day.
  • order_type: Example: "is_business", "is_business, is_express"
  • imported_from
  • imported_to
  • updated_from
  • updated_to
  • set_currency 
Note that if you use a parameter not supported by our API or not yet developed your request might end up in error or the parameter will simply be ignored.
Example: "is_delivered_by_marketplace" is not a valid filter, but exists in the API response as a field. So it will be ignored if used in a request or action.
Each marketplace has its own status. In Lengow, all these statuses are converted in a Lengow status   

Get all actions on orders

GET /orders/actions/ 
You can track the status of each action with “queued” and “processed” fields.
  • queued: true 
Means the action is waiting for processing (or retrying on failure)
  • "queued": false
Means the action has been processed
  • “processed”: true 
Means the action is valid and has been successfully sent
  • "processed": false
Means the action is invalid, check the "error" parameter.
Example: 
{
"id": 123456789,
"marketplace_order_id": "306-1234567-1234567",
"account_id": 1,
"marketplace": "amazon_de",
"action_type": "ship",
"processed": true,
"queued": false,
"tracking_number": "05348000966072J",
"tracking_url": null,
"carrier": "DPD",
"custom_carrier": null,
"line": "39751459711155",
"declared_value": null,
"currency_code": null,
"invoice_number": null,
"shipping_method": "DPD",
"shipping_date": "2020-10-28T14:35:07+01:00",
"shipping_service_id": null,
"shipping_service_offer_id": null,
"created_at": "2020-10-28T13:35:07.301140Z",
"updated_at": "2020-10-28T13:38:19.909097Z",
"weight": null,
"weight_unit": null,
"comment": null,
"delay": null,
"reason": null,
"charges": null,
"errors": "The tracking ID 05348000966072J for DPD does not map the expected format of the carrier. Please verify that you have entered the tracking ID and carrier name correctly.",
"delivery_date": null,
"delivery_experience": null,
"return_tracking_number": null,
"refund_price": null,
"refund_shipping_price": null,
"refund_mode": null,
"refund_reason": null,
"refund_quantity": null,
"refund_shipping": null,
"refund_shipping_taxes": null,
"refund_taxes": null,
"carrier_name": null,
"carrier_pickup": null,
"package_dimension_length": null,
"package_dimension_width": null,
"package_dimension_height": null,
"package_dimension_unit": null,
"from_address_name": null,
"from_address_line": null,
"from_address_city": null,
"from_address_state_province": null,
"from_address_postal_code": null,
"from_address_country_code": null,
"from_address_mail": null,
"from_address_phone": null,
"pickup_id": null,
"refund_id": null,
"return_carrier": null
},
This "GET" action also enables you to check if the order is in error by looking at the "errors" parameter.
Read our use cases for more details.

Create an action on an order

POST /orders/actions/
With this endpoint you can make actions on your orders.

  • This is where you can ship, cancel or refund an order if these actions are accepted by the marketplace.
-

Articles in this section

Our Support hours:
9 a.m. to 6:30 p.m. CET Monday through Friday