Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "podcast-api"
version = "3.1.0"
version = "3.2.0"
authors = ["Listen Notes, Inc. <hello@listennotes.com>"]
edition = "2024"
rust-version = "1.88"
Expand Down
161 changes: 156 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,24 @@

[![Rust](https://github.com/ListenNotes/podcast-api-rust/actions/workflows/rust.yml/badge.svg)](https://github.com/ListenNotes/podcast-api-rust/actions/workflows/rust.yml) [![Crates.io](https://img.shields.io/crates/v/podcast-api)](https://crates.io/crates/podcast-api)

The official Rust library for the [Listen Notes Podcast API](https://www.listennotes.com/api/).
Search podcasts and episodes, fetch metadata, and manage playlists.
Questions: [hello@listennotes.com](mailto:hello@listennotes.com).
Search podcasts and episodes, generate speaker-labeled transcripts on demand, and get podcast audience insights with the official Rust SDK for the [Listen Notes Podcast API](https://www.listennotes.com/api/).

You can also discover podcasts in ChatGPT, Claude, or another compatible AI assistant without writing code. [Connect the official Podcast MCP](https://www.listennotes.com/api/mcp/).

## On-demand podcast transcription

Transcription methods are available in version 3.2.0. Use the [mock API](https://www.listennotes.help/article/48-how-to-test-the-podcast-api-without-an-api-key) to try the examples with fixed responses and no API key.

| Method | What it does |
| --- | --- |
| [`estimate_episode_transcription`](#estimate_episode_transcription) | Estimate cost and check your remaining transcription quota. |
| [`transcribe_episode`](#transcribe_episode) | Queue a transcription for a podcast episode. |
| [`get_episode_transcript`](#get_episode_transcript) | Poll for job status and get fresh signed download URLs. |
| [`list_transcripts`](#list_transcripts) | List completed transcripts and paginate with `next_cursor`. |

**Can I get speaker-labeled podcast transcripts?** Yes. When multiple voices are detected, TXT, SRT, and VTT include speaker labels. Word-level JSON includes speaker IDs when available and timestamps in milliseconds. Signed links expire after 15 minutes. Poll again for fresh links.

**Can I request a live transcription?** Enable transcription and set up billing in your API dashboard, then use a server-side API key. Check the estimate first because live requests can incur transcription fees. [Transcription settings](https://www.listennotes.com/api/dashboard/#transcription) · [Pricing](https://www.listennotes.com/api/pricing/#on-demand-transcription)

## Installation

Expand All @@ -13,7 +28,7 @@ and publishing; no separate package manager is needed.

```toml
[dependencies]
podcast-api = "3.1.0"
podcast-api = "3.2.0"
serde_json = "1"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
```
Expand Down Expand Up @@ -134,6 +149,10 @@ crates.io and GitHub release creation are separate review steps.
- [`add_playlist_item`](#add_playlist_item) — `POST /playlists/{id}/items`
- [`delete_playlist_item`](#delete_playlist_item) — `DELETE /playlists/{id}/items/{item_id}`
- [`update_playlist_item_notes`](#update_playlist_item_notes) — `PUT /playlists/{id}/items/{item_id}`
- [`estimate_episode_transcription`](#estimate_episode_transcription) — `GET /episodes/{id}/transcript/estimate`
- [`transcribe_episode`](#transcribe_episode) — `POST /episodes/{id}/transcript`
- [`get_episode_transcript`](#get_episode_transcript) — `GET /episodes/{id}/transcript`
- [`list_transcripts`](#list_transcripts) — `GET /transcripts`

<!-- END GENERATED METHOD INDEX -->

Expand Down Expand Up @@ -363,7 +382,11 @@ Fetch detailed meta data for an episode by id

`GET /episodes/{id}`

Fetch detailed meta data for a specific episode.
Fetch detailed metadata for a specific episode.

Existing episode transcripts are already available on Listen Notes and include transcripts supplied by podcast producers. About 12% of new episodes and over 3% of all episodes have an existing transcript. Retrieve one with `show_transcript=1` on PRO and ENTERPRISE.

If an episode has no transcript, use `POST /episodes/{id}/transcript` to request on-demand transcription on any plan.

```rust,no_run
use serde_json::json;
Expand Down Expand Up @@ -871,4 +894,132 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {

[Full API documentation](https://www.listennotes.com/api/docs/#put-api-v2-playlists-id-items-item_id)

### estimate_episode_transcription

Estimate episode transcription cost

`GET /episodes/{id}/transcript/estimate`

Get an informational estimate using episode duration metadata, your remaining quota, and your account's per-minute overage rate. This does not start transcription or reserve quota.

`transcription_quota_this_cycle` shows the included and remaining minutes. `billing_this_transcription.amount_cents` is the estimated fee for minutes beyond the remaining quota. It is 0 when the estimate fits within the quota.

The final fee uses the audio duration measured by the model, the quota available when transcription completes, and the per-minute rate saved when the request is accepted.

If duration metadata is unavailable, `estimate`, `billing_this_transcription.billable_minutes`, and `billing_this_transcription.amount_cents` are null. You can request an estimate before enabling Transcription or adding a payment method. Normal API request accounting applies.

```rust,no_run
use serde_json::json;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = podcast_api::Client::new(None);
let response = client.estimate_episode_transcription("dc09fd798802477b8dba0ca1e10134fa", &json!({})).await?;
println!("{}", response.json().await?);
Ok(())
}
```

[Full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-episodes-id-transcript-estimate)

### transcribe_episode

Request episode transcription

`POST /episodes/{id}/transcript`

Generate speaker-labeled transcripts for a podcast episode on demand. The request runs asynchronously. Ensure Transcription is enabled and a payment method is added in the [API dashboard](https://www.listennotes.com/api/dashboard/#transcription). Eligible paid accounts may use their existing invoicing arrangement.

**On-demand transcription can incur fees. This example uses the mock API. Configure a server-side API key only when you intend to request live transcription.**

See the [API pricing page](https://www.listennotes.com/api/pricing/#on-demand-transcription) for included minutes and rates. Use the estimate endpoint to check your account's quota and estimated charge.

Returns HTTP 202 for a queued or processing request, or HTTP 200 if a completed transcript already exists for this API account. Repeating a pending or completed request reuses it without another transcription charge. If transcription fails, you may request it again. Up to three pending requests are allowed per API account by default.

Both responses include `transcription_quota_this_cycle` and `billing_this_transcription`. HTTP 202 includes `estimate`, which is null when duration metadata is unavailable. HTTP 200 includes the measured duration and completion time. Use the polling endpoint for signed download URLs.

Poll GET /episodes/{id}/transcript, or [configure a webhook in the dashboard](https://www.listennotes.com/api/dashboard/#webhooks) to receive `episode_transcription.completed` or `episode_transcription.failed`. Webhooks are optional; there is no webhook URL parameter on this operation.

The processing deadline is 15 minutes when estimated audio length is under 60 minutes or unknown, otherwise 25% of estimated audio length. Failed and timed-out transcriptions are not charged a transcription fee.

The per-minute rate is saved when the request is accepted. When a transcription succeeds, we round the measured audio duration up to a whole minute. Only minutes beyond the included quota incur a transcription fee. Disabling Transcription blocks new requests. Accepted requests continue processing.

No request body is required. Normal API request accounting applies even when the transcription fee is zero.

```rust,no_run
use serde_json::json;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = podcast_api::Client::new(None);
let response = client.transcribe_episode("1871d978bdc648588441bc5649857ddb", &json!({})).await?;
println!("{}", response.json().await?);
Ok(())
}
```

[Full API documentation](https://www.listennotes.com/api/docs/#post-api-v2-episodes-id-transcript)

### get_episode_transcript

Get episode transcription status and downloads

`GET /episodes/{id}/transcript`

Poll the transcription requested by your API account for this episode. Returns HTTP 200 for queued, processing, completed, and failed states. Only your API account's requests are accessible.

Queued and processing responses include the same quota, billing, and estimate fields as HTTP 202 from POST, plus a `Retry-After` header of 30 seconds. Completed responses include actual duration, `billing_this_transcription`, `transcription_quota_this_cycle`, and all available TXT, SRT, VTT, and word-level JSON download URLs. Failed responses include `error.code`, such as `transcription_timeout`, and null billing minutes and amount.

Signed URLs in `download_urls` are valid for 15 minutes and share the UTC expiration time in `download_url_expired_date`. Anyone holding a valid URL can download the file without an API key. Poll again for fresh URLs.

Transcription uses speaker diarization to distinguish voices. When multiple speakers are detected, TXT, SRT, and VTT use speaker labels. A TXT download places the label before the spoken text.

```text
Speaker A: Thanks for joining us.

Speaker B: Happy to be here.
```

Word-level JSON includes start and end timestamps in milliseconds and a `speaker` ID for each word, or `null` when a label is unavailable.

If multiple attempts exist, an existing completed transcript remains available until a replacement succeeds. Otherwise the latest request is returned. This operation does not initiate transcription.

```rust,no_run
use serde_json::json;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = podcast_api::Client::new(None);
let response = client.get_episode_transcript("1871d978bdc648588441bc5649857ddb", &json!({})).await?;
println!("{}", response.json().await?);
Ok(())
}
```

[Full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-episodes-id-transcript)

### list_transcripts

List completed episode transcripts

`GET /transcripts`

List your API account's completed transcripts, newest completion first. Queued, processing, failed, and superseded attempts are excluded.

Follow `next_cursor` until it is null. Cursors are opaque and belong to this API account. Each item contains a `billing_this_transcription` summary. Fetch its `transcript_url` from the API server for quota details and fresh signed download URLs.

```rust,no_run
use serde_json::json;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = podcast_api::Client::new(None);
let response = client.list_transcripts(&json!({"limit": 20})).await?;
println!("{}", response.json().await?);
Ok(())
}
```

[Full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-transcripts)

<!-- END GENERATED API REFERENCE -->
85 changes: 83 additions & 2 deletions src/api-contract.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"schema_version": 1,
"version": "3.1.0",
"version": "3.2.0",
"operations": [
{
"operationId": "search",
Expand Down Expand Up @@ -394,7 +394,7 @@
"show_transcript": 1
},
"summary": "Fetch detailed meta data for an episode by id",
"description": "Fetch detailed meta data for a specific episode."
"description": "Fetch detailed metadata for a specific episode.\n\nExisting episode transcripts are already available on Listen Notes and include transcripts supplied by podcast producers. About 12% of new episodes and over 3% of all episodes have an existing transcript. Retrieve one with `show_transcript=1` on PRO and ENTERPRISE.\n\nIf an episode has no transcript, use `POST /episodes/{id}/transcript` to request on-demand transcription on any plan."
},
{
"operationId": "getEpisodesInBatch",
Expand Down Expand Up @@ -925,6 +925,87 @@
},
"summary": "Update notes for a playlist item.",
"description": "Replace item notes, or send an empty string to clear them. The item ID and added_at_ms remain unchanged.\n\nOnly playlists owned by your admin API account can be modified; contributor membership does not grant write access."
},
{
"operationId": "estimateEpisodeTranscription",
"func": "estimate_episode_transcription",
"available_from": "3.2.0",
"method": "GET",
"path": "/episodes/{id}/transcript/estimate",
"parameters": [
{
"name": "id",
"in": "path",
"required": true
}
],
"example_params": {
"id": "dc09fd798802477b8dba0ca1e10134fa"
},
"summary": "Estimate episode transcription cost",
"description": "Get an informational estimate using episode duration metadata, your remaining quota, and your account's per-minute overage rate. This does not start transcription or reserve quota.\n\n`transcription_quota_this_cycle` shows the included and remaining minutes. `billing_this_transcription.amount_cents` is the estimated fee for minutes beyond the remaining quota. It is 0 when the estimate fits within the quota.\n\nThe final fee uses the audio duration measured by the model, the quota available when transcription completes, and the per-minute rate saved when the request is accepted.\n\nIf duration metadata is unavailable, `estimate`, `billing_this_transcription.billable_minutes`, and `billing_this_transcription.amount_cents` are null. You can request an estimate before enabling Transcription or adding a payment method. Normal API request accounting applies."
},
{
"operationId": "transcribeEpisode",
"func": "transcribe_episode",
"available_from": "3.2.0",
"method": "POST",
"path": "/episodes/{id}/transcript",
"parameters": [
{
"name": "id",
"in": "path",
"required": true
}
],
"example_params": {
"id": "1871d978bdc648588441bc5649857ddb"
},
"summary": "Request episode transcription",
"description": "Generate speaker-labeled transcripts for a podcast episode on demand. The request runs asynchronously. Ensure Transcription is enabled and a payment method is added in the [API dashboard](https://www.listennotes.com/api/dashboard/#transcription). Eligible paid accounts may use their existing invoicing arrangement.\n\n**On-demand transcription can incur fees. To prevent accidental charges, Run returns a mock response here. Copy the code to request transcription from your own environment.**\n\nSee the [API pricing page](https://www.listennotes.com/api/pricing/#on-demand-transcription) for included minutes and rates. Use the estimate endpoint to check your account's quota and estimated charge.\n\nReturns HTTP 202 for a queued or processing request, or HTTP 200 if a completed transcript already exists for this API account. Repeating a pending or completed request reuses it without another transcription charge. If transcription fails, you may request it again. Up to three pending requests are allowed per API account by default.\n\nBoth responses include `transcription_quota_this_cycle` and `billing_this_transcription`. HTTP 202 includes `estimate`, which is null when duration metadata is unavailable. HTTP 200 includes the measured duration and completion time. Use the polling endpoint for signed download URLs.\n\nPoll GET /episodes/{id}/transcript, or [configure a webhook in the dashboard](https://www.listennotes.com/api/dashboard/#webhooks) to receive `episode_transcription.completed` or `episode_transcription.failed`. Webhooks are optional; there is no webhook URL parameter on this operation.\n\nThe processing deadline is 15 minutes when estimated audio length is under 60 minutes or unknown, otherwise 25% of estimated audio length. Failed and timed-out transcriptions are not charged a transcription fee.\n\nThe per-minute rate is saved when the request is accepted. When a transcription succeeds, we round the measured audio duration up to a whole minute. Only minutes beyond the included quota incur a transcription fee. Disabling Transcription blocks new requests. Accepted requests continue processing.\n\nNo request body is required. Normal API request accounting applies even when the transcription fee is zero."
},
{
"operationId": "getEpisodeTranscript",
"func": "get_episode_transcript",
"available_from": "3.2.0",
"method": "GET",
"path": "/episodes/{id}/transcript",
"parameters": [
{
"name": "id",
"in": "path",
"required": true
}
],
"example_params": {
"id": "1871d978bdc648588441bc5649857ddb"
},
"summary": "Get episode transcription status and downloads",
"description": "Poll the transcription requested by your API account for this episode. Returns HTTP 200 for queued, processing, completed, and failed states. Only your API account's requests are accessible.\n\nQueued and processing responses include the same quota, billing, and estimate fields as HTTP 202 from POST, plus a `Retry-After` header of 30 seconds. Completed responses include actual duration, `billing_this_transcription`, `transcription_quota_this_cycle`, and all available TXT, SRT, VTT, and word-level JSON download URLs. Failed responses include `error.code`, such as `transcription_timeout`, and null billing minutes and amount.\n\nSigned URLs in `download_urls` are valid for 15 minutes and share the UTC expiration time in `download_url_expired_date`. Anyone holding a valid URL can download the file without an API key. Poll again for fresh URLs.\n\nTranscription uses speaker diarization to distinguish voices. When multiple speakers are detected, TXT, SRT, and VTT use speaker labels. A TXT download places the label before the spoken text.\n\n```\nSpeaker A: Thanks for joining us.\n\nSpeaker B: Happy to be here.\n```\n\nWord-level JSON includes start and end timestamps in milliseconds and a `speaker` ID for each word, or `null` when a label is unavailable.\n\nIf multiple attempts exist, an existing completed transcript remains available until a replacement succeeds. Otherwise the latest request is returned. This operation does not initiate transcription."
},
{
"operationId": "listTranscripts",
"func": "list_transcripts",
"available_from": "3.2.0",
"method": "GET",
"path": "/transcripts",
"parameters": [
{
"name": "limit",
"in": "query",
"required": false
},
{
"name": "cursor",
"in": "query",
"required": false
}
],
"example_params": {
"limit": 20
},
"summary": "List completed episode transcripts",
"description": "List your API account's completed transcripts, newest completion first. Queued, processing, failed, and superseded attempts are excluded.\n\nFollow `next_cursor` until it is null. Cursors are opaque and belong to this API account. Each item contains a `billing_this_transcription` summary. Fetch its `transcript_url` from the API server for quota details and fresh signed download URLs."
}
]
}
Loading