The generation API
A create starts an episode, polling reports progress, and a signed webhook tells you when it settles. A run uses a project configured in the Studio: its sources, theme and voice belong to the project, and a run may override the voice for that episode only.
Base URL: https://podcastnext.com/api/v1
This page is generated from the same OpenAPI document your client can fetch: /api/v1/openapi.json. Every path, scope and error code below is read from it, so the two cannot disagree.
Get a key
Keys are issued under Settings > API keys by an organisation admin. The secret is shown once and cannot be recovered; a lost key is replaced. A key belongs to an organisation, carries one or more scopes, and can be limited to some of that organisation's projects. The API is included on PRO and higher plans; a plan without it answers 403 api_not_enabled.
A project outside a key's allowlist answers 404, not 403.
Scopes
A route requires the scope it needs, and a key that lacks it is refused before anything is read. Ask for the smallest set that does the job.
generateStart an episode run.readRead runs, their drafts and audio, the voice catalogue, the usage position and this key's capabilities.cancelStop a run that is still in progress.projects:readList the projects the key may reach.
Check capabilities first
Read the story ceiling, source caps, reachable projects and audio URL lifetime once at start-up, and again after a plan change. The values come from the live configuration, so the server and your client cannot disagree.
curl "https://podcastnext.com/api/v1/capabilities" \
-H "Authorization: Bearer $PODCASTNEXT_KEY"Start a run
Async by contract: the pipeline takes minutes, so a create answers 202 with a statusUrl. The response reports the effective maxStories rather than the one you asked for, because the project and the plan can both lower it.
curl -X POST "https://podcastnext.com/api/v1/projects/<projectId>/runs" \
-H "Authorization: Bearer $PODCASTNEXT_KEY" \
-H "Idempotency-Key: 7d1f0c9a-ep-0042" \
-H "Content-Type: application/json" \
-d '{
"sourceKind": "text",
"maxStories": 2,
"externalId": "ep-0042",
"groups": [{
"label": "The week in review",
"position": 0,
"items": [
{ "title": "Funding round", "content": "The company raised a Series B to expand its platform." },
{ "title": "New release", "content": "Version 2 shipped with offline support." }
]
}]
}'Idempotency-Key is required, and it is what makes a retry safe: the same key with the same body replays the run you already started, and the same key with a different body is 409. A key is honoured for 24 hours; after that the same key is a new request and a new run is billed, so a late retry is better sent with a fresh key.
One run at a time per project: a second concurrent create is 409 project_busy, and the answer is to retry once the first settles rather than to open a second.
There is no test mode: a create that validates is billable work, so validate your body against the schema first. A refusal before the run - 400, 422, or a plan gate - costs nothing.
Poll until it settles
curl "https://podcastnext.com/api/v1/runs/<runId>" \
-H "Authorization: Bearer $PODCASTNEXT_KEY"A failed episode is still a 200: the request succeeded and the episode failed, and failure carries a code from the published vocabulary. Poll on a backoff of a few seconds rather than in a tight loop - every poll spends from the same budget as everything else.
audio appears once the status is completed, and it carries two ways to the same file. apiUrl is a stable, authenticated path - store that. url is a signed link that expires in 15 minutes, which is convenient once and useless to keep. Calling apiUrl signs a fresh link and answers 302; follow it for the bytes. Add ?download=1 to save the file under a name derived from your externalId.
curl -L "https://podcastnext.com/api/v1/runs/<runId>/audio?download=1" \
-H "Authorization: Bearer $PODCASTNEXT_KEY" \
-o episode.mp3The episode itself is retained for the project's storage window, which is longer than any URL. A run that has not finished answers 409 audio_unavailable with a message to poll it.
When it settles: webhooks
Polling works, but a webhook is one request instead of many: register an endpoint under Settings > Webhooks (organisation-wide, or narrowed to one project) and we POST a signed body when a run finishes. The events are run.completed, run.failed, run.cancelled.
The endpoint must be a public https URL. Loopback, private and link-local addresses are rejected, and redirects are not followed. For local development, use a tunnel and register its public URL.
The body names the run and carries data.audioUrl, a stable path rather than a signed URL, so a delivery that arrives late is still true: send your key to that path and follow the 302. Answer any 2xx to acknowledge; a 5xx, a timeout or a 429 is retried with backoff, and any other 4xx stops the delivery. A redirect is never followed.
import { createHmac, timingSafeEqual } from "node:crypto";
// header: the value of PodcastNext-Signature
export function isFromPodcastNext(rawBody, header, secrets) {
const parts = header.split(",").map((part) => part.trim());
const timestamp = Number(parts.find((p) => p.startsWith("t="))?.slice(2));
if (!Number.isInteger(timestamp)) return false;
// allow a small clock skew; a future timestamp is not a reason to trust it
if (Math.abs(Date.now() / 1000 - timestamp) > 300) return false;
const signed = `${timestamp}.${rawBody}`; // the timestamp is signed, not merely sent
return secrets.some((secret) => {
const expected = createHmac("sha256", secret).update(signed).digest();
return parts
.filter((part) => part.startsWith("v1="))
.some((part) => {
const provided = Buffer.from(part.slice(3), "hex");
return provided.length === expected.length && timingSafeEqual(provided, expected);
});
});
}During a secret rotation the header carries one v1 per valid secret, which is why the sample accepts any of them: deploy the new secret, let the old one lapse, and no event is dropped in between.
Rate limits and errors
Every response carries the budget it was checked against, so a client paces itself without being refused first:
X-RateLimit-LimitX-RateLimit-RemainingX-RateLimit-ResetRetry-AfterSeconds to wait. Present on a 429, and on nothing else.x-request-idThis request's id. Include it when you contact support.
A refusal is always one envelope, { "error": string, "code": string }, and the code is one of the following values: invalid_jsoninvalid_bodyinvalid_queryinvalid_cursorinvalid_groupinvalid_urlpayload_too_largeunsupported_media_typeinvalid_keykey_revokedinsufficient_scopeinsufficient_creditsapi_not_enabledapi_billing_disabledorg_suspendedproject_not_foundrun_not_foundidempotency_conflictproject_busysource_kind_mismatchmixed_source_kindsunsupported_source_kindvoice_not_foundvoice_not_availableaudio_unavailabledraft_unavailablerate_limitedinternal_error
A 4xx is a request to change; a 5xx is ours to fix and is worth a retry with backoff.
All endpoints
Read from the document, so this is the API rather than a summary of it. The document describes every parameter, every response and every refusal.
- List the projects this key may reach
GET/api/v1/projects - Read one project
GET/api/v1/projects/{projectId} - Start one episode generation
POST/api/v1/projects/{projectId}/runs - List this key's runs
GET/api/v1/runs - Poll a run
GET/api/v1/runs/{runId} - Get a fresh link to the episode audio
GET/api/v1/runs/{runId}/audio - Read what the episode narrates
GET/api/v1/runs/{runId}/draft - Cancel a run
POST/api/v1/runs/{runId}/cancel - List the voice catalogue
GET/api/v1/voices - Read credits and API usage for the current period
GET/api/v1/usage - What this credential and its plan may do
GET/api/v1/capabilities
Request access
The API is available on paid plans. To request a key, get your free invite or write to contact@podcastnext.com, and we will reply with access and a walkthrough. Inside v1 changes are additive: a field may be added, never removed or repurposed, and a removal is announced with a dated deprecation header for a full billing period before it is taken away.