> ## Documentation Index
> Fetch the complete documentation index at: https://developers.leadwaycrm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List Orders

> The "List Orders" API allows to retrieve a paginated list of orders. Customize your results by filtering orders based on name, alt type, order status, payment mode, date range, type of source, contact

The "List Orders" API allows to retrieve a paginated list of orders. Customize your results by filtering orders based on name, alt type, order status, payment mode, date range, type of source, contact, funnel products or paginate through the list using the provided query parameters. This endpoint provides a straightforward way to explore and retrieve order information.

```http theme={null}
GET https://services.leadconnectorhq.com/payments/orders
```

## Autorización

<ParamField header="Authorization" type="string" required>
  Bearer token generado desde el portal Leadway. Ver [Autenticación](/authentication).
</ParamField>

<ParamField header="Version" type="string" required default="2021-07-28">
  Versión de la API.
</ParamField>

## Query parameters

<ParamField query="locationId" type="string" default="3SwdhCu3svxI8AKsPJt6">
  LocationId is the id of the account.
</ParamField>

<ParamField query="altId" type="string" required default="3SwdhCu3svxI8AKsPJt6">
  AltId is the unique identifier e.g: account id.
</ParamField>

<ParamField query="status" type="string" default="completed">
  Order status.
</ParamField>

<ParamField query="paymentStatus" type="string" default="unpaid">
  Payment Status of the Order
</ParamField>

<ParamField query="paymentMode" type="string" default="live">
  Mode of payment.
</ParamField>

<ParamField query="startAt" type="string" default="2024-02-01">
  Starting interval of orders.
</ParamField>

<ParamField query="endAt" type="string" default="2024-02-13">
  Closing interval of orders.
</ParamField>

<ParamField query="search" type="string" default="Awesome order">
  The name of the order for searching.
</ParamField>

<ParamField query="contactId" type="string" default="XPLSw2SVagl12LMDeTmQ">
  Contact id for filtering of orders.
</ParamField>

<ParamField query="funnelProductIds" type="string" default="61dd0c7dc077f712a5f787ff,61d6afc9d39ac5e35965c017">
  Funnel product ids separated by comma.
</ParamField>

<ParamField query="sourceId" type="string" default="61dd0c7dc077f712a5f787ff">
  Source id
</ParamField>

<ParamField query="limit" type="number" default="20">
  The maximum number of items to be included in a single page of results
</ParamField>

<ParamField query="offset" type="number" default="0">
  The starting index of the page, indicating the position from which the results should be retrieved.
</ParamField>

## Respuestas

