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

# Bulk Edit Products and Prices

> API to bulk edit products and their associated prices (max 30 entities)

API to bulk edit products and their associated prices (max 30 entities)

```http theme={null}
POST https://services.leadconnectorhq.com/products/bulk-update/edit
```

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

## Body

<ParamField body="altId" type="string" required default="6578278e879ad2646715ba9c">
  Account Id or Agency Id
</ParamField>

<ParamField body="altType" type="string" required>
  Posibles valores: 'account'
</ParamField>

<ParamField body="products" type="object[]" required>
  Array of products to update. Note: The total count includes all prices within each product.

  <Expandable title="cada item">
    <ParamField body="_id" type="string" required default="64a1b2c3d4e5f67890123456">
      Product ID
    </ParamField>

    <ParamField body="name" type="string" default="Premium Product">
      Product name
    </ParamField>

    <ParamField body="description" type="string" default="A high-quality premium product with excellent features and durability">
      Product description
    </ParamField>

    <ParamField body="image" type="string" default="https://example.com/product-image.jpg">
      Product image
    </ParamField>

    <ParamField body="availableInStore" type="boolean" default="True">
      Product availability in store
    </ParamField>

    <ParamField body="prices" type="object[]">
      Array of price variants for the product

      <Expandable title="cada item">
        <ParamField body="_id" type="string" required default="64a1b2c3d4e5f67890123456">
          Price ID
        </ParamField>

        <ParamField body="name" type="string" default="Standard Plan">
          Price name
        </ParamField>

        <ParamField body="amount" type="number" default="99.99">
          Price amount
        </ParamField>

        <ParamField body="currency" type="string" default="USD">
          Price currency
        </ParamField>

        <ParamField body="compareAtPrice" type="number" default="129.99">
          Compare at price
        </ParamField>

        <ParamField body="availableQuantity" type="number" default="100">
          Available quantity
        </ParamField>

        <ParamField body="trackInventory" type="boolean" default="True">
          Track inventory
        </ParamField>

        <ParamField body="allowOutOfStockPurchases" type="boolean" default="False">
          Allow out of stock purchases
        </ParamField>

        <ParamField body="sku" type="string" default="SKU-001">
          SKU
        </ParamField>

        <ParamField body="trialPeriod" type="number" default="7">
          Trial period in days
        </ParamField>

        <ParamField body="totalCycles" type="number" default="12">
          Total billing cycles
        </ParamField>

        <ParamField body="setupFee" type="number" default="25">
          Setup fee
        </ParamField>

        <ParamField body="shippingOptions" type="object">
          Shipping options
        </ParamField>

        <ParamField body="recurring" type="object">
          Recurring details
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="collectionIds" type="string[]">
      Collection IDs
    </ParamField>

    <ParamField body="isLabelEnabled" type="boolean" default="True">
      Enable product label
    </ParamField>

    <ParamField body="isTaxesEnabled" type="boolean" default="True">
      Enable taxes
    </ParamField>

    <ParamField body="seo" type="object">
      SEO metadata for the product
    </ParamField>

    <ParamField body="slug" type="string" default="premium-product">
      Product URL slug
    </ParamField>

    <ParamField body="automaticTaxCategoryId" type="string" default="64a1b2c3d4e5f67890123460">
      Automatic tax category ID
    </ParamField>

    <ParamField body="taxInclusive" type="boolean" default="False">
      Tax inclusive pricing
    </ParamField>

    <ParamField body="taxes" type="object[]">
      Product taxes
    </ParamField>

    <ParamField body="medias" type="object[]">
      Product media
    </ParamField>

    <ParamField body="label" type="object">
      Product label
    </ParamField>
  </Expandable>
</ParamField>

## Respuestas

<Accordion title="201 - Products and prices updated successfully">
  <ResponseField name="message" type="string" required default="Products updated successfully">
    Success message
  </ResponseField>

  <ResponseField name="status" type="boolean" required default="True">
    Operation status
  </ResponseField>

  <ResponseField name="updatedCount" type="number" required default="5">
    Number of products updated
  </ResponseField>

  ```json theme={null}
  {
    "message": "Products updated successfully",
    "status": true,
    "updatedCount": 5
  }
  ```
