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

# Deploy

> Deploye einen Chat in der Produktion

Deploye einen Chat in der Produktion. Startet ein Deployment auf Vercel und antwortet sofort.

## Anfrage

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

### Header

| Header | Erforderlich | Beschreibung |
| - | - | - |
| `Authorization` | Ja | `Bearer macaly_...` |

### Pfadparameter

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

### Beispielanfrage

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

## Antwort

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

### Antwortfelder

| Feld | Typ | Beschreibung |
| - | - | - |
| `id` | string | Datenbank-ID des Deployments |
| `url` | string | Die Deployment-URL |
| `status` | `"QUEUED"` \| `"BUILDING"` | Anfangsstatus |
| `deploymentId` | string | Vercel-Deployment-ID |

## Statuscodes

| Status | Beschreibung |
| - | - |
| 200 | Deployment gestartet |
| 400 | Ungültige Anfrage (z. B. keine Nachrichten im Chat) |
| 401 | Ungültiger oder fehlender API-Schlüssel |
| 403 | Zugriff verweigert - Keine Berechtigung zum Deployen ODER Chat gehört nicht zum Team |
| 404 | Chat nicht gefunden |
| 500 | Serverfehler |

## Hinweise

<Info>
  Dieser Endpoint antwortet sofort nach dem Start des Deployments. Das Deployment läuft asynchron auf Vercel ab.
</Info>

* Nutze [`GET /api/chat/{chatId}/deployment`](/docs/de/api/get-deployment) und setze `deploymentId` auf die zurückgegebene `id`, um den Fortschritt zu verfolgen
* Erfordert die Berechtigung `hosting.publish_macaly`

## Nächste Schritte

Nach dem Starten eines Deployments:

1. **Verfolge den Fortschritt** über [`GET /api/chat/{chatId}/deployment`](/docs/de/api/get-deployment) und setze dabei `deploymentId` auf die zurückgegebene `id`
2. Warte, bis `status` auf `READY` wechselt


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