<Accordion title="200 - Successful response">
  <ResponseField name="data" type="object[]" required>
    An array of orders

    <Expandable title="cada item">
      <ResponseField name="_id" type="string" required default="653f5e0cde5a1314e62a837c">
        The unique identifier for the order.
      </ResponseField>

      <ResponseField name="altId" type="string" required default="3SwdhCu3svxI8AKsPJt6">
        AltId is the unique identifier eg: account id.
      </ResponseField>

      <ResponseField name="altType" type="string" required default="account">
        AltType is the type of identifier.
      </ResponseField>

      <ResponseField name="contactId" type="string" default="XPLSw2SVagl12LMDeTmQ">
        Contact id corresponding to the order.
      </ResponseField>

      <ResponseField name="contactName" type="string" default="James Bond">
        Contact name corresponding to the order.
      </ResponseField>

      <ResponseField name="contactEmail" type="string" default="james.bond@leadwaycrm.com">
        Contact email corresponding to the order.
      </ResponseField>

      <ResponseField name="currency" type="string" default="USD">
        Currency in which order was created.
      </ResponseField>

      <ResponseField name="amount" type="number" default="100">
        Order value.
      </ResponseField>

      <ResponseField name="subtotal" type="number" default="100">
        Order sub-total value.
      </ResponseField>

      <ResponseField name="discount" type="number" default="10">
        Discount value on order.
      </ResponseField>

      <ResponseField name="status" type="string" required default="completed">
        The status of the order (e.g., completed).
      </ResponseField>

      <ResponseField name="liveMode" type="boolean" default="false">
        Order is in live / test mode.
      </ResponseField>

      <ResponseField name="totalProducts" type="number" default="5">
        Total products in an order.
      </ResponseField>

      <ResponseField name="sourceType" type="string" required default="funnel">
        Source type of order (eg: funnel).
      </ResponseField>

      <ResponseField name="sourceName" type="string" default="onestep">
        Source name for the order.
      </ResponseField>

      <ResponseField name="sourceId" type="string" default="kDj7BHej9Zyyq3QakJmz">
        Source id for the order.
      </ResponseField>

      <ResponseField name="sourceMeta" type="object" default="{ domain: &#x22;app.leadwaycrm.com&#x22;, pageId:  &#x22;rBVhyYhMsbxbO8ZqOcei&#x22;, pageUrl:  &#x22;/v2/preview/rBVhyYhMsbxbO8ZqOcei&#x22;, stepId:   &#x22;5a772f62-3fbc-418b-af1b-be8929dd64c2&#x22;}">
        Meta content for the source of order.
      </ResponseField>

      <ResponseField name="couponCode" type="string" default="100PER">
        Coupon code for the order.
      </ResponseField>

      <ResponseField name="createdAt" type="string" required default="2023-11-20T10:23:36.515Z">
        The creation timestamp of the order.
      </ResponseField>

      <ResponseField name="updatedAt" type="string" required default="2024-01-23T09:57:04.846Z">
        The last update timestamp of the order.
      </ResponseField>

      <ResponseField name="sourceSubType" type="string" default="one_step_order_form">
        Source sub-type for the order.
      </ResponseField>

      <ResponseField name="fulfillmentStatus" type="string" default="unfulfilled">
        Fulfillment status of the order.
      </ResponseField>

      <ResponseField name="onetimeProducts" type="number" default="1">
        Total one time products in an order.
      </ResponseField>

      <ResponseField name="recurringProducts" type="number" default="1">
        Total recurring time products in an order.
      </ResponseField>

      <ResponseField name="createdBy" type="string" default="user123">
        User ID who created the order.
      </ResponseField>
    </Expandable>
  </ResponseField>

  <ResponseField name="totalCount" type="number" required>
    total orders count
  </ResponseField>

  ```json theme={null}
  {
    "data": [
      {
        "_id": "653f5e0cde5a1314e62a837c",
        "altId": "3SwdhCu3svxI8AKsPJt6",
        "altType": "account",
        "contactId": "XPLSw2SVagl12LMDeTmQ",
        "contactName": "James Bond",
        "contactEmail": "james.bond@leadwaycrm.com",
        "currency": "USD",
        "amount": "100",
        "subtotal": "100",
        "discount": "10",
        "status": "completed",
        "liveMode": "false",
        "totalProducts": "5",
        "sourceType": "funnel",
        "sourceName": "onestep",
        "sourceId": "kDj7BHej9Zyyq3QakJmz",
        "sourceMeta": "{ domain: \"app.leadwaycrm.com\", pageId:  \"rBVhyYhMsbxbO8ZqOcei\", pageUrl:  \"/v2/preview/rBVhyYhMsbxbO8ZqOcei\", stepId:   \"5a772f62-3fbc-418b-af1b-be8929dd64c2\"}",
        "couponCode": "100PER",
        "createdAt": "2023-11-20T10:23:36.515Z",
        "updatedAt": "2024-01-23T09:57:04.846Z",
        "sourceSubType": "one_step_order_form",
        "fulfillmentStatus": "unfulfilled",
        "onetimeProducts": "1",
        "recurringProducts": "1",
        "createdBy": "user123"
      }
    ],
    "totalCount": 0
  }
  ```
</Accordion>

<Accordion title="400 - Bad Request">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="401 - Unauthorized">
  ```json theme={null}
  {}
  ```
</Accordion>

<Accordion title="422 - Unprocessable Entity">
  ```json theme={null}
  {}
  ```
</Accordion>

## Ejemplo

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET 'https://services.leadconnectorhq.com/payments/orders' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://services.leadconnectorhq.com/payments/orders', {
    method: 'GET',
    headers: {
      Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
      Version: '2021-07-28',
    },
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import os, requests
  response = requests.request(
      'GET',
      'https://services.leadconnectorhq.com/payments/orders',
      headers={
          'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
          'Version': '2021-07-28',
      },
  )
  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://services.leadconnectorhq.com/payments/orders');
  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => 'GET',
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
          'Version: 2021-07-28',
      ],
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>
