---
title: REST API Reference
description: Reference for the /cmd REST endpoint of the Computer Server.
---

# REST API Reference

The Computer Server exposes a single REST endpoint for command execution:

- `http://localhost:8000/cmd`
- `https://your-container.containers.cloud.trycua.com:8443/cmd` (cloud)

## POST /cmd

- Accepts commands as JSON in the request body
- Returns results as a streaming response (text/event-stream)

### Request Format

```json
{
  "command": "<command_name>",
  "params": { ... }
}
```

### Required Headers (for cloud containers)

- `X-Container-Name`: Name of the container (cloud only)
- `X-API-Key`: API key for authentication (cloud only)

### Example Request (Python)

```python
import requests

url = "http://localhost:8000/cmd"
body = {"command": "screenshot", "params": {}}
resp = requests.post(url, json=body)
print(resp.text)
```

### Example Request (Cloud)

```python
import requests

url = "https://your-container.containers.cloud.trycua.com:8443/cmd"
headers = {
    "X-Container-Name": "your-container",
    "X-API-Key": "your-api-key"
}
body = {"command": "screenshot", "params": {}}
resp = requests.post(url, json=body, headers=headers)
print(resp.text)
```

### Response Format

Streaming text/event-stream with JSON objects, e.g.:

```
data: {"success": true, "content": "..."}

data: {"success": false, "error": "..."}
```

### Supported Commands

See [Commands Reference](./Commands) for the full list of commands and parameters.
