---
title: "Batch refresh CVM instance IDs"
method: PATCH
path: "/api/v1/cvms/instance-ids"
tags: ["CVMs"]
---

# Batch refresh CVM instance IDs

`PATCH /api/v1/cvms/instance-ids`

Resolves and persists missing instance_id values. Admin can pass cross-workspace CVM IDs.

## Request body

- BatchInstanceIdRefreshRequest
  - `cvm_ids` string[], nullable — Optional CVM identifiers. Admin can pass cross-workspace IDs.
  - `running_only` boolean — Only process CVMs with status=running
  - `missing_only` boolean — Only process CVMs with missing instance_id
  - `overwrite` boolean — Overwrite existing instance_id when different
  - `limit` integer — Max CVMs to process in one request
  - `dry_run` boolean — Preview changes without persisting

## Response `200`

Successful Response

- BatchInstanceIdRefreshResponse
  - `total` integer, required
  - `scanned` integer, required
  - `updated` integer, required
  - `unchanged` integer, required
  - `skipped` integer, required
  - `conflicts` integer, required
  - `errors` integer, required
  - `items` InstanceIdRefreshResult[], required
    - `cvm_id` integer, required
    - `identifier` string, required
    - `status` 'updated' | 'unchanged' | 'skipped' | 'conflict' | 'error', required
    - `old_instance_id` string, nullable
    - `new_instance_id` string, nullable
    - `source` 'teepod_state' | 'teepod_info' | 'gateway' | 'none'
    - `verified_with_gateway` boolean
    - `reason` string, nullable

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/phala/apis/phala-cloud-api.md) · [All operations](https://skmtc.net/phala/apis/phala-cloud-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/phala/phala-cloud-api/revisions/83c6ae62e860/schema)
