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

# Bericht publiceren

> Stuur een nieuw bericht naar een bestaande chat om het gesprek voort te zetten

Stuurt een nieuw bericht naar een bestaande chat, waarmee het gesprek wordt voortgezet.

## Verzoek

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

### Headers

| Header          | Vereist | Beschrijving        |
| --------------- | ------- | ------------------- |
| `Authorization` | Ja      | `Bearer macaly_...` |
| `Content-Type`  | Ja      | `application/json`  |

### Padparameters

| Parameter | Type   | Beschrijving |
| --------- | ------ | ------------ |
| `chatId`  | string | De chat-ID   |

### Bodyparameters

| Veld                       | Type                                                             | Vereist        | Standaard | Beschrijving                                                                 |
| -------------------------- | ---------------------------------------------------------------- | -------------- | --------- | ---------------------------------------------------------------------------- |
| `content`                  | string                                                           | Voorwaardelijk | -         | Het bericht van de gebruiker. Vereist tenzij `resume` `true` is              |
| `stream`                   | boolean                                                          | Nee            | `true`    | Als `false`, retourneert JSON in plaats van een stream                       |
| `agentMode`                | `"auto"` \| `"fast"` \| `"smart"`                                | Nee            | `"auto"`  | Bepaalt de snelheid/kwaliteitsafweging van de AI-agent                       |
| `executionMode`            | `"auto"` \| `"planning"` \| `"build"`                            | Nee            | `"auto"`  | Bepaalt hoe de AI de taak benadert                                           |
| `model`                    | `"sonnet-4-5"` \| `"sonnet-4-6"` \| `"opus-4-5"` \| `"opus-4-6"` | Nee            | -         | AI-model om te gebruiken. Standaard het geconfigureerde model van het team   |
| `reasoningEffort`          | `"medium"` \| `"high"`                                           | Nee            | -         | Bepaalt hoe diep de AI nadenkt over de taak                                  |
| `resume`                   | boolean                                                          | Nee            | `false`   | Als `true`, hervat een gestopt gesprek zonder nieuwe inhoud toe te voegen    |
| `experimental_attachments` | array                                                            | Nee            | `[]`      | Bestandsbijlagen (zie [Chat aanmaken](/docs/nl/api/create-chat) voor het formaat) |

<Note>
  Wanneer `resume` `true` is, kunt u geen `content` of `experimental_attachments` meesturen. Dit wordt gebruikt om een eerder gestopt gesprek te hervatten.
</Note>

### Voorbeeldverzoek

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

## Respons

### JSON-respons (bij `stream: false`)

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

U kunt vervolgens het endpoint [Status ophalen](/docs/nl/api/get-status) opvragen om te wachten tot de verwerking is voltooid.

### Streamingrespons (bij `stream: true`, standaard)

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

## Statuscodes

| Status | Beschrijving                                                                 |
| ------ | ---------------------------------------------------------------------------- |
| 200    | Succes - Bericht verzonden                                                   |
| 400    | Ongeldig verzoek                                                             |
| 401    | Ongeldige of ontbrekende API-sleutel                                         |
| 402    | Onvoldoende credits                                                          |
| 403    | Chat behoort niet tot dit team                                               |
| 404    | Chat niet gevonden                                                           |
| 429    | Limiet bereikt                                                               |
| 500    | Serverfout                                                                   |
| 503    | Service niet beschikbaar - De AI-werkruimte is bezig, probeer het zo opnieuw |

## Workflow

Voor gebruik zonder streaming is de typische workflow:

1. **Stuur een bericht** met `stream: false`
2. **Controleer de status** met [`GET /api/chat/{chatId}/status`](/docs/nl/api/get-status) tot `completed`
3. **Herhaal** voor extra berichten
