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

# Implementeren

> Implementeer een chat in productie

Implementeert een chat in productie. Start een implementatie op Vercel en retourneert onmiddellijk.

## Verzoek

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

### Headers

| Header          | Vereist | Beschrijving        |
| --------------- | ------- | ------------------- |
| `Authorization` | Ja      | `Bearer macaly_...` |

### Padparameters

| Parameter | Type   | Beschrijving                   |
| --------- | ------ | ------------------------------ |
| `chatId`  | string | De chat-ID om te implementeren |

### Voorbeeldverzoek

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://www.macaly.com/api/chat/abc123/deploy \
    -H "Authorization: Bearer macaly_abc123..."
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    `https://www.macaly.com/api/chat/${chatId}/deploy`,
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer macaly_abc123...',
      },
    }
  );

  const data = await response.json();
  console.log(data.url);
  ```

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

  response = requests.post(
      f'https://www.macaly.com/api/chat/{chat_id}/deploy',
      headers={
          'Authorization': 'Bearer macaly_abc123...',
      },
  )

  data = response.json()
  print(data['url'])
  ```
</CodeGroup>

## Respons

```json theme={null}
{
  "id": "jzga0sttml37v6mbizb8tk1x",
  "url": "https://macaly-staging-abc123.macaly.app",
  "status": "QUEUED",
  "deploymentId": "dpl_HKLBd2QDTwq58AMUJiaMyUzk8WUw"
}
```

### Responsvelden

| Veld           | Type                       | Beschrijving              |
| -------------- | -------------------------- | ------------------------- |
| `id`           | string                     | Database-implementatie-ID |
| `url`          | string                     | De implementatie-URL      |
| `status`       | `"QUEUED"` \| `"BUILDING"` | Initiële status           |
| `deploymentId` | string                     | Vercel-implementatie-ID   |

## Statuscodes

| Status | Beschrijving                                                           |
| ------ | ---------------------------------------------------------------------- |
| 200    | Implementatie gestart                                                  |
| 400    | Ongeldig verzoek (bijv. geen berichten in de chat)                     |
| 401    | Ongeldige of ontbrekende API-sleutel                                   |
| 403    | Geen toestemming om te implementeren OF chat behoort niet tot het team |
| 404    | Chat niet gevonden                                                     |
| 500    | Interne serverfout                                                     |

## Opmerkingen

<Info>
  Dit endpoint retourneert onmiddellijk na het starten van de implementatie. De implementatie vindt asynchroon plaats op Vercel.
</Info>

* Gebruik [`GET /api/chat/{chatId}/deployment`](/docs/nl/api/get-deployment) om de voortgang te volgen
* Vereist de `hosting.publish_macaly`-toestemming

## Volgende stappen

Na het starten van een implementatie:

1. **Volg de voortgang** met [`GET /api/chat/{chatId}/deployment`](/docs/nl/api/get-deployment)
2. Wacht tot de `status` `READY` wordt
