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

# Run Deploy

> Start a deployment and stream progress events

Runs `runtm deploy` inside the session sandbox and streams NDJSON progress events via Server-Sent Events. Each event includes a `phase` and `status` field tracking deployment progress through validation, artifact creation, upload, and deployment.

**Required scope:** `deployments:write`

## Path Parameters

**session\_id** `string` *required*

The session ID (UUID).

## Headers

**Authorization** `string` *required*

Bearer token. Example: `Bearer runtm_xxx`

**X-Organization-Id** `string`

Scope to an organization.

## Query Parameters

**tier** `string` (default: starter)

Machine tier for the deployment. Values: `starter`, `performance`, `pro`. Must be in your plan's allowed tiers.

## Response

Returns a `text/event-stream` with NDJSON events. Each line is prefixed with `data: ` and contains a JSON object.

**phase** `string`

Current deployment phase: `validate`, `artifact`, `upload`, `deploy`, `discovery`.

**status** `string`

Phase status: `running`, `passed`, `complete`, `ready`, `failed`, `needs_metadata`.

**error** `string`

Error message when `status` is `failed`.

**deployment\_id** `string`

Deployment ID, present when status is `ready`.

```bash cURL theme={null}
curl -N "https://app.runtm.com/api/cloud/sessions/550e8400-e29b-41d4-a716-446655440000/deploy/run?tier=starter" \
  -X POST \
  -H "Authorization: Bearer runtm_xxx"
```

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

response = requests.post(
    "https://app.runtm.com/api/cloud/sessions/550e8400-e29b-41d4-a716-446655440000/deploy/run",
    headers={"Authorization": "Bearer runtm_xxx"},
    params={"tier": "starter"},
    stream=True,
)

for line in response.iter_lines():
    if line:
        text = line.decode("utf-8")
        if text.startswith("data: "):
            import json
            event = json.loads(text[6:])
            print(f"[{event['phase']}] {event['status']}")
```

```javascript JavaScript theme={null}
const response = await fetch(
  "https://app.runtm.com/api/cloud/sessions/550e8400-e29b-41d4-a716-446655440000/deploy/run?tier=starter",
  {
    method: "POST",
    headers: {
      "Authorization": "Bearer runtm_xxx",
    },
  }
);

const reader = response.body.getReader();
const decoder = new TextDecoder();

while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  const text = decoder.decode(value);
  for (const line of text.split("\n")) {
    if (line.startsWith("data: ")) {
      const event = JSON.parse(line.slice(6));
      console.log(`[${event.phase}] ${event.status}`);
    }
  }
}
```

```json 200 theme={null}
{"phase": "validate", "status": "running"}
{"phase": "validate", "status": "passed"}
{"phase": "artifact", "status": "running"}
{"phase": "artifact", "status": "complete"}
{"phase": "upload", "status": "running"}
{"phase": "upload", "status": "complete"}
{"phase": "deploy", "status": "running"}
{"phase": "deploy", "status": "ready", "deployment_id": "dep_abc123", "url": "https://my-app.runtm.app"}
```


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