---
title: "Create a VM"
method: POST
path: "/agent/compute/vms"
tags: ["Compute"]
---

# Create a VM

`POST /agent/compute/vms`

## Request

- Base URL: `https://edge.network`
- URL: `https://edge.network/agent/compute/vms`
- Auth: HTTP bearer

Create a VM directly. Pass ssh_key or ssh_key_ids for SSH access — or attach a key later with attachVmSshKey (never recreate a VM just to add a key). Use size, or override vcpu/ram/disk individually.

## Headers

- `X-Dry-Run` 'true' | 'false'
- `Idempotency-Key` string

## Request body

- object
  - `name` string, required
  - `os` string: OS template id from listOsTemplates.
  - `size` 'nano' | 'small' | 'medium' | 'large' | 'xlarge'
  - `vcpu` number: Override vCPU count.
  - `ram` number: Override RAM in GB.
  - `disk` number: Override disk in GB.
  - `region` string: Region id from listRegions.
  - `ssh_key` string: SSH public key string. Auto-saved and attached.
  - `ssh_key_ids` string[]
  - `script` string: Startup script id from listComputeScripts.
  - `script_params` object
  - `setup_script` string: Inline bash for first boot. Mutually exclusive with script.
  - `security_group_ids` string[]

## Response `201`

VM created. Poll getVm until status is "running" before SSHing.

- object
  - `vm` Vm, required
    - `id` string, required
    - `name` string, required
    - `status` string, required: Lifecycle status. Poll until "running" before attempting SSH.
    - `size` 'nano' | 'small' | 'medium' | 'large' | 'xlarge'
    - `vcpu` number
    - `ram` number: RAM in GB.
    - `disk` number: Disk in GB.
    - `region` string
    - `os` string
    - `network` object
      - `publicIp` string, nullable
  - `tell_user` string: Human-readable summary of what happened, for the agent to relay to its operator.

## Other responses

- `400`: Validation error — the response body explains what to fix.
- `401`: Missing or invalid agent access code. The body includes self-signup pointers.
- `429`: Rate limited. Honour Retry-After and the RateLimit-* headers before retrying.

---

[API](https://skmtc.dev/edge/apis/edge-network-agent-api.md) · [All operations](https://skmtc.dev/edge/apis/edge-network-agent-api/llms.txt) · [OpenAPI document](https://skmtc.dev/edge/apis/edge-network-agent-api/revisions/49b5f2adf020?raw)
