# List Orders

> Source: https://truto.one/docs/api-reference/unified-e-commerce-api/orders/list/

`GET /unified/ecommerce/orders`

Resource: **Orders** · API: **Unified E-Commerce API**

## Supported integrations

Bigcommerce, Commerce7, Shopify, Wix, WooCommerce, Zoho Inventory (partial)

## Query parameters

- **`integrated_account_id`** _(string, required)_
  The ID of the integrated account to use for the request.
- **`truto_response_format`** _(string)_
  The format of the response. - `unified` returns the response with unified mappings applied. - `raw` returns the unprocessed, raw response from the remote API. - `normalized` applies the unified mappings and returns the data in a normalized format. - `stream` returns the response as a stream, which is ideal for transmitting large datasets, files, or binary data. Using streaming mode helps to efficiently handle large payloads or real-time data flows without requiring the entire data to be buffered in memory. Defaults to `unified`.
  Allowed: `unified`, `raw`, `normalized`, `stream`
- **`truto_key_by`** _(string)_
  By default the `result` attribute is an array of objects. This parameter allows you to specify a field in each `result` objects to use as key, which transforms the `result` array into an object with the array items keyed by the field. This is useful for when you want to use the result as a lookup table.
- **`truto_ignore_limit`** _(boolean)_
  Ignores the `limit` query parameter.
- **`truto_ignore_remote_data`** _(boolean)_
  Excludes the `remote_data` attribute from the response.
- **`truto_exclude_fields`** _(array<string>)_
  Array of fields to exclude from the response.
