# API: AI Brains, Entwürfe und der Playground

_API · 6 Min. Lesezeit · Aktualisiert 2026-10-22 · https://lanachat.ai/guides/de/api-ai-brains/_

Ein **AI Brain** enthält, wie die KI für eine Creatorin verkauft: ihre Verkaufsphasen, Regeln und Einstellungen. Sie ändern einen **Entwurf**, testen ihn im **Playground** und **veröffentlichen** ihn dann; das Live-Brain ändert sich erst bei der Veröffentlichung. Ein Brain ist mit einer Creatorin verknüpft und kann von ihren Accounts wiederverwendet werden.

## Endpoints

| Method | Path | Description | Permission | Status |
|---|---|---|---|---|
| GET | `/brains` | List brains (`creator_id=`) | `can_engine` | Planned |
| POST | `/brains` | Create a brain for a creator, empty or copied from another (`copy_from`) | `can_engine` | Planned |
| GET | `/brains/{id}` | The live version of a brain | `can_engine` | Planned |
| PATCH | `/brains/{id}` | Rename it or link it to another creator | `can_engine` | Planned |
| DELETE | `/brains/{id}` | Delete a brain no account uses | `can_engine` | Planned |
| GET | `/brains/{id}/draft` | The current draft and what differs from live | `can_engine` | Planned |
| PATCH | `/brains/{id}/draft` | Change the draft (phases, rules, settings) | `can_engine` | Planned |
| DELETE | `/brains/{id}/draft` | Throw the draft away | `can_engine` | Planned |
| POST | `/brains/{id}/publish` | Publish the draft; it becomes live on every linked account | `can_publish` | Planned |
| GET | `/brains/{id}/versions` | Published versions, newest first | `can_engine` | Planned |
| POST | `/brains/{id}/versions/{version}/restore` | Copy an old version into the draft | `can_engine` | Planned |
| POST | `/playground/{brain_id}/message` | Send a test message to the draft and get the AI's reply | `can_engine` | Planned |
| DELETE | `/playground/{brain_id}/session` | Start the test conversation over | `can_engine` | Planned |

## The brain object

```json
{
  "id": "br_lea_main",
  "name": "Lea · main",
  "creator_id": "cr_lea",
  "version": 12,
  "published_at": "2026-10-04T21:10:00Z",
  "has_draft": true,
  "accounts": ["acc_1001", "acc_1004"],
  "phases": [
    { "key": "warm_up", "name": "Warm up", "enabled": true },
    { "key": "first_offer", "name": "First offer", "enabled": true }
  ]
}
```

| Field | Type | Description |
|---|---|---|
| `id` | string | Beginnt mit `br_` |
| `name` | string | Sein Name in der Console |
| `creator_id` | string | Die Creatorin, mit der es verknüpft ist |
| `version` | number | Die Live-Version; erhöht sich bei jeder Veröffentlichung um eins |
| `published_at` | string or null | Wann die Live-Version veröffentlicht wurde, ISO 8601 UTC |
| `has_draft` | boolean | `true`, wenn ein Entwurf sich von der Live-Version unterscheidet |
| `accounts` | array of strings | Telegram-Accounts, die mit diesem Brain antworten |
| `phases` | array | Verkaufsphasen: `key`, `name` und ob jede `enabled` ist |

## Brains

### List brains

`GET /brains` · `can_engine`

