---
title: "Attach VM to VPC"
method: POST
path: "/api/v1/vms/{id}/vpc"
tags: ["Networking"]
---

# Attach VM to VPC

`POST /api/v1/vms/{id}/vpc`

Attach a virtual machine to a VPC. The VM gains a private network interface inside the VPC.

Use `ip` to request a specific private IP from the VPC's CIDR range. If omitted, an IP is auto-assigned.

## Path parameters

- `id` string, uuid, required

## Headers

- `X-Project-ID` string, uuid, required

## Request body

- AttachVPCRequest
  - `vpc_id` string, uuid, required — VPC to attach the VM to.
  - `ip` string — Specific private IP within the VPC's CIDR range. Auto-assigned if omitted.

## Response `200`

VM attached to VPC

- SuccessResponse
  - `success` boolean
  - `message` string

## Other responses

- `400` — Invalid request parameters
- `401` — Authentication required
- `404` — Resource not found

---

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