---
title: "Attach a VAPI agent to a leg"
method: POST
path: "/legs/{id}/agent/vapi"
tags: ["Legs"]
---

# Attach a VAPI agent to a leg

`POST /legs/{id}/agent/vapi`

Bridges audio bidirectionally with a VAPI conversational AI agent. Standalone legs use direct audio; legs in a room use mixer taps.

## Request body

- VAPIAgentRequest
  - `assistant_id` string, required — VAPI assistant ID
  - `first_message` string — Override the agent's first message
  - `variable_values` object — Key-value pairs passed as VAPI variable values (assistantOverrides.variableValues)
  - `api_key` string — API key override (falls back to VAPI_API_KEY env var)

## Response `200`

Agent started

- StatusResponse
  - `instance_id` string — Instance identifier
  - `status` string, required

## Other responses

- `400` — Invalid JSON or missing assistant_id
- `404` — Leg not found
- `409` — Leg not connected, agent already attached, or no audio reader/writer
- `503` — No VAPI API key provided

---

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