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

# Update Deal

> Update an existing deal

## Request

### Path Parameters

<ParamField path="id" type="string" required>
  Deal ID (UUID)
</ParamField>

### Body Parameters

All fields are optional. Only provided fields will be updated.

<ParamField body="name" type="string">Deal name</ParamField>
<ParamField body="stage" type="string">Deal stage</ParamField>
<ParamField body="status" type="string">Deal status (`active`, `won`, `lost`)</ParamField>
<ParamField body="pipeline" type="string">Pipeline name</ParamField>
<ParamField body="estimated_value" type="number">Estimated value</ParamField>
<ParamField body="priority" type="string">Priority level</ParamField>
<ParamField body="notes" type="string">Deal notes</ParamField>
<ParamField body="tags" type="array">Tags (replaces existing)</ParamField>
<ParamField body="contact_id" type="string">Primary contact ID</ParamField>
<ParamField body="owner_id" type="string">Owner user ID</ParamField>
<ParamField body="deal_type" type="string">Deal/matter type</ParamField>
<ParamField body="closed_date" type="string">Close date (ISO 8601)</ParamField>
<ParamField body="description" type="string">High-level description</ParamField>
<ParamField body="follow_up_date" type="string">Next follow-up date</ParamField>
<ParamField body="probability" type="number">Win probability (0-100)</ParamField>
<ParamField body="currency" type="string">Currency code</ParamField>

### Headers

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

## Response

<ResponseField name="data" type="object">
  The updated deal object with all fields
</ResponseField>

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PATCH https://data.leadlex.com/functions/v1/api-gateway/v1/deals/deal-001 \
    -H "Authorization: Bearer wbk_your_api_key_here" \
    -H "Content-Type: application/json" \
    -d '{ "stage": "Negotiation", "estimated_value": 75000 }'
  ```

  ```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/deal-001", headers=headers, json={
      "stage": "Negotiation",
      "estimated_value": 75000
  })
  print(response.json())
  ```

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

## Errors

| Status | Code                       | Description                      |
| ------ | -------------------------- | -------------------------------- |
| 404    | `not_found`                | Deal not found                   |
| 403    | `insufficient_permissions` | Missing `deals:write` permission |
