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

# Deployments API

> Trigger deployments, read status, and stream logs

## Overview

You use the Deployments API to trigger deploys, check status, list deployments, and stream build/runtime logs.

All deployment routes require `Authorization: Bearer <access_token>`.

## Endpoints

### POST /deployments

Triggers a deployment for a project.

* Body fields:
* `projectId` (required)

Expected response includes:

* `deploymentId`
* `workflowName`

### GET /deployments

Returns deployments visible to the current backend context.

### GET /deployments/:id

Returns deployment details by ID.

### GET /deployments/:id/status

Synchronizes deployment state with Argo and returns status details.

Common status values:

* `QUEUED`
* `BUILDING`
* `PROVISIONING`
* `CONFIGURING_DNS`
* `LIVE`
* `FAILED`
* `CANCELLED`

Response can include:

* `status`
* `steps` with step names (`BUILD`, `PROVISION`, `DNS`) and statuses (`PENDING`, `RUNNING`, `SUCCEEDED`, `FAILED`, `SKIPPED`)
* `deployedUrl`
* `errorMessage`
* `buildDuration`
* `region`

### GET /deployments/:id/logs

Streams logs using Server-Sent Events.

* Content type: `text/event-stream`
* Optional query parameters:
* `since` (ISO timestamp)
* `after` (log cursor, only when `since` is not used)

Stream event examples:

```text theme={null}
data: {"type":"ready"}

data: {"type":"log","timestamp":"...","message":"Build started"}

data: {"type":"error","message":"Failed to stream logs"}

data: {"type":"done"}
```

### DELETE /deployments/:id

Deletes a deployment.

## Polling and streaming pattern

Use this pattern for deployment UX:

1. Trigger with `POST /deployments`.
2. Poll `GET /deployments/:id/status` for status badges and step states.
3. Open `GET /deployments/:id/logs` for real-time logs.
