Back to Blog
Engineering

Emily Watson8 min
Ctrl+A

Building automated agents that interact with real desktops, browsers, or terminals often requires a persistent environment. Spin up a fresh VM, install the browser, open the app, and you are ready to run. The /v1/machines endpoint lets you provision a cloud machine on demand, get a machine_id, and start driving it with a computer use agent. No manual setup, no long-lived AWS/GCP consoles. You just call the API to create the environment, then use it with task runs or sessions.

How it works

You send a POST to /v1/machines with a JSON payload. The response contains basic machine metadata including the machine_id you use in subsequent calls. The endpoint provisions a cloud VM with a desktop environment. You can then use that machine_id when you submit a task run or a session. The server handles the lifecycle, and you get a stable identifier to target the same environment across requests.

bash
#!/bin/bash

# Load the API key from the environment
export COASTY_API_KEY="${COASTY_API_KEY}"

# Provision a cloud machine on demand
# Base URL
BASE_URL="https://coasty.ai/v1"

# Create the machine
response=$(curl -s -X POST "${BASE_URL}/machines" \
  -H "X-API-Key: ${COASTY_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{}')

# Extract machine_id (adjust key name if the API docs differ)
machine_id=$(echo "$response" | jq -r '.machine_id')

if [[ "$machine_id" == "null" ]] || [[ -z "$machine_id" ]]; then
  echo "Failed to get machine_id from response: $response"
  exit 1
fi

echo "Provisioned machine_id: ${machine_id}"

# Example: use the machine_id in a task run
# POST /v1/runs with machine_id in the payload
curl -s -X POST "${BASE_URL}/runs" \
  -H "X-API-Key: ${COASTY_API_KEY}" \
  -H "Content-Type: application/json" \
  -d "{
    \"machine_id\": \"${machine_id}\",
    \"task\": \"Open https://example.com and take a screenshot.\",
    \"cua_version\": \"v3\"
  }"

Machine lifecycle

  • POST /v1/machines provisions a cloud VM and returns machine_id.
  • You can use the machine_id in subsequent task runs or sessions.
  • The server manages the underlying cloud infrastructure.
  • There is no per-VM billing surface exposed in the facts, but task steps are billed at $0.05 each.
  • You can stop or resume the machine through the runs API once you have a running task.

Use machine_id from /v1/machines as the target machine for your task runs.

Where this beats brittle automation

Traditional automation often leans on brittle selectors, hardcoded IDs, or APIs that may change. Browser extensions and APIs can break with layout shifts or new UI elements. Coasty's computer use agent sees the screen and acts like a human, so it works even when selectors are fragile. Provisioning a fresh machine on demand lets you run each task in a clean environment without polluting your own infrastructure or risking state leakage.

Start provisioning cloud machines on demand with the /v1/machines API. Spin up desktop environments, then drive them with a computer use agent. Get your API key at https://coasty.ai/developers and try it in your next automation project.

© 2026 Coasty

Backed byYCombinator