Freestyle VMs API

Create, snapshot, fork, suspend, resume, exec, and manage Linux microVMs designed for AI agents. VMs boot in under 600ms with restored memory snapshots, support live-forking a running VM into multiple copies in milliseconds, and can be paused after idle to $0 cost and resumed on next exec. Includes systemd service management, terminal logs/xterm-256color streams, file get/put/watch, and stats streaming.

Freestyle VMs API is one of 8 APIs that Freestyle publishes on the APIs.io network, described by a machine-readable OpenAPI specification.

This API exposes 6 machine-runnable capabilities that can be deployed as REST, MCP, or Agent Skill surfaces via Naftiko and 1 JSON Schema definition.

Tagged areas include Agents, AI, Sandboxes, VMs, and MicroVMs. The published artifact set on APIs.io includes API documentation, an OpenAPI specification, a JSON-LD context, 6 Naftiko capability specs, and 1 JSON Schema.

Documentation

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

freestyle-vm-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Freestyle VMs API
  version: 0.1.0
  description: "Manage Linux microVMs designed for AI agents \u2014 create, snapshot, fork, suspend, resume, exec, file I/O,\
    \ watch, systemd services, terminals, and resize. Real Linux VMs that start in under 600ms."
  contact:
    name: Ben
    email: [email protected]
  license:
    name: Closed Source
servers:
- url: https://api.freestyle.sh
  description: Production
tags:
- name: VM
  description: APIs for managing lightweight virtual machines (VMs) to run your code in isolated environments.
