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

# Eigenes Event auslösen

POST https://api.trackleads.io/api/v1/events/trigger
Content-Type: application/json

Meldet, dass ein Lead ein eigenes Event erreicht hat. Die `event_id` gehört zu einem eigenen Funnel-Schritt oder zu einem Trigger vom Typ Custom Event und wird in Trackleads beim jeweiligen Schritt angezeigt. Sende genau eine Lead-Kennung: `id`, `email` oder `tel`. Dieser Endpunkt akzeptiert den API-Key zusätzlich als `api_token` im Body. Er hat ein eigenes Limit von 120 Anfragen pro Minute.

Reference: https://docs.trackleads.io/api/referenz/funnel-events/trigger-funnel-event

## Authentication

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

## Request

### Body (application/json)

This endpoint expects a FunnelEventTrigger.

- `event_id` (string, required) — Event-ID des Funnel-Schritts oder Triggers.
- `id` (integer, optional) — Trackleads-ID des Leads.
- `email` (string, optional) — E-Mail des Leads.
- `tel` (string, optional) — Telefonnummer des Leads.
- `request_id` (string, optional) — Eigene Kennung für diesen Aufruf. Wiederholungen mit derselben `request_id` werden nur einmal verbucht.
- `api_token` (string, optional) — API-Key im Body, falls kein Header gesetzt werden kann.

## Response

### 200

Das Event wurde verbucht.

- `ok` (boolean, optional)
- `event_id` (string, optional)
- `receipt_id` (integer, optional) — ID des gespeicherten Event-Belegs.

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

### 404 Not Found Error

Unbekannte `event_id` oder kein passender Lead.

- `message` (string, optional)

### 409 Conflict Error

Die `request_id` wurde bereits für einen anderen Lead verwendet.

- `message` (string, optional)

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

## Examples

**Request**

```json
{
  "event_id": "3f2b8c1e-6a4d-4e0b-9c57-2d1f0a7b6e41",
  "email": "jane@example.com",
  "request_id": "order-1001-onboarding"
}
```

**Response**

```json
{
  "ok": true,
  "event_id": "3f2b8c1e-6a4d-4e0b-9c57-2d1f0a7b6e41",
  "receipt_id": 7781
}
```

**SDK Code**

```python Funnel-Events_triggerFunnelEvent_example
import requests

url = "https://api.trackleads.io/api/v1/events/trigger"

payload = {
    "event_id": "3f2b8c1e-6a4d-4e0b-9c57-2d1f0a7b6e41",
    "email": "jane@example.com",
    "request_id": "order-1001-onboarding"
}
headers = {
    "X-API-Key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Funnel-Events_triggerFunnelEvent_example
const url = 'https://api.trackleads.io/api/v1/events/trigger';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"event_id":"3f2b8c1e-6a4d-4e0b-9c57-2d1f0a7b6e41","email":"jane@example.com","request_id":"order-1001-onboarding"}'
};

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

```go Funnel-Events_triggerFunnelEvent_example
package main

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

func main() {

	url := "https://api.trackleads.io/api/v1/events/trigger"

	payload := strings.NewReader("{\n  \"event_id\": \"3f2b8c1e-6a4d-4e0b-9c57-2d1f0a7b6e41\",\n  \"email\": \"jane@example.com\",\n  \"request_id\": \"order-1001-onboarding\"\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 Funnel-Events_triggerFunnelEvent_example
require 'uri'
require 'net/http'

url = URI("https://api.trackleads.io/api/v1/events/trigger")

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  \"event_id\": \"3f2b8c1e-6a4d-4e0b-9c57-2d1f0a7b6e41\",\n  \"email\": \"jane@example.com\",\n  \"request_id\": \"order-1001-onboarding\"\n}"

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

```java Funnel-Events_triggerFunnelEvent_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.trackleads.io/api/v1/events/trigger")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"event_id\": \"3f2b8c1e-6a4d-4e0b-9c57-2d1f0a7b6e41\",\n  \"email\": \"jane@example.com\",\n  \"request_id\": \"order-1001-onboarding\"\n}")
  .asString();
```

```php Funnel-Events_triggerFunnelEvent_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.trackleads.io/api/v1/events/trigger', [
  'body' => '{
  "event_id": "3f2b8c1e-6a4d-4e0b-9c57-2d1f0a7b6e41",
  "email": "jane@example.com",
  "request_id": "order-1001-onboarding"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<apiKey>',
  ],
]);

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

```csharp Funnel-Events_triggerFunnelEvent_example
using RestSharp;

var client = new RestClient("https://api.trackleads.io/api/v1/events/trigger");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"event_id\": \"3f2b8c1e-6a4d-4e0b-9c57-2d1f0a7b6e41\",\n  \"email\": \"jane@example.com\",\n  \"request_id\": \"order-1001-onboarding\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Funnel-Events_triggerFunnelEvent_example
import Foundation

let headers = [
  "X-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "event_id": "3f2b8c1e-6a4d-4e0b-9c57-2d1f0a7b6e41",
  "email": "jane@example.com",
  "request_id": "order-1001-onboarding"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.trackleads.io/api/v1/events/trigger")! 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()
```