---
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

- SfcApiBatchPatchInstancesRequest — 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). Duplicate `id` entries are not deduplicated by serde; the handler runs the patches in order, so the last write wins.
  - `data` SfcApiBatchPatchInstanceEntry[], required
    - `id` string, required
    - `priority` integer, required — Shutdown priority. Higher numbers are kept longer.

## Response `200`

Instances updated.

- SfcApiBatchPatchInstancesResponse — 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` SfcApiInstanceResponse[], required
    - `id` string, required
    - `resource_path` string, required — A resource path for a instance resource. Format: sfc:instance:<account>:<workspace>:<name>.
    - `owner` string, required
    - `workspace` 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.
    - `instance_sku` SfcApiInstanceSkuSummary — Summary view of an instance SKU embedded on responses that reference one (orders, procurements, instances, capacity transfers). Carries both the id and the human-readable name. Legacy SKUs whose `name` column hasn't been backfilled use `UNKNOWN_INSTANCE_SKU_NAME` as a placeholder so this field is always populated on the wire.
      - `id` string, required
      - `name` string, required
    - `capacity` SfcApiCapacitySummary, required
      - `id` string, required
      - `name` string, required
    - `created_at` integer, required — Unix timestamp.
    - `image` SfcApiImageSummary, required
      - `id` string, required
      - `name` string, required
    - `deployment` SfcApiDeploymentSummary
      - `id` string, required
      - `name` string, 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).
    - `tags` SfcApiTags
    - `expected_shutdown_at` integer — Unix timestamp.
    - `priority` integer, required — Shutdown priority. Higher numbers are kept longer when the capacity's quota drops below the running-instance count. Default 0; any signed 64-bit integer is accepted.

## Other responses

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

---

[API](https://skmtc.net/sfcompute/apis/san-francisco-compute-documentation.md) · [All operations](https://skmtc.net/sfcompute/apis/san-francisco-compute-documentation/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/sfcompute/san-francisco-compute-documentation/versions/93dd7661e9bb/schema)
