---
title: "Change a leg's routing role"
method: PATCH
path: "/legs/{id}/role"
tags: ["Legs"]
---

# Change a leg's routing role

`PATCH /legs/{id}/role`

Updates the leg's routing role and, if the leg is currently in a room, recomputes the room's matrix-derived allow-sets atomically (single mixer-mutex acquisition). The next mix tick (≤ 20 ms) reflects the change.

## Request body

- SetLegRoleRequest
  - `role` string, required — New routing role for the leg. The room's routing matrix decides which other legs this leg hears and is heard by based on roles. Pass an empty string to clear the role (full mesh).

## Response `200`

Updated leg view

- Leg
  - `instance_id` string — Instance identifier
  - `id` string, required — Unique leg identifier (UUID)
  - `type` 'sip_inbound' | 'sip_outbound' | 'webrtc' | 'whatsapp_in' | 'whatsapp_out' | 'websocket_in' | 'websocket_out' | 'moq_in' | 'livekit_publish' | 'livekit_participant', required — Leg type
  - `state` 'ringing' | 'early_media' | 'connected' | 'held' | 'hung_up', required — Leg state
  - `room_id` string — Room ID if the leg is in a room, empty otherwise
  - `muted` boolean, required — Whether the leg is muted (cannot be heard by others)
  - `deaf` boolean, required — Whether the leg is deaf (cannot hear others)
  - `accept_dtmf` boolean, required — Whether the leg receives DTMF digits broadcast from other legs in the same room. Defaults to true.
  - `held` boolean, required — Whether the call is on hold (SIP legs only)
  - `role` string — Routing role used by the room's audio routing matrix (e.g. "customer", "agent", "supervisor"). Empty string means unroled (full mesh).
  - `app_id` string — Application identifier for event stream filtering.
  - `sip_headers` object — Deprecated: X-* headers from the inbound INVITE. Only present on sip_inbound legs. Use `headers` for new code; it carries the same map plus surfaces handshake headers for websocket legs.
  - `headers` object — Custom protocol headers exposed by the leg's transport — X-/P- headers from a SIP INVITE, the WebSocket upgrade request, or supplied at outbound dial time.

## Other responses

- `400` — Invalid JSON
- `404` — Leg not found

---

[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/versions/ad30827d3b57/schema)