paths:
  /v1/vms:
    get:
      tags:
      - VM
      description: List VMs
      operationId: list_vms
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type:
          - integer
          - 'null'
          format: int32
          minimum: 0
      - name: offset
        in: query
        required: false
        schema:
          type:
          - integer
          - 'null'
          format: int32
          minimum: 0
      - name: vmState
        in: query
        required: false
        schema:
          oneOf:
          - type: 'null'
          - $ref: '#/components/schemas/VMState'
      - name: includeDeleted
        in: query
        required: false
        schema:
          type:
          - boolean
          - 'null'
      - name: search
        in: query
        required: false
        schema:
          type:
          - string
          - 'null'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListVmsResponse'
        '500':
          description: 'Error: InternalError'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
    post:
      tags:
      - VM
      description: Create VM
      operationId: create_vm
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateVmRequest'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateVmResponse'
  /v1/vms/builds/{build_id}:
    get:
      tags:
      - VM
      description: Fetch a single build by id.
      operationId: get_build
      parameters:
      - name: build_id
        in: path
        description: Build id
        required: true
        schema:
          $ref: '#/components/schemas/BuildId'
      responses:
        '200':
          description: Build record
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BuildRecord'
        '404':
          description: 'Possible errors: BuildNotFound, BuildNotFoundForSnapshot, BuildNotFoundForVm'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
        '500':
          description: 'Error: InternalError'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
  /v1/vms/builds/{build_id}/phases:
    get:
      tags:
      - VM
      description: Append-only timeline of phases this build passed through. Phases are ordered by started_at; the last entry
        is the current phase.
      operationId: list_build_phases
      parameters:
      - name: build_id
        in: path
        description: Build id
        required: true
        schema:
          $ref: '#/components/schemas/BuildId'
      responses:
        '200':
          description: Ordered phase timeline for a build
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListBuildPhasesResponse'
        '404':
          description: 'Possible errors: BuildNotFound, BuildNotFoundForSnapshot, BuildNotFoundForVm'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
        '500':
          description: 'Error: InternalError'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
  /v1/vms/snapshots:
    get:
      tags:
      - VM
      description: List all snapshots.
      operationId: list_snapshots
      parameters:
      - name: includeDeleted
        in: query
        required: false
        schema:
          type:
          - boolean
          - 'null'
      - name: includeFailed
        in: query
        required: false
        schema:
          type:
          - boolean
          - 'null'
      - name: includeBuilding
        in: query
        required: false
        schema:
          type:
          - boolean
          - 'null'
      responses:
        '200':
          description: List of snapshots
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListSnapshotsResponse'
        '400':
          description: 'Error: SnapshotVmBadRequest'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
        '500':
          description: 'Possible errors: SnapshotSetupFailed, FinalizeSnapshotFailed, InternalError'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
    post:
      tags:
      - VM
      description: Create a snapshot by creating a temporary VM, starting it, snapshotting it, then deleting the VM. Supports
        multi-layer recursive specs via `spec.snapshot`.
      operationId: create_snapshot
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSnapshotRequest'
        required: true
      responses:
        '200':
          description: Created snapshot
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSnapshotResponse'
  /v1/vms/snapshots/{snapshot_id}:
    get:
      tags:
      - VM
      description: "Fetch a single snapshot by id. Returns deleted/failed rows too \u2014 useful for opening a deep-link to\
        \ a layer-snapshot that's since been cleaned up."
      operationId: get_snapshot
      parameters:
      - name: snapshot_id
        in: path
        description: Snapshot id
        required: true
        schema:
          $ref: '#/components/schemas/SnapshotId'
      responses:
        '200':
          description: Snapshot record
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SnapshotInfo'
        '404':
          description: 'Error: SnapshotNotFound'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
        '500':
          description: 'Error: InternalError'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
    delete:
      tags:
      - VM
      description: Delete a snapshot
      operationId: delete_snapshot
      parameters:
      - name: snapshot_id
        in: path
        description: The ID of the snapshot to delete
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteSnapshotResponses'
        '404':
          description: 'Error: SnapshotNotFound'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
        '409':
          description: 'Possible errors: SnapshotAlreadyDeleted, SnapshotIsAccountDefault'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
        '500':
          description: 'Error: InternalError'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
    patch:
      tags:
      - VM
      description: Update snapshot metadata
      operationId: update_snapshot
      parameters:
      - name: snapshot_id
        in: path
        description: The ID of the snapshot to update
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSnapshotRequest'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateSnapshotResponses'
        '404':
          description: 'Error: SnapshotNotFound'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
        '500':
          description: 'Error: InternalError'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
  /v1/vms/{id}/resize:
    post:
      tags:
      - VM
      description: Resize VM
      operationId: resize_vm
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResizeVmRequest'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResizeVmResponse'
        '400':
          description: 'Error: InvalidParameters'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
        '404':
          description: 'Error: InternalResizeVmNotFound'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
        '500':
          description: 'Error: ResizeFailed'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
  /v1/vms/{vm_id}:
    get:
      tags:
      - VM
      description: Get VM
      operationId: get_vm
      parameters:
      - name: vm_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetVmResponse'
        '500':
          description: 'Possible errors: VmDeleted, InternalError'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
    delete:
      tags:
      - VM
      description: Delete VM
      operationId: delete_vm
      parameters:
      - name: vm_id
        in: path
        description: The ID of the VM to delete
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteVmResponses'
        '500':
          description: 'Possible errors: ClientError, CleanupError'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
  /v1/vms/{vm_id}/await:
    post:
      tags:
      - VM
      description: Wait for VM to stop
      operationId: wait_vm
      parameters:
      - name: vm_id
        in: path
        description: The ID of the VM to wait for
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WaitVmResponse'
        '500':
          description: 'Error: InternalError'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
  /v1/vms/{vm_id}/build:
    get:
      tags:
      - VM
      description: Fetch the build that produced a VM. Joins through vm_records.build_id.
      operationId: get_build_for_vm
      parameters:
      - name: vm_id
        in: path
        description: VM id
        required: true
        schema:
          $ref: '#/components/schemas/VmId'
      responses:
        '200':
          description: Build that produced this VM
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BuildRecord'
        '404':
          description: 'Possible errors: BuildNotFound, BuildNotFoundForSnapshot, BuildNotFoundForVm'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
        '500':
          description: 'Error: InternalError'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
  /v1/vms/{vm_id}/exec-await:
    post:
      tags:
      - VM
      description: Execute command in VM and await result
      operationId: exec_await
      parameters:
      - name: vm_id
        in: path
        description: The ID of the VM to execute the command in
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExecAwaitRequest'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExecAwaitVmResponse'
        '408':
          description: 'Error: ExecTimedOut'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
        '500':
          description: 'Error: InternalError'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
  /v1/vms/{vm_id}/files/{filepath}:
    get:
      tags:
      - VM
      description: Get file from VM
      operationId: get_file
      parameters:
      - name: vm_id
        in: path
        description: The ID of the VM to get the file from
        required: true
        schema:
          type: string
      - name: filepath
        in: path
        description: The path of the file to get
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileSystemResponse'
        '400':
          description: 'Error: FilesBadRequest'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
        '404':
          description: 'Error: FileNotFound'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
        '500':
          description: 'Error: InternalError'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
    put:
      tags:
      - VM
      description: Put file to VM
      operationId: put_file
      parameters:
      - name: vm_id
        in: path
        description: The ID of the VM to put the file to
        required: true
        schema:
          type: string
      - name: filepath
        in: path
        description: The path of the file to put
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WriteFileRequest'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WriteFileResponse'
        '400':
          description: 'Error: FilesBadRequest'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
        '404':
          description: 'Error: FileNotFound'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
        '500':
          description: 'Error: InternalError'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
  /v1/vms/{vm_id}/fork:
    post:
      tags:
      - VM
      description: Fork VM
      operationId: fork_vm
      parameters:
      - name: vm_id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ForkVmRequest'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForkVmResponse'
        '403':
          description: 'Error: AccessDenied'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
        '500':
          description: 'Error: FailedToPreRegister'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
  /v1/vms/{vm_id}/kill:
    post:
      tags:
      - VM
      description: Kill VM
      operationId: kill_vm
      parameters:
      - name: vm_id
        in: path
        description: The ID of the VM to kill
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KillVmResponse'
        '500':
          description: 'Possible errors: InternalError, NotVmOwner'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
  /v1/vms/{vm_id}/optimize:
    post:
      tags:
      - VM
      description: Suspends a VM and reallocates storage for more efficient forking.
      operationId: optimize_vm
      parameters:
      - name: vm_id
        in: path
        description: The ID of the VM to optimize
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OptimizeVmResponse'
        '500':
          description: 'Error: InternalError'
          content:
            application/json:
              schema:
                type: object
                required:
                - error
                - message
                properties:
                  error:
                    type: string
                    description: Error code in SCREAMING_SNAKE_CASE
                  message:
                    type: string
                    description: Human-readable error message
  /v1/vms/{vm_id}/snapshot:
    post:
      tags:
      - VM
      description: Create a snapshot of a VM. The snapshot is stored in a special snapshots folder and cannot be booted directly,
        but can be used to create new VMs.
      operationId: snapshot_vm
      parameters:
      - name: vm_id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SnapshotVmRequest'
        required: true
      responses:
        '200':
          description: Created snapshot
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SnapshotVmResponse'
  /v1/vms/{vm_id}/start:
    post:
      tags:
      - VM
      description: Start VM
      operationId: start_vm
      parameters:
      - name: vm_id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StartVmRequest'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StartedVmResponse'
  /v1/vms/{vm_id}/stats/stream:
    get:
      tags:
      - VM
      description: "Stream live VM stats (memory + CPU) as NDJSON. Sourced from inside the guest \u2014 untrusted, do not\
        \ use for billing."
      operationId: stats_stream
      parameters:
      - name: vm_id
        in: path
        description: The ID of the VM to stream stats for
        required: true
        schema:
          type: string
      - name: interval_ms
        in: query
        description: Sample interval in ms (default 1000, clamped 100-10000)
        required: false
        schema:
          type: integer
          format: int64
          minimum: 0
      responses: {}
  /v1/vms/{vm_id}/stop:
    post:
      tags:
      - VM
      description: Stop VM
      operationId: stop_vm
      parameters:
      - name: vm_id
        in: path
        description: The ID of the VM to stop
        requ

# --- truncated at 32 KB (106 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/freestyle-sh/refs/heads/main/openapi/freestyle-vm-api-openapi.yml