---
title: "Apply a Self-Hosted state transition"
method: POST
path: "/api/v1/self-hosted"
tags: ["selfHosted"]
---

# Apply a Self-Hosted state transition

`POST /api/v1/self-hosted`

Applies **one** Self-Hosted state transition, discriminated by `action`: `save` a mode's config (no on/off or active-mode change), `activate` a mode (enable Self-Hosted and route calls through it — enable or switch), or `disable`. Each mode (`llm`/`audio`) has its own independent config.

The signing secret for a mode is minted the first time you `save` a `wsUrl` for it. Retrieve it from `GET /api/v1/self-hosted/secret?mode=…` and set up your server's `X-Dial-Signature` verification *before* you `activate` (activating routes your calls at the server immediately). Returns the full configuration after the change.

## Headers

- `Authorization` string, required

## Request body

- union — One Self-Hosted state transition, tagged by `action`: `save` (persist a mode's config), `activate` (a `save` that also enables/switches to that mode), or `disable` (turn off).
  - object — Persist a mode's config. Does **not** change which mode is active or whether Self-Hosted is on. The signing secret (and, for `llm`, the `urlKey`) is minted the first time a mode is saved.
    - `action` 'save', required
    - `config` union, required — A mode's config, tagged by `type` (the mode).
      - object — llm variant
        - `type` 'llm', required
        - `wsUrl` string, uri, required — The `wss://` URL Dial connects to for each call.
      - object — audio variant
        - `type` 'audio', required
        - `wsUrl` string, uri, required — The `wss://` URL Dial connects to for each call.
        - `audioInboundFormat` 'mulaw_8000' | 'alaw_8000' | 'l16_8000' | 'l16_16000' | 'l16_24000' — An audio-pipe format: G.711 μ-law/A-law at 8 kHz, or 16-bit little-endian linear PCM at 8/16/24 kHz. Defaults to `mulaw_8000`.
        - `audioOutboundFormat` 'mulaw_8000' | 'alaw_8000' | 'l16_8000' | 'l16_16000' | 'l16_24000' — An audio-pipe format: G.711 μ-law/A-law at 8 kHz, or 16-bit little-endian linear PCM at 8/16/24 kHz. Defaults to `mulaw_8000`.
  - object — A `save` (same `config` body) that **also** enables Self-Hosted and routes calls through `config.type` — enable, or switch from the other mode. Affects new calls only.
    - `action` 'activate', required
    - `config` union, required — A mode's config, tagged by `type` (the mode).
      - object — llm variant
        - `type` 'llm', required
        - `wsUrl` string, uri, required — The `wss://` URL Dial connects to for each call.
      - object — audio variant
        - `type` 'audio', required
        - `wsUrl` string, uri, required — The `wss://` URL Dial connects to for each call.
        - `audioInboundFormat` 'mulaw_8000' | 'alaw_8000' | 'l16_8000' | 'l16_16000' | 'l16_24000' — An audio-pipe format: G.711 μ-law/A-law at 8 kHz, or 16-bit little-endian linear PCM at 8/16/24 kHz. Defaults to `mulaw_8000`.
        - `audioOutboundFormat` 'mulaw_8000' | 'alaw_8000' | 'l16_8000' | 'l16_16000' | 'l16_24000' — An audio-pipe format: G.711 μ-law/A-law at 8 kHz, or 16-bit little-endian linear PCM at 8/16/24 kHz. Defaults to `mulaw_8000`.
  - object — Turn Self-Hosted off. Both modes' configs are kept.
    - `action` 'disable', required

## Response `200`

The full configuration after the change.

- SelfHostedConfig — The account's Self-Hosted configuration. Each mode owns an **independent** config (`llm` and `audio`), both readable at once; `activeMode` is which one drives calls when `enabled`.
  - `enabled` boolean, required — Whether Self-Hosted mode is currently driving the account's calls.
  - `activeMode` 'llm' | 'audio', required — Which mode drives calls when `enabled`: `"llm"` (Dial runs voice; your server drives the conversation in text) or `"audio"` (Dial pipes the raw call audio to your server, full duplex).
  - `llm` SelfHostedLlmConfig — The LLM variant — Dial handles telephony, speech-to-text, and text-to-speech; your server answers with the agent's text turns over the Self-hosted LLM protocol.
    - `type` 'llm', required
    - `wsUrl` string, uri, required — The `wss://` URL of the server Dial connects to for each call.
    - `urlKey` string, required — The unguessable per-account path segment Dial uses when connecting. Stable once the URL is first set.
    - `secretMasked` string, required — A masked preview of the signing secret (`shs_••••••••<last4>`). Copy the full value from `GET /api/v1/self-hosted/secret?mode=llm`.
  - `audio` SelfHostedAudioConfig — The audio variant — Dial pipes the raw call audio to your server, full duplex, over the Self-hosted audio protocol. Your server brings the entire voice stack.
    - `type` 'audio', required
    - `wsUrl` string, uri, required — The `wss://` URL of the server Dial connects to for each call.
    - `secretMasked` string, required — A masked preview of the signing secret (`shs_••••••••<last4>`). Copy the full value from `GET /api/v1/self-hosted/secret?mode=audio`.
    - `audioInboundFormat` 'mulaw_8000' | 'alaw_8000' | 'l16_8000' | 'l16_16000' | 'l16_24000', required — An audio-pipe format: G.711 μ-law/A-law at 8 kHz, or 16-bit little-endian linear PCM at 8/16/24 kHz. Defaults to `mulaw_8000`.
    - `audioOutboundFormat` 'mulaw_8000' | 'alaw_8000' | 'l16_8000' | 'l16_16000' | 'l16_24000', required — An audio-pipe format: G.711 μ-law/A-law at 8 kHz, or 16-bit little-endian linear PCM at 8/16/24 kHz. Defaults to `mulaw_8000`.

## Other responses

- `400` — The request body failed validation.
- `401` — Missing or invalid API key.

---

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