Tutorial

Provision Cloud Machines on Demand with the /v1/machines API

Priya Patel||6 min
Ctrl+S

Most auto-automation tools run against web APIs or static selectors. When an app changes its UI, scripts break. The Coasty computer use API lets you provision real cloud machines, then drive them with an agent that sees the screen and acts like a human. Use the /v1/machines endpoint to create, start, stop, and snapshot cloud VMs on demand. Your agent can then log into apps, fill forms, and navigate complex interfaces without brittle selectors.

How it works

You call POST /v1/machines to provision a cloud VM. The API returns a machine resource with an id, status (pending, running, stopped, etc.), and connection details. Start the machine with the start action, then use the session or run endpoints to send instructions. The agent drives the real desktop, browser, or terminal. When you are done, stop or snapshot the machine to save its state.

bash
curl -X POST https://coasty.ai/v1/machines \
  -H 'X-API-Key: $COASTY_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "machine_name": "demo-desktop",
    "os_type": "linux",
    "memory_gb": 4,
    "cpu_count": 2
  }'

# Example response
{
  "id": "mach_abc123",
  "machine_name": "demo-desktop",
  "os_type": "linux",
  "memory_gb": 4,
  "cpu_count": 2,
  "status": "pending",
  "created_at": "2024-05-10T12:00:00Z",
  "updated_at": "2024-05-10T12:00:00Z"
}

Key fields and actions

  • machine_name: optional, human-readable identifier for the VM.
  • os_type: linux, windows, or mac (supported by your account).
  • memory_gb: memory size in gigabytes, must meet plan requirements.
  • cpu_count: number of CPUs, limited by your plan.
  • status: pending, running, stopped, or error.
  • Start the machine via a dedicated start endpoint (e.g., POST /v1/machines/{id}/start).
  • Stop the machine via POST /v1/machines/{id}/stop.
  • Snapshot the machine via POST /v1/machines/{id}/snapshot to save state.

POST /v1/machines to provision, then POST /v1/machines/{id}/start to boot the desktop for your agent to drive.

Where this beats brittle automation

Traditional automation relies on fixed selectors like class names or element IDs. When a product redesigns those classes, your scripts fail. With a computer use agent running on a real machine, the agent sees the current UI and adapts its actions. It can click buttons by their visible label, fill text fields, and navigate menus just as a human would. This works across web apps, desktop apps, and terminals without brittle selectors. You also get a persistent machine state to resume work later.

What to build next

Provision a cloud desktop, start it, then use the computer use agent to automate a multi-step workflow like filling out a SaaS signup form or deploying a small app. Explore the session and run endpoints to send instructions, monitor progress, and handle errors. Get your API key at https://coasty.ai/developers and start driving real machines with your agent.

Want to see this in action?

View Case Studies
Try Coasty Free