> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.levrage.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.levrage.ai/_mcp/server.

# Change a lead

PATCH https://api.levrage.ai/v1/crm/leads/{lead_id}
Content-Type: application/json

Send only what changes. Custom fields are merged, not replaced. The answer is the lead plus `changes` — what moved from what to what.

Reference: https://docs.levrage.ai/api-reference/crm/patch-lead

## Request

### Path parameters

- `lead_id` (string, required)

### Body (application/json)

This endpoint expects an object.

- `name` (string, optional, nullable)
- `phone` (string, optional, nullable) — Indian numbers in any common shape: 9876543210, +91 98765 43210.
- `email` (string, optional, nullable)
- `external_id` (string, optional, nullable) — Your id for the person (customer no., loan no., employee id) — the best key to upsert on.
- `company` (string, optional, nullable)
- `city` (string, optional, nullable)
- `stage_id` (string, optional, nullable) — From GET /crm/stages.
- `pipeline_id` (string, optional, nullable) — From GET /crm/pipelines; without stage_id the lead goes to that pipeline's first stage.
- `owner_user_id` (string, optional, nullable)
- `tags` (list of string, optional, nullable)
- `score` (integer, optional, nullable)
- `score_label` (enum, optional, nullable)
  - Allowed values: `hot`, `warm`, `cold`
- `expected_close_at` (string, optional, nullable)
- `probability` (integer, optional, nullable)
- `lost_reason` (string, optional, nullable)
- `next_action_at` (string, optional, nullable)
- `consent` (CrmLeadsLeadIdPatchRequestBodyContentApplicationJsonSchemaConsent, optional, nullable)
- `fields` (CrmLeadsLeadIdPatchRequestBodyContentApplicationJsonSchemaFields, optional, nullable) — Custom fields by key or by label, in any case (GET /crm/fields lists them): \{"Zone": "Madhapur"}.
- `source` (string, optional, nullable) — On create only: a short lower-case word (default "api").
- `source_detail` (CrmLeadsLeadIdPatchRequestBodyContentApplicationJsonSchemaSourceDetail, optional, nullable) — On create only, e.g. \{"form": "Contact us"}.
- `on_conflict` (enum, optional, nullable) — When the person is already a lead: error (default, 409), update, or ignore.
  - Allowed values: `error`, `update`, `ignore`
- `match_on` (list of enum, optional, nullable) — What makes two leads the same person (default all three, in that order).
  - Allowed values: `external_id`, `phone`, `email`
- `create_missing_fields` (boolean, optional, nullable) — Custom field names that don't exist become text fields instead of a 400.

## Response

### 200

Successful Response

- `id` (string, required)
- `name` (string, optional, nullable)
- `phone` (string, optional, nullable)
- `email` (string, optional, nullable)
- `external_id` (string, optional, nullable)
- `company` (string, optional, nullable)
- `city` (string, optional, nullable)
- `source` (string, optional, nullable)
- `stage` (CrmStage, optional, nullable)
- `pipeline_id` (string, optional, nullable)
- `owner_user_id` (string, optional, nullable)
- `tags` (list of string, optional, default: [])
- `score` (integer, optional, nullable)
- `score_label` (string, optional, nullable)
- `fields` (CrmLeadFields, optional, default: {})
- `consent` (CrmLeadConsent, optional, default: {})
- `deal_value` (double, optional, nullable)
- `last_call_at` (string, optional, nullable)
- `last_call_outcome` (string, optional, nullable)
- `created_at` (string, optional, nullable)
- `updated_at` (string, optional, nullable)

## Errors

### 400 Bad Request Error

Something in the request is wrong — `message` says what.

- `error` (CrmErrorBody, required)

### 401 Unauthorized Error

No key, or an unknown / revoked / expired key.

- `error` (CrmErrorBody, required)

### 403 Forbidden Error

The key has no CRM access, or read-only access.

- `error` (CrmErrorBody, required)

### 404 Not Found Error

Not there, deleted, or another workspace's.

- `error` (CrmErrorBody, required)

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

### 429 Too Many Requests Error

Over 600 requests a minute for this key — wait Retry-After seconds.

- `error` (CrmErrorBody, required)

## Types

