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

> Despliega un chat en producción

Despliega un chat en producción. Inicia un despliegue en Vercel y responde de inmediato.

## Solicitud

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

### Encabezados

| Encabezado | Obligatorio | Descripción |
| - | - | - |
| `Authorization` | Sí | `Bearer macaly_...` |

### Parámetros de ruta

| Parámetro | Tipo | Descripción |
| - | - | - |
| `chatId` | string | El ID del chat que se va a desplegar |

### Solicitud de ejemplo

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

## Respuesta

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

### Campos de respuesta

| Campo | Tipo | Descripción |
| - | - | - |
| `id` | string | ID del despliegue en la base de datos |
| `url` | string | La URL del despliegue |
| `status` | `"QUEUED"` \| `"BUILDING"` | Estado inicial |
| `deploymentId` | string | ID del despliegue en Vercel |

## Códigos de estado

| Código | Descripción |
| - | - |
| 200 | Despliegue iniciado |
| 400 | Solicitud no válida (por ejemplo, el chat no tiene mensajes) |
| 401 | Clave API no válida o ausente |
| 403 | Sin permiso para desplegar o el chat no pertenece al equipo |
| 404 | Chat no encontrado |
| 500 | Error interno del servidor |

## Notas

<Info>
  Este endpoint responde de inmediato tras iniciar el despliegue. El despliegue se ejecuta de forma asíncrona en Vercel.
</Info>

* Usa [`GET /api/chat/{chatId}/deployment`](/docs/es/api/get-deployment) con `deploymentId` igual al `id` devuelto para consultar cuándo termina
* Requiere el permiso `hosting.publish_macaly`

## Siguientes pasos

Después de iniciar un despliegue:

1. **Consulta el estado** con [`GET /api/chat/{chatId}/deployment`](/docs/es/api/get-deployment), pasando como `deploymentId` el `id` devuelto
2. Espera a que `status` pase a `READY`


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