---
title: "Publisher Byo Tts Set"
method: POST
path: "/v1/publisher/{tenant_slug}/byo-tts"
---

# Publisher Byo Tts Set

`POST /v1/publisher/{tenant_slug}/byo-tts`

## Request

- Base URL: `https://api.storyflo.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.storyflo.com/v1/publisher/{tenant_slug}/byo-tts`
- Auth: none declared

Pro-tier only: store the publisher's BYO TTS key (Fernet-
encrypted at rest). Free / Plus return 403 — the upgrade prompt
on the frontend should route the publisher to /publisher/{slug}/
pricing instead.

Verification mirrors the listener-side flow: a probe call against
the provider rejects typos with 422 before we persist anything.
On success we stamp byo_tts_provider + byo_tts_encrypted_key on
the Publisher row; subsequent renders pull the key out, decrypt
in-process, and use it for the synthesis call.

Pool-safety (2026-08-11 SEV) — THREE PHASES
===========================================

``_byo.verify_key`` is a 10s-timeout httpx probe against the
provider. Holding ``Depends(get_db)`` across it pins a writer
connection for the full round-trip. Same shape, same fix as
``app/routes/byo_tts.py::listener_byo_tts_set``: gate on a short
session, release it, probe holding zero connections, then persist
on a second short session.

## Path parameters

- `tenant_slug` string, required

## Headers

- `x-storyflo-publisher-token` string, nullable

## Request body

- PublisherByoTtsBody
  - `provider` string, required
  - `api_key` string, required

## Response `200`

Successful Response

- object

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/storyflo/apis/storyflo-inference-router.md) · [All operations](https://skmtc.dev/storyflo/apis/storyflo-inference-router/llms.txt) · [OpenAPI document](https://skmtc.dev/storyflo/apis/storyflo-inference-router/revisions/c3a1a735ac7a?raw)
