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

# Update lead

> Update the phone number, status, campaign, or variables of a lead.

Updates an existing lead. Only the fields you provide in the request body are changed.

## Endpoint

`PUT /user/leads/{id}`

## Path parameters

<ParamField path="id" type="integer" required>
  ID of the lead to update.
</ParamField>

## Request

<ParamField body="campaign_id" type="integer">
  ID of the campaign to assign the lead to. Must belong to your account.
</ParamField>

<ParamField body="phone_number" type="string">
  New phone number for the lead. Automatically formatted to E.164.
</ParamField>

<ParamField body="status" type="string">
  New status. Allowed values: `created`, `completed`, `reached-max-retries`.

  <Note>
    Only a subset of statuses can be set manually. Statuses like `processing` and `scheduled` are assigned automatically by the system.
  </Note>
</ParamField>

<ParamField body="variables" type="object">
  Variables to merge with existing lead variables. Existing keys are updated; new keys are added.
</ParamField>

## Response

<ResponseField name="message" type="string">
  Confirmation that the lead was updated.
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT "https://portal.intellixent.ai/api/user/leads/123" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "phone_number": "+1234567890",
      "variables": {
        "customer_name": "John Doe",
        "company": "Acme Corp"
      }
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://portal.intellixent.ai/api/user/leads/123', {
    method: 'PUT',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      phone_number: '+1234567890',
      variables: {
        customer_name: 'John Doe',
        company: 'Acme Corp'
      }
    })
  });

  const data = await response.json();
  console.log(data.message);
  ```
</CodeGroup>

```json 200 Success theme={null}
{
  "message": "Lead updated successfully"
}
```

```json 404 Not found theme={null}
{
  "message": "Lead not found"
}
```

```json 422 Validation error theme={null}
{
  "message": "Validation failed",
  "errors": {
    "status": ["This status is assigned automatically and cannot be set manually"]
  }
}
```