- **`remote_query`** _(object)_
  Query parameters to pass to the underlying API without any transformations. Refer [this guide](https://truto.one/docs/api-reference/overview/querying#remote-query-parameters) to see how to structure the query parameters.
- **`created_at`** _(string)_
  The date and time when order was created
- **`updated_at`** _(string)_
  The date and time when order was updated
- **`customer_id`** _(string)_
  The ID of the customer to filter the orders by.
- **`sort_by`** _(object)_
- **`fulfillment_status`** _(string)_
  The fullfillment status for an order. If no clear mapping exists, then raw value is returned.
  Allowed: `cancelled`, `delivered`, `partial`, `pending`
- **`status`** _(string)_
  Filter orders by their status.
  Allowed: `active`, `any`, `archived`, `cancelled`, `completed`, `pending`

## Response body

- **`result`** _(array<object>)_
  List of Orders
  - **`id`** _(string, required)_
    The unique identifier for an order
  - **`order_number`** _(string)_
    The order number for an order
  - **`currency`** _(string)_
    The currency associated for amount of an order
  - **`exchange_rate`** _(string)_
    The exchange rate for an order's transaction when the currency is different from the store's default currency.
  - **`discounts`** _(array<object>)_
    The discounts for an order
    - **`code`** _(string)_
      The code used to apply the discount
    - **`amount`** _(string)_
      The fixed amount of the discount
    - **`percentage`** _(string)_
      The percentage of discount
  - **`sub_total`** _(string)_
    The sub-total amount for an order
  - **`shipping_cost`** _(string)_
    The shipping cost for an order
  - **`total_discount`** _(string)_
    The total discount for an order
  - **`total_tax`** _(string)_
    The total tax for an order
  - **`total_amount`** _(string)_
    The total amount for an order
  - **`status`** _(string)_
    The status for an order. If no clear mapping exists, then raw value is returned.
    Allowed: `active`, `completed`, `cancelled`, `archived`, `pending`
  - **`payment_status`** _(string)_
    The payment status for an order. If no clear mapping exists, then raw value is returned.
    Allowed: `pending`, `authorized`, `paid`, `partial`, `refunded`, `voided`, `cancelled`, `unknown`
  - **`fulfillment_status`** _(string)_
    The fullfillment status for an order. If no clear mapping exists, then raw value is returned.
    Allowed: `pending`, `partial`, `delivered`, `cancelled`
  - **`payment_method`** _(string)_
    The payment method used for this order
  - **`customer`** _(object)_
    The customer this order is linked to
    - **`id`** _(string)_
      The unique identifier for customer
    - **`first_name`** _(string)_
      The first name of customer
    - **`last_name`** _(string)_
      The last name of customer
    - **`name`** _(string)_
      The full name of customer
    - **`company_name`** _(string)_
      The company name of customer
    - **`emails`** _(array<object>)_
      The emails of customer
      - **`email`** _(string)_
        The email of the customer
      - **`type`** _(string)_
        The type of email
      - **`is_primary`** _(boolean)_
        The status of email
    - **`phones`** _(array<object>)_
      The phone numbers of customer
      - **`number`** _(string)_
        The number of phone
      - **`type`** _(string)_
        The type of phone
  - **`billing_address`** _(object)_
    The billing address for an order
    - **`street_1`** _(string)_
      The first line of billing address
    - **`street_2`** _(string)_
      The second line of billing address
    - **`company_name`** _(string)_
      The company name of customer
    - **`city`** _(string)_
      The city of the billing address
    - **`state`** _(string)_
      The state/province of the billng address
    - **`postal_code`** _(string)_
      The postal code of the billing address
    - **`country`** _(string)_
      The country of the billing address
  - **`shipping_address`** _(object)_
    The shipping address for an order
    - **`street_1`** _(string)_
      The first line of shipping address
    - **`street_2`** _(string)_
      The second line of shipping address
    - **`company_name`** _(string)_
      The company name of customer
    - **`city`** _(string)_
      The city of the shipping address
    - **`state`** _(string)_
      The state/province of the shipping address
    - **`postal_code`** _(string)_
      The postal code of the shipping address
    - **`country`** _(string)_
      The country of the shipping address
  - **`tracking`** _(object)_
    The tracking details for an order
    - **`provider`** _(string, required)_
      The name of carrier handling the shipment
    - **`number`** _(string, required)_
      The tracking number of shipment
    - **`url`** _(string)_
      The url of tracking page
    - **`updated_at`** _(string)_
      The date and time of last parcel update
  - **`line_items`** _(array<object>)_
    The line items for an order
    - **`name`** _(string, required)_
      The name of the line item
    - **`quantity`** _(string, required)_
      The quantity of the line item
    - **`total_amount`** _(string)_
      The total amount of the line item
    - **`id`** _(string)_
      The id of the line item
    - **`product_id`** _(string)_
      The product id of the line item
    - **`variant_id`** _(string)_
      The variant id of the line item
    - **`sku`** _(string)_
      The sku of the line item
    - **`description`** _(string)_
      The description of the line item
    - **`options`** _(array<object>)_
      The options for line item
      - **`id`** _(string)_
        The unique identifier for options
      - **`name`** _(string)_
        The name for options
      - **`value`** _(string)_
        The value for options
    - **`unit_price`** _(string)_
      The unit price of the line item
    - **`tax_rate`** _(string)_
      The tax rate of the line item
    - **`tax_amount`** _(string)_
      The tax amount of the line item
    - **`discounts`** _(array<object>)_
      The discounts for line item
      - **`code`** _(string)_
        The used for discounts
      - **`amount`** _(string)_
        The fixed amount for discounts
      - **`percentage`** _(string)_
        The percentage of discounts
  - **`note`** _(string)_
    The note for an order
  - **`created_at`** _(string)_
    The date and time when order was created
  - **`updated_at`** _(string)_
    The date and time when order was updated
  - **`type`** _(string)_
    The type of the order
  - **`shipping_methods`** _(object)_
    The shipping methods that are associated with the Order.
  - **`submitted_date`** _(string)_
  - **`remote_data`** _(object)_
    Raw data returned from the remote API call.
- **`next_cursor`** _(string)_
  The cursor to use for the next page of results. Pass this value as `next_cursor` in the query parameter in the next request to get the next page of results.

## Code examples

### curl

```bash
curl -X GET 'https://api.truto.one/unified/ecommerce/orders?integrated_account_id=<integrated_account_id>' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json'
```

### JavaScript

```javascript
const integratedAccountId = '<integrated_account_id>';

const response = await fetch(`https://api.truto.one/unified/ecommerce/orders?integrated_account_id=${integratedAccountId}`, {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

url = "https://api.truto.one/unified/ecommerce/orders"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
    "integrated_account_id": "<integrated_account_id>"
}

response = requests.get(url, headers=headers, params=params)
print(response.json())
```

### Truto TS SDK

```typescript
import Truto from '@truto/truto-ts-sdk';

const truto = new Truto({
  token: '<your_api_token>',
});

const result = await truto.unifiedApi.list(
  'ecommerce',
  'orders',
  { integrated_account_id: '<integrated_account_id>' }
);

console.log(result);
```

### Truto Python SDK

```python
import asyncio
from truto_python_sdk import TrutoApi

truto_api = TrutoApi(token="<your_api_token>")

async def main():
    async for item in truto_api.unified_api.list(
        "ecommerce",
        "orders",
        {"integrated_account_id": "<integrated_account_id>"}
    ):
        print(item)

asyncio.run(main())
```
