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

# Publish message

> Sende eine neue Nachricht an einen bestehenden Chat, um die Unterhaltung fortzusetzen

Sendet eine neue Nachricht an einen bestehenden Chat und setzt die Unterhaltung fort.

## Anfrage

```
POST /api/chat/{chatId}/publish
```

### Header

| Header | Erforderlich | Beschreibung |
| - | - | - |
| `Authorization` | Ja | `Bearer macaly_...` |
| `Content-Type` | Ja | `application/json` |

### Pfadparameter

| Parameter | Typ | Beschreibung |
| - | - | - |
| `chatId` | string | Die Chat-ID |

### Anfrage-Body-Parameter

| Feld | Typ | Erforderlich | Standardwert | Beschreibung |
| - | - | - | - | - |
| `content` | string | Bedingt | - | Die Nachricht des Nutzers. Erforderlich, außer wenn `resume` auf `true` steht |
| `stream` | boolean | Nein | `true` | Bei `false` wird JSON statt eines Streams zurückgegeben |
| `agentMode` | `"auto"` \| `"fast"` \| `"smart"` | Nein | `"auto"` | Bestimmt den Kompromiss zwischen Geschwindigkeit und Qualität des KI-Agenten |
| `executionMode` | `"auto"` \| `"planning"` \| `"build"` | Nein | `"auto"` | Bestimmt, wie die KI die Aufgabe angeht |
| `model` | `"gpt-5.6-terra"` \| `"gpt-6.1-sol"` \| `"gpt-6-luna"` \| `"grok-4-6"` \| `"kimi-k3"` \| `"sonnet-5-5"` \| `"opus-5-5"` \| `"blueai-glm-5-3"` \| `"blueai-glm-5-3-flash"` | Nein | - | Zu verwendendes KI-Modell. Standardmäßig das konfigurierte Modell des Teams |
| `reasoningEffort` | `"medium"` \| `"high"` | Nein | - | Bestimmt, wie tief die KI über die Aufgabe nachdenkt |
| `resume` | boolean | Nein | `false` | Bei `true` wird eine gestoppte Unterhaltung fortgesetzt, ohne neuen Inhalt hinzuzufügen |
| `experimental_attachments` | array | Nein | `[]` | Dateianhänge (Format siehe [Create Chat](/docs/de/api/create-chat)) |

<Note>
  Wenn `resume` auf `true` steht, dürfen `content` und `experimental_attachments` nicht mitgeschickt werden. Damit wird eine zuvor gestoppte Unterhaltung fortgesetzt.
</Note>

### Beispielanfrage

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://www.macaly.com/api/chat/abc123def456/publish" \
    -H "Authorization: Bearer macaly_abc123..." \
    -H "Content-Type: application/json" \
    -d '{
      "content": "Add a dark mode toggle to the header",
      "stream": false
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    `https://www.macaly.com/api/chat/${chatId}/publish`,
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer macaly_abc123...',
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        content: 'Add a dark mode toggle to the header',
        stream: false,
      }),
    }
  );

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      f'https://www.macaly.com/api/chat/{chat_id}/publish',
      headers={
          'Authorization': 'Bearer macaly_abc123...',
          'Content-Type': 'application/json',
      },
      json={
          'content': 'Add a dark mode toggle to the header',
          'stream': False,
      },
  )

  data = response.json()
  ```
</CodeGroup>

## Antwort

### JSON-Antwort (bei `stream: false`)

```json theme={null}
{
  "chatId": "abc123def456",
  "streamId": "stream_xyz789",
  "assistantMessageId": "msg_123"
}
```

Anschließend kannst du den Fortschritt über den [Get Status](/docs/de/api/get-status)-Endpoint verfolgen, um auf den Abschluss zu warten.

### Streaming-Antwort (bei `stream: true`, Standard)

```
2:[{"chatId":"abc123def456"}]
0:"Analyzing your request..."
...
```

## Statuscodes

| Status | Beschreibung |
| - | - |
| 200 | Erfolgreich - Nachricht gesendet |
| 400 | Ungültiger Anfrage-Body |
| 401 | Ungültiger oder fehlender API-Schlüssel |
| 402 | Nicht genügend Credits |
| 403 | Chat gehört nicht zu diesem Team |
| 404 | Chat nicht gefunden |
| 429 | Anfragelimit erreicht |
| 500 | Serverfehler |
| 503 | Dienst nicht verfügbar - Der KI-Workspace ist ausgelastet, versuche es in Kürze erneut |

## Verarbeitung

Für die Nutzung ohne Streaming sieht der typische Ablauf so aus:

1. **Nachricht senden** mit `stream: false`
2. **Status verfolgen** über [`GET /api/chat/{chatId}/status`](/docs/de/api/get-status), bis `completed` erreicht ist
3. **Wiederholen** für weitere Nachrichten


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.