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

# Vor dem Start eines Experiments ein Ziel und Segment hinzufügen

> Verknüpfen Sie ein Targeting-Segment und ein Ziel mit einem Experiment und aktivieren Sie es dann mit dem PATCH-Endpoint der Automation API.

## Ziel

Verknüpfen Sie das Ziel und Segment mit `Experiment_1` und aktivieren Sie das Experiment.

## Schritte

### 1. Verknüpfen und starten

**Endpoint:**

```
PATCH https://api.kameleoon.com/experiments/{experimentId}?action=ACTIVATE
```

| Name               | Typ    | Beschreibung                                          |
| ------------------ | ------ | ----------------------------------------------------- |
| targetingSegmentId | String | Zu verknüpfende Segment-ID.                           |
| goals              | Array  | Zu verknüpfende Ziel-IDs.                             |
| deviations         | Object | Traffic-Zuweisung zwischen Kontrolle und Variationen. |
| mainGoalId         | String | Haupt-Ziel-ID.                                        |
| status             | String | Experimentstatus (`ONLINE`, `PAUSED` usw.).           |

**Beispiel:**

```bash theme={null}
curl -L -X PATCH 'https://api.kameleoon.com/experiments/283505?action=ACTIVATE' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <ACCESS_TOKEN>' \
--data-raw '{
  "targetingSegmentId": 298314,
  "goals": [361517],
  "deviations": {"origin": 0.5, "1053310": 0.5},
  "mainGoalId": 361517,
  "status": "ONLINE"
}'
```

### 2. Start überprüfen

Aktualisieren Sie das Dashboard.
`Experiment_1` sollte jetzt den Status **Online** anzeigen:

<Frame>
  ![Experiment\_activated](https://storage.googleapis.com/kameleoon-storage-documentation/developers/images/api-tutorial/experiment-launched.jpg)
</Frame>

***

Die Erstellung, Konfiguration und der Start eines Experiments mithilfe der Automation API sind nun abgeschlossen.
