> ## 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 Products

> The "List Products" API allows to retrieve a paginated list of products. Customize your results by filtering products based on name or paginate through the list using the provided query parameters. Th

The "List Products" API allows to retrieve a paginated list of products. Customize your results by filtering products based on name or paginate through the list using the provided query parameters. This endpoint provides a straightforward way to explore and retrieve product information.

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

## 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="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>

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

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

<ParamField query="collectionIds" type="string">
  Filter by product category Ids. Supports comma separated values
</ParamField>

<ParamField query="collectionSlug" type="string">
  The slug value of the collection by which the collection would be searched
</ParamField>

<ParamField query="expand" type="string[]">
  Name of an entity whose data has to be fetched along with product. Possible entities are tax, stripe and paypal. If not mentioned, only ID will be returned in case of taxes
</ParamField>

<ParamField query="productIds" type="string[]">
  List of product ids to be fetched.
</ParamField>

<ParamField query="storeId" type="string" default="3SwdhCu3svxI8AKsPJt6">
  fetch and project products based on the storeId
</ParamField>

<ParamField query="includedInStore" type="boolean" default="True">
  Separate products by which are included in the store and which are not
</ParamField>

<ParamField query="availableInStore" type="boolean" default="True">
  If the product is included in the online store
</ParamField>

<ParamField query="sortOrder" type="string" default="desc">
  The order of sort which should be applied for the date
</ParamField>

## Respuestas

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

    <Expandable title="cada item">
      <ResponseField name="_id" type="string" required default="655b33a82209e60b6adb87a5">
        The unique identifier for the product.
      </ResponseField>

      <ResponseField name="description" type="string" default="This is a really awesome product">
        product description
      </ResponseField>

      <ResponseField name="variants" type="object[]">
        An array of variants for the product.

        <Expandable title="cada item">
          <ResponseField name="id" type="string" required default="38s63qmxfr4">
            A unique identifier for the variant.
          </ResponseField>

          <ResponseField name="name" type="string" required default="Size">
            The name of the variant.
          </ResponseField>

          <ResponseField name="options" type="object[]" required>
            An array of options for the variant.

            <Expandable title="cada item">
              <ResponseField name="id" type="string" required default="h4z7u0im2q8">
                The unique identifier for the option.
              </ResponseField>

              <ResponseField name="name" type="string" required default="XL">
                The name of the option.
              </ResponseField>
            </Expandable>
          </ResponseField>
        </Expandable>
      </ResponseField>

      <ResponseField name="locationId" type="string" required default="3SwdhCsvxI8Au3KsPJt6">
        The unique identifier for the account.
      </ResponseField>

      <ResponseField name="name" type="string" required default="Awesome Product">
        The name of the product.
      </ResponseField>

      <ResponseField name="productType" type="string" required default="PHYSICAL">
        The type of the product (e.g., PHYSICAL).
      </ResponseField>

      <ResponseField name="availableInStore" type="boolean" default="True">
        Indicates whether the product is available in-store.
      </ResponseField>

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

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

      <ResponseField name="statementDescriptor" type="string" default="abcde">
        The statement descriptor for the product.
      </ResponseField>

      <ResponseField name="image" type="string" default="https://storage.googleapis.com/ghl-test/3SwdhCsvxI8Au3KsPJt6/media/65af8d5df88bdb4b1022ee90.png">
        The URL for the product image.
      </ResponseField>

      <ResponseField name="collectionIds" type="string[]">
        An array of category Ids for the product
      </ResponseField>

      <ResponseField name="isTaxesEnabled" type="boolean" default="True">
        The field indicates whether taxes are enabled for the product or not.
      </ResponseField>

      <ResponseField name="taxes" type="string[]">
        An array of ids of Taxes attached to the Product. If the expand query includes tax, the taxes will be of type `ProductTaxDto`. Please refer to the `ProductTaxDto` for additional details.
      </ResponseField>

      <ResponseField name="automaticTaxCategoryId" type="string" default="65d71377c326ea78e1c47df5">
        Tax category ID for Automatic taxes calculation.
      </ResponseField>

      <ResponseField name="label" type="object">
        The Product label details
      </ResponseField>

      <ResponseField name="slug" type="string" default="washing-machine">
        The slug of the product by which the product will be navigated
      </ResponseField>
    </Expandable>
  </ResponseField>

  <ResponseField name="total" type="object[]" required>
    list products status

    <Expandable title="cada item">
      <ResponseField name="total" type="number" required default="20">
        Total number of products
      </ResponseField>
    </Expandable>
  </ResponseField>

  ```json theme={null}
  {
    "products": [
      {
        "_id": "655b33a82209e60b6adb87a5",
        "description": "This is a really awesome product",
        "variants": [
          {}
        ],
        "locationId": "3SwdhCsvxI8Au3KsPJt6",
        "name": "Awesome Product",
        "productType": "PHYSICAL",
        "availableInStore": true,
        "createdAt": "2023-11-20T10:23:36.515Z",
        "updatedAt": "2024-01-23T09:57:04.846Z",
        "statementDescriptor": "abcde",
        "image": "https://storage.googleapis.com/ghl-test/3SwdhCsvxI8Au3KsPJt6/media/65af8d5df88bdb4b1022ee90.png",
        "collectionIds": [
          "65d71377c326ea78e1c47df5",
          "65d71377c326ea78e1c47d34"
        ],
        "isTaxesEnabled": true,
        "taxes": [
          "654492a4e6bef380114de15a"
        ],
        "automaticTaxCategoryId": "65d71377c326ea78e1c47df5",
        "slug": "washing-machine"
      }
    ],
    "total": [
      {
        "total": 20
      }
    ]
  }
  ```
</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/products/' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://services.leadconnectorhq.com/products/', {
    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/products/',
      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/products/');
  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>
