---
title: "Update multiple instances"
method: PATCH
path: "/preview/v2/instances"
tags: ["Instances"]
---

# Update multiple instances

`PATCH /preview/v2/instances`

> ⚠️ This endpoint is in [public preview](/preview/roadmap).

Update one or more instances atomically. All listed instances must be in the same workspace; mixed-workspace batches are rejected with 422.

## Request body

- BatchPatchInstancesRequest — Request body for `PATCH /v2/instances` (batch). Each entry in `data` applies a partial patch to one instance; instances not mentioned are untouched. All entries must succeed or none — a single failure rolls back every other entry's writes (422). When the same `id` appears more than once in `data`, the last occurrence wins.
  - `data` BatchPatchInstanceEntry[], required
    - `id` union, required — Accepts the canonical prefix below; additional legacy prefixes are aliased for read compatibility. Writes always emit the canonical form.
      - string
      - string — Legacy alias prefix; accepted on read, never emitted on write.
    - `priority_level` 'yield' | 'normal' | 'preferred' | 'critical', required — Instance priority — a relative ranking that determines which instances the system prefers to keep running when capacity is constrained. When a capacity's quota drops below its running-instance count, instances are terminated in priority order (lower first). Ordering: `yield < normal < preferred < critical`.

## Response `200`

Instances updated.

- BatchPatchInstancesResponse — Response shape for `PATCH /v2/instances` (batch). Mirrors the input list — one `InstanceResponse` per *unique* `id` in the request body, reflecting the post-write state. Unlike the paginated list response, there's no `cursor` or `has_more`: the response is exactly the instances the caller mentioned, no pagination involved.
  - `object` 'list', required
  - `data` InstanceResponse[], required
    - `id` union, required — Accepts the canonical prefix below; additional legacy prefixes are aliased for read compatibility. Writes always emit the canonical form.
      - string
      - string — Legacy alias prefix; accepted on read, never emitted on write.
    - `resource_path` string, required — A resource path for a instance resource. Format: sfc:instance:<account>:<workspace>:<name>.
    - `owner` string, required
    - `workspace` string, required
    - `workspace_id` string, required
    - `name` string, required
    - `object` 'instance', required
    - `status` 'awaiting_allocation' | 'running' | 'terminated' | 'failed', required — `awaiting_allocation` when waiting for compute allocation on its capacity, `running` once assigned and the physical machine is running (still takes time for the image to be downloaded and booted), `terminated` when stopped by the user or after running out of allocation, `failed` on hardware fault. Values are not exhaustive across API versions. Clients should tolerate new statuses.
    - `instance_sku` InstanceSkuSummary, required — A summary of an instance SKU - its `id` and human-recognizable `alias` - embedded on resources that reference a SKU.
      - `object` 'instance_sku', required
      - `id` union, required — Accepts the canonical prefix below; additional legacy prefixes are aliased for read compatibility. Writes always emit the canonical form.
        - string
        - string — Legacy alias prefix; accepted on read, never emitted on write.
      - `alias` string, required
    - `capacity` CapacitySummary, required
      - `id` union, required — Accepts the canonical prefix below; additional legacy prefixes are aliased for read compatibility. Writes always emit the canonical form.
        - string
        - string — Legacy alias prefix; accepted on read, never emitted on write.
      - `name` string, required
    - `pool` PoolSummary, required — A pool referenced by id and name.
      - `id` string, required
      - `name` string, required
    - `created_at` integer, required — Unix timestamp.
    - `updated_at` integer, required — Unix timestamp.
    - `image` ImageSummary, required
      - `id` union, required — Accepts the canonical prefix below; additional legacy prefixes are aliased for read compatibility. Writes always emit the canonical form.
        - string
        - string — Legacy alias prefix; accepted on read, never emitted on write.
      - `name` string, required
    - `managed_by` union
      - object
        - `id` string, required
        - `name` string, required
        - `object` 'deployment', required
      - object
        - `id` string, required
        - `name` string, required
        - `object` 'spot_deployment', required
    - `cloud_init_user_data_used` boolean, required — Whether cloud-init user data is configured for this instance.
    - `cloud_init_user_data` string, byte — Base64-encoded [cloud-init user data](https://cloudinit.readthedocs.io/en/latest/explanation/format/index.html).
    - `enable_public_ipv4` boolean — Whether this instance requires a public IPv4 address. When `false`, only SSH (TCP port 22) is open on the instance and no other ports accept inbound traffic.
    - `public_ip` string — Public IPv4 address assigned to this instance. Present only when `enable_public_ipv4 = true`; omitted otherwise.
    - `firewall` string
    - `tags` Tags
    - `expected_shutdown_at` integer — Unix timestamp.
    - `priority_level` 'yield' | 'normal' | 'preferred' | 'critical' — Instance priority — a relative ranking that determines which instances the system prefers to keep running when capacity is constrained. When a capacity's quota drops below its running-instance count, instances are terminated in priority order (lower first). Ordering: `yield < normal < preferred < critical`.

## Other responses

- `401` — Unauthorized.
- `403` — Forbidden.
- `422` — Unknown instance, cross-workspace batch, or batch over the entry cap.
- `500` — Internal server error.

---

[API](https://skmtc.dev/sfcompute/apis/sfc-api.md) · [All operations](https://skmtc.dev/sfcompute/apis/sfc-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/sfcompute/sfc-api/revisions/f3ff1539c0d9/schema)