### CrmLeadsLeadIdPatchRequestBodyContentApplicationJsonSchemaConsent

- `call` (boolean, optional, nullable)
- `whatsapp` (boolean, optional, nullable)
- `email` (boolean, optional, nullable)

### CrmLeadsLeadIdPatchRequestBodyContentApplicationJsonSchemaFields

Custom fields by key or by label, in any case (GET /crm/fields lists them): \{"Zone": "Madhapur"}.

### CrmLeadsLeadIdPatchRequestBodyContentApplicationJsonSchemaSourceDetail

On create only, e.g. \{"form": "Contact us"}.

### CrmStage

- `id` (string, required)
- `name` (string, required)
- `kind` (enum, required)
  - Allowed values: `open`, `qualified`, `won`, `lost`

### CrmLeadFields

### CrmLeadConsent

### CrmErrorBody

- `code` (string, required)
- `message` (string, required)
- `existing_id` (string, optional, nullable)

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### ValidationErrorLocItems

- string
- integer

## Examples

**Request**

```json
{
  "stage_id": "<won stage id>",
  "fields": {
    "Week": "44"
  },
  "deal_value": "1.5 lakh"
}
```

**Response**

```json
{
  "id": "string",
  "name": "string",
  "phone": "string",
  "email": "string",
  "external_id": "string",
  "company": "string",
  "city": "string",
  "source": "string",
  "stage": {
    "id": "string",
    "name": "string",
    "kind": "open"
  },
  "pipeline_id": "string",
  "owner_user_id": "string",
  "tags": [
    "string"
  ],
  "score": 1,
  "score_label": "string",
  "fields": {},
  "consent": {},
  "deal_value": 1.1,
  "last_call_at": "string",
  "last_call_outcome": "string",
  "created_at": "string",
  "updated_at": "string"
}
```

**SDK Code**

```python CRM_patch_lead_example
import requests

url = "https://api.levrage.ai/v1/crm/leads/lead_id"

payload = {
    "stage_id": "<won stage id>",
    "fields": { "Week": "44" },
    "deal_value": "1.5 lakh"
}
headers = {"Content-Type": "application/json"}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript CRM_patch_lead_example
const url = 'https://api.levrage.ai/v1/crm/leads/lead_id';
const options = {
  method: 'PATCH',
  headers: {'Content-Type': 'application/json'},
  body: '{"stage_id":"<won stage id>","fields":{"Week":"44"},"deal_value":"1.5 lakh"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go CRM_patch_lead_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.levrage.ai/v1/crm/leads/lead_id"

	payload := strings.NewReader("{\n  \"stage_id\": \"<won stage id>\",\n  \"fields\": {\n    \"Week\": \"44\"\n  },\n  \"deal_value\": \"1.5 lakh\"\n}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby CRM_patch_lead_example
require 'uri'
require 'net/http'

url = URI("https://api.levrage.ai/v1/crm/leads/lead_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"stage_id\": \"<won stage id>\",\n  \"fields\": {\n    \"Week\": \"44\"\n  },\n  \"deal_value\": \"1.5 lakh\"\n}"

response = http.request(request)
puts response.read_body
```

```java CRM_patch_lead_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.levrage.ai/v1/crm/leads/lead_id")
  .header("Content-Type", "application/json")
  .body("{\n  \"stage_id\": \"<won stage id>\",\n  \"fields\": {\n    \"Week\": \"44\"\n  },\n  \"deal_value\": \"1.5 lakh\"\n}")
  .asString();
```

```php CRM_patch_lead_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.levrage.ai/v1/crm/leads/lead_id', [
  'body' => '{
  "stage_id": "<won stage id>",
  "fields": {
    "Week": "44"
  },
  "deal_value": "1.5 lakh"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp CRM_patch_lead_example
using RestSharp;

var client = new RestClient("https://api.levrage.ai/v1/crm/leads/lead_id");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"stage_id\": \"<won stage id>\",\n  \"fields\": {\n    \"Week\": \"44\"\n  },\n  \"deal_value\": \"1.5 lakh\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift CRM_patch_lead_example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "stage_id": "<won stage id>",
  "fields": ["Week": "44"],
  "deal_value": "1.5 lakh"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.levrage.ai/v1/crm/leads/lead_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```