</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 POST 'https://services.leadconnectorhq.com/products/bulk-update/edit' \
    -H 'Authorization: Bearer YOUR_TOKEN' \
    -H 'Version: 2021-07-28' \
    -H 'Content-Type: application/json' \
    -d '{
    "altId": "6578278e879ad2646715ba9c",
    "altType": "account",
    "products": [
      {
        "_id": "64a1b2c3d4e5f67890123456",
        "name": "Premium Product",
        "description": "A high-quality premium product with excellent features and durability",
        "image": "https://example.com/product-image.jpg",
        "availableInStore": true,
        "prices": [
          {}
        ],
        "collectionIds": [
          "64a1b2c3d4e5f67890123458",
          "64a1b2c3d4e5f67890123459"
        ],
        "isLabelEnabled": true,
        "isTaxesEnabled": true,
        "slug": "premium-product",
        "automaticTaxCategoryId": "64a1b2c3d4e5f67890123460",
        "taxInclusive": false,
        "taxes": [
          {}
        ],
        "medias": [
          {}
        ],
        "label": {}
      }
    ]
  }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://services.leadconnectorhq.com/products/bulk-update/edit', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
      Version: '2021-07-28',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({"altId": "6578278e879ad2646715ba9c", "altType": "account", "products": [{"_id": "64a1b2c3d4e5f67890123456", "name": "Premium Product", "description": "A high-quality premium product with excellent features and durability", "image": "https://example.com/product-image.jpg", "availableInStore": true, "prices": [{}], "collectionIds": ["64a1b2c3d4e5f67890123458", "64a1b2c3d4e5f67890123459"], "isLabelEnabled": true, "isTaxesEnabled": true, "slug": "premium-product", "automaticTaxCategoryId": "64a1b2c3d4e5f67890123460", "taxInclusive": false, "taxes": [{}], "medias": [{}], "label": {}}]}),
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import os, requests
  response = requests.request(
      'POST',
      'https://services.leadconnectorhq.com/products/bulk-update/edit',
      headers={
          'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
          'Version': '2021-07-28',
          'Content-Type': 'application/json',
      },
      json={"altId": "6578278e879ad2646715ba9c", "altType": "account", "products": [{"_id": "64a1b2c3d4e5f67890123456", "name": "Premium Product", "description": "A high-quality premium product with excellent features and durability", "image": "https://example.com/product-image.jpg", "availableInStore": true, "prices": [{}], "collectionIds": ["64a1b2c3d4e5f67890123458", "64a1b2c3d4e5f67890123459"], "isLabelEnabled": true, "isTaxesEnabled": true, "slug": "premium-product", "automaticTaxCategoryId": "64a1b2c3d4e5f67890123460", "taxInclusive": false, "taxes": [{}], "medias": [{}], "label": {}}]},
  )
  data = response.json()
  ```

  ```php PHP theme={null}
  <?php
  $ch = curl_init('https://services.leadconnectorhq.com/products/bulk-update/edit');
  curl_setopt_array($ch, [
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_CUSTOMREQUEST => 'POST',
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
          'Version: 2021-07-28',
          'Content-Type: application/json',
      ],
      CURLOPT_POSTFIELDS => json_encode({'altId': '6578278e879ad2646715ba9c', 'altType': 'account', 'products': [{'_id': '64a1b2c3d4e5f67890123456', 'name': 'Premium Product', 'description': 'A high-quality premium product with excellent features and durability', 'image': 'https://example.com/product-image.jpg', 'availableInStore': true, 'prices': [{}], 'collectionIds': ['64a1b2c3d4e5f67890123458', '64a1b2c3d4e5f67890123459'], 'isLabelEnabled': true, 'isTaxesEnabled': true, 'slug': 'premium-product', 'automaticTaxCategoryId': '64a1b2c3d4e5f67890123460', 'taxInclusive': false, 'taxes': [{}], 'medias': [{}], 'label': {}}]}),
  ]);
  $data = json_decode(curl_exec($ch), true);
  ```
</CodeGroup>