| Parameter | Type | Required | Description |
|---|---|---|---|
| `creator_id` | string | Nein | Nur die Brains dieser Creatorin |
| `limit`, `cursor` | number, string | Nein | [Pagination](https://lanachat.ai/guides/de/api-overview/) |

```bash
curl "https://api.lanachat.ai/v1/brains?creator_id=cr_lea" \
  -H "Authorization: Bearer $LANACHAT_TOKEN"
```

```json
{
  "data": [
    { "id": "br_lea_main", "name": "Lea · main", "creator_id": "cr_lea", "version": 12, "published_at": "2026-10-04T21:10:00Z", "has_draft": true, "accounts": ["acc_1001", "acc_1004"], "phases": [ { "key": "warm_up", "name": "Warm up", "enabled": true }, { "key": "first_offer", "name": "First offer", "enabled": true } ] }
  ],
  "next_cursor": null
}
```

### Create a brain

`POST /brains` · `can_engine`

| Parameter | Type | Required | Description |
|---|---|---|---|
| `creator_id` | string | Ja | Für welche Creatorin es ist |
| `name` | string | Nein | Sein Name in der Console |
| `copy_from` | string | Nein | Id eines Brains zum Kopieren; ohne startet das Brain leer |

```bash
curl -X POST https://api.lanachat.ai/v1/brains \
  -H "Authorization: Bearer $LANACHAT_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"creator_id": "cr_lea", "name": "Lea · TikTok test", "copy_from": "br_lea_main"}'
```

Die Antwort ist das neue Brain (`201`). Ein `copy_from` Brain, das in diesem Workspace nicht existiert, antwortet mit `404`.

### Get a brain

`GET /brains/{id}` · `can_engine`

```bash
curl https://api.lanachat.ai/v1/brains/br_lea_main \
  -H "Authorization: Bearer $LANACHAT_TOKEN"
```

Die Antwort ist die Live-Version, wie im brain object. Der Entwurf wird mit `GET /brains/{id}/draft` gelesen.

### Rename or relink a brain

`PATCH /brains/{id}` · `can_engine`

| Parameter | Type | Required | Description |
|---|---|---|---|
| `name` | string | Nein | Neuer Name |
| `creator_id` | string | Nein | Verknüpfen mit einer anderen Creatorin |

```bash
curl -X PATCH https://api.lanachat.ai/v1/brains/br_lea_main \
  -H "Authorization: Bearer $LANACHAT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "Lea · main FR"}'
```

Die Antwort ist das aktualisierte Brain.

### Delete a brain

`DELETE /brains/{id}` · `can_engine`

```bash
curl -X DELETE https://api.lanachat.ai/v1/brains/br_lea_old \
  -H "Authorization: Bearer $LANACHAT_TOKEN"
```

Ein Brain, das ein Account noch nutzt, wird abgelehnt (`409`): Verknüpfen Sie diese Accounts zuerst mit einem anderen Brain.

## Drafts and publishing

### Read the draft

`GET /brains/{id}/draft` · `can_engine`

```bash
curl https://api.lanachat.ai/v1/brains/br_lea_main/draft \
  -H "Authorization: Bearer $LANACHAT_TOKEN"
```

Die Antwort ist der aktuelle Entwurf (Phasen, Regeln und Einstellungen) und was sich von der Live-Version unterscheidet.

### Change the draft

`PATCH /brains/{id}/draft` · `can_engine`

| Parameter | Type | Required | Description |
|---|---|---|---|
| `phases` | array | Nein | Zu ändernde Verkaufsphasen |
| `rules` | array | Nein | Zu ändernde Regeln |
| `settings` | object | Nein | Zu ändernde Einstellungen, z. B. `first_offer_after_messages` oder `max_discount_percent` |

```bash
curl -X PATCH https://api.lanachat.ai/v1/brains/br_lea_main/draft \
  -H "Authorization: Bearer $LANACHAT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"settings": {"first_offer_after_messages": 6, "max_discount_percent": 20}}'
```

Nur die gesendeten Felder ändern sich. Das Live-Brain ändert sich erst bei der Veröffentlichung.

### Throw the draft away

`DELETE /brains/{id}/draft` · `can_engine`

```bash
curl -X DELETE https://api.lanachat.ai/v1/brains/br_lea_main/draft \
  -H "Authorization: Bearer $LANACHAT_TOKEN"
```

Der Entwurf wird gelöscht; die Live-Version bleibt unverändert und `has_draft` wird `false`.

### Publish the draft

`POST /brains/{id}/publish` · `can_publish`

```bash
curl -X POST https://api.lanachat.ai/v1/brains/br_lea_main/publish \
  -H "Authorization: Bearer $LANACHAT_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)"
```

```json
{ "id": "br_lea_main", "version": 13, "published_at": "2026-10-06T14:20:03Z", "has_draft": false }
```

Der Entwurf wird auf jedem verknüpften Account live. Veröffentlichen ohne Entwurf antwortet mit `409`. Erweiterte KI-Profile benötigen eigene Besitzerrechte, wie in der Console. Ein [webhook](https://lanachat.ai/guides/de/api-webhooks/) `brain.published` informiert Ihren Server.

## Versions

### List versions

`GET /brains/{id}/versions` · `can_engine`

```bash
curl https://api.lanachat.ai/v1/brains/br_lea_main/versions \
  -H "Authorization: Bearer $LANACHAT_TOKEN"
```

Die Antwort listet die veröffentlichten Versionen, neueste zuerst, [paginierbar](https://lanachat.ai/guides/de/api-overview/).

### Restore a version

`POST /brains/{id}/versions/{version}/restore` · `can_engine`

```bash
curl -X POST https://api.lanachat.ai/v1/brains/br_lea_main/versions/11/restore \
  -H "Authorization: Bearer $LANACHAT_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)"
```

Die alte Version wird in den Entwurf kopiert. Für Fans ändert sich nichts, bis Sie veröffentlichen. Eine unbekannte Version antwortet mit `404`.

## Playground

Der Playground spricht mit dem **Entwurf**, nie mit einem Fan. Es wird nichts an Telegram gesendet und nichts verkauft.

### Send a test message

`POST /playground/{brain_id}/message` · `can_engine`

| Parameter | Type | Required | Description |
|---|---|---|---|
| `text` | string | Ja | Was der Testfan schreibt |
| `fan` | object | Nein | Der Testfan: `language` (z. B. `en`) und `is_new` |

```bash
curl -X POST https://api.lanachat.ai/v1/playground/br_lea_main/message \
  -H "Authorization: Bearer $LANACHAT_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"text": "hey, are you real?", "fan": {"language": "en", "is_new": true}}'
```

```json
{
  "reply": { "text": "Haha very real, just slow at typing 🙈 where are you from?", "media": [] },
  "phase": "warm_up",
  "explain": "Phrase bank answer for \"Are you a bot?\", then a question to keep the fan talking."
}
```

- `reply` ist, was die KI senden würde: Text und Medien.
- `phase` ist die Verkaufsphase, in der sich die KI befindet.
- `explain` erklärt auf einfachem Englisch, warum sie so geantwortet hat.

Jeder Aufruf setzt das gleiche Testgespräch fort.

### Start the test conversation over

`DELETE /playground/{brain_id}/session` · `can_engine`

```bash
curl -X DELETE https://api.lanachat.ai/v1/playground/br_lea_main/session \
  -H "Authorization: Bearer $LANACHAT_TOKEN"
```

Die nächste Testnachricht startet ein neues Gespräch, als neuer Fan.

## Verwandte Artikel

- [LanaChat API: Schnellstart, Authentifizierung und Fehler](https://lanachat.ai/guides/de/api-overview/)
- [Was ein AI Brain ist](https://lanachat.ai/guides/de/what-is-an-ai-brain/)
- [Playground: eine Unterhaltung sicher testen](https://lanachat.ai/guides/de/playground/)
