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

# Get Product by ID

> The "Get Product by ID" API allows to retrieve information for a specific product using its unique identifier. Use this endpoint to fetch details for a single product based on the provided product ID.

The "Get Product by ID" API allows to retrieve information for a specific product using its unique identifier. Use this endpoint to fetch details for a single product based on the provided product ID.

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

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

## Path parameters

<ParamField path="productId" type="string" required default="6578278e879ad2646715ba9c">
  ID or the slug of the product that needs to be returned
</ParamField>

## Query parameters

<ParamField query="locationId" type="string" required default="6578278e879ad2646715ba9c">
  account Id
</ParamField>

<ParamField query="sendWishlistStatus" type="boolean" default="True">
  Parameter which will decide whether to show the wishlisting status of products
</ParamField>

## Respuestas

<Accordion title="200 - Successful response">
  <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>

  ```json theme={null}
  {
    "_id": "655b33a82209e60b6adb87a5",
    "description": "This is a really awesome product",
    "variants": [
      {
        "id": "38s63qmxfr4",
        "name": "Size",
        "options": [
          {}
        ]
      }
    ],
    "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"
  }
  ```
</Accordion>

<Accordion title="400 - Product not found">
  ```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/YOUR_productId' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28'
  ```

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