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

# Bulk Update Deals

> Update multiple deals with the same field values (max 100)

## Request

### Body Parameters

<ParamField body="deal_ids" type="array" required>
  Array of deal IDs to update (max 100)
</ParamField>

<ParamField body="updates" type="object" required>
  Fields to update on all specified deals. Supports: `name`, `stage`, `status`, `pipeline`, `estimated_value`, `priority`, `notes`, `tags`, `closed_date`, `owner_id`, `contact_id`, `deal_type`
</ParamField>

### Headers

```
Authorization: Bearer wbk_your_api_key_here
Content-Type: application/json
```

## Response

<ResponseField name="data" type="object">
  <Expandable title="properties">
    <ResponseField name="updated" type="integer">
      Number of deals updated
    </ResponseField>
  </Expandable>
</ResponseField>

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PATCH https://data.leadlex.com/functions/v1/api-gateway/v1/deals/bulk \
    -H "Authorization: Bearer wbk_your_api_key_here" \
    -H "Content-Type: application/json" \
    -d '{
      "deal_ids": ["deal-001", "deal-002", "deal-003"],
      "updates": { "stage": "Won", "status": "won" }
    }'
  ```

  ```python Python theme={null}
  import requests

  API_KEY = "wbk_your_api_key_here"
  BASE_URL = "https://data.leadlex.com/functions/v1/api-gateway"

  headers = {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}
  response = requests.patch(f"{BASE_URL}/v1/deals/bulk", headers=headers, json={
      "deal_ids": ["deal-001", "deal-002"],
      "updates": {"stage": "Won", "status": "won"}
  })
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://data.leadlex.com/functions/v1/api-gateway/v1/deals/bulk',
    {
      method: 'PATCH',
      headers: {
        'Authorization': 'Bearer wbk_your_api_key_here',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        deal_ids: ['deal-001', 'deal-002'],
        updates: { stage: 'Won', status: 'won' }
      })
    }
  );
  const { data } = await response.json();
  ```
</CodeGroup>

### Example Response

```json theme={null}
{
  "data": {
    "updated": 3
  }
}
```

## Errors

| Status | Code                       | Description                      |
| ------ | -------------------------- | -------------------------------- |
| 400    | `validation_error`         | Missing `deal_ids` or `updates`  |
| 400    | `validation_error`         | More than 100 deal IDs           |
| 403    | `insufficient_permissions` | Missing `deals:write` permission |
