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

# Lead aktualisieren

POST https://api.trackleads.io/api/v1/leads/update
Content-Type: application/json

Aktualisiert einen bestehenden Lead. Gibt es keinen Treffer, antwortet die API mit 422. Nutze nach Möglichkeit `/leads/upsert`.

Reference: https://docs.trackleads.io/api/referenz/leads/update-lead

## Authentication

- `X-API-Key` header (required) — API-Key des Business. Alternativ als `Authorization: Bearer <key>`.

## Request

### Body (application/json)

This endpoint expects a LeadWrite.

- `email` (StringOrStringList, optional) — E-Mail-Adresse(n). Kennung für den Abgleich und gespeicherte Kontaktdaten.
- `phone` (StringOrStringList, optional) — Telefonnummer(n). Kennung für den Abgleich und gespeicherte Kontaktdaten.
- `custom_id` (string, optional) — Trackleads-Lead-ID aus einer früheren API-Antwort. Dient nur als Kennung.
- `name` (string, optional) — Vollständiger Name.
- `status` (string, optional) — Lead-Status, der gesetzt werden soll. Muss einem im Business konfigurierten Status entsprechen (API-Name, ersatzweise Anzeigename). Unbekannte Werte führen zu 422.
- `employee` (string, optional) — Person, die beim Statuswechsel vermerkt wird.
- `tags` (list of string, optional) — Tag-Namen, die hinzugefügt werden. Unbekannte Tags werden angelegt.
- `rm_tags` (list of string, optional) — Tag-Namen, die vom Lead entfernt werden.
- `rm_email` (StringOrStringList, optional) — E-Mail-Adressen, die vom Lead entfernt werden.
- `rm_phone` (StringOrStringList, optional) — Telefonnummern, die vom Lead entfernt werden.
- `utm_parameters` (map from string to any, optional) — Tracking-Parameter der Sitzung, die zu dieser Eintragung oder diesem Kauf geführt hat, zum Beispiel `utm_source`, `utm_campaign`, `fbclid`, `gclid` und vor allem `tlio_adid`. Werte sind einfache Werte oder Listen einfacher Werte. Ohne diese Parameter zählt der Lead als organisch.
- `funnel_url` (string, optional) — URL der Seite, auf der die Person konvertiert ist.
- `calendly_event` (string, optional) — URL eines Calendly-Events, das mit dem Lead verknüpft wird.

## Response

### 200

Der Lead wurde aktualisiert.

- `ok` (boolean, optional)
- `id` (string, optional) — Trackleads-Lead-ID. Als `custom_id` in späteren Aufrufen nutzbar.

## Errors

### 401 Unauthorized Error

API-Key fehlt oder ist ungültig.

- `ok` (boolean, optional)
- `error` (enum, optional)
  - Allowed values: `API_KEY_MISSING`, `API_KEY_INVALID`

### 422 Unprocessable Entity Error

Validierung fehlgeschlagen, zum Beispiel "Lead not found", eine doppelte `transaction_id` oder ein unbekannter Status.

- `message` (string, optional)
- `errors` (map from string to list of string, optional)

### 429 Too Many Requests Error

Rate-Limit überschritten. Warte die Sekunden aus dem Header `Retry-After` ab.

- `any`

## Types

### StringOrStringList

- string
- list of string

## Examples

**Request**

```json
{
  "custom_id": "K7Q2M9XA",
  "status": "qualified",
  "rm_tags": [
    "Webinar"
  ]
}
```

**Response**

```json
{
  "ok": true,
  "id": "K7Q2M9XA"
}
```

**SDK Code**

```python Leads_updateLead_example
import requests

url = "https://api.trackleads.io/api/v1/leads/update"

payload = {
    "custom_id": "K7Q2M9XA",
    "status": "qualified",
    "rm_tags": ["Webinar"]
}
headers = {
    "X-API-Key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Leads_updateLead_example
const url = 'https://api.trackleads.io/api/v1/leads/update';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"custom_id":"K7Q2M9XA","status":"qualified","rm_tags":["Webinar"]}'
};

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

```go Leads_updateLead_example
package main

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

func main() {

	url := "https://api.trackleads.io/api/v1/leads/update"

	payload := strings.NewReader("{\n  \"custom_id\": \"K7Q2M9XA\",\n  \"status\": \"qualified\",\n  \"rm_tags\": [\n    \"Webinar\"\n  ]\n}")

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

	req.Header.Add("X-API-Key", "<apiKey>")
	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 Leads_updateLead_example
require 'uri'
require 'net/http'

url = URI("https://api.trackleads.io/api/v1/leads/update")

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

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"custom_id\": \"K7Q2M9XA\",\n  \"status\": \"qualified\",\n  \"rm_tags\": [\n    \"Webinar\"\n  ]\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.trackleads.io/api/v1/leads/update")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"custom_id\": \"K7Q2M9XA\",\n  \"status\": \"qualified\",\n  \"rm_tags\": [\n    \"Webinar\"\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.trackleads.io/api/v1/leads/update', [
  'body' => '{
  "custom_id": "K7Q2M9XA",
  "status": "qualified",
  "rm_tags": [
    "Webinar"
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<apiKey>',
  ],
]);

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

```csharp Leads_updateLead_example
using RestSharp;

var client = new RestClient("https://api.trackleads.io/api/v1/leads/update");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"custom_id\": \"K7Q2M9XA\",\n  \"status\": \"qualified\",\n  \"rm_tags\": [\n    \"Webinar\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Leads_updateLead_example
import Foundation

let headers = [
  "X-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "custom_id": "K7Q2M9XA",
  "status": "qualified",
  "rm_tags": ["Webinar"]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.trackleads.io/api/v1/leads/update")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
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()
```