podcast-api 3.0.2 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +246 -96
- package/package.json +1 -1
- package/src/PodcastApiMethods.js +15 -0
- package/src/api-contract.json +102 -2
package/README.md
CHANGED
|
@@ -1,28 +1,94 @@
|
|
|
1
|
-
# Podcast API JavaScript
|
|
1
|
+
# Podcast API for JavaScript
|
|
2
|
+
|
|
3
|
+
Search podcasts and episodes, generate speaker-labeled transcripts on demand, and access podcast audience insights with the official Listen Notes SDK for Node.js and Cloudflare Workers. [Listen Notes Podcast API](https://www.listennotes.com/api/)
|
|
4
|
+
|
|
5
|
+
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/).
|
|
2
6
|
|
|
3
7
|
[](https://github.com/ListenNotes/podcast-api-js/actions/workflows/node.js.yml) [](https://github.com/ListenNotes/podcast-api-js/actions/workflows/cloudflare-workers.yml) [](https://www.npmjs.com/package/podcast-api)
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install podcast-api
|
|
13
|
+
```
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
Version 3 requires Node.js 22 or later. The transcription methods are available in version 3.2.0 and later. [Package on npm](https://www.npmjs.com/package/podcast-api)
|
|
16
|
+
|
|
17
|
+
## Podcast transcription quickstart
|
|
18
|
+
|
|
19
|
+
Use the transcription API to estimate the cost of transcribing an episode, request a transcript, check its status, and list completed transcripts. This example uses the mock API without a key or transcription charges. It returns fixed sample data and placeholder download links. [Mock API guide](https://www.listennotes.help/article/48-how-to-test-the-podcast-api-without-an-api-key)
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
const { Client } = require('podcast-api');
|
|
23
|
+
const client = Client();
|
|
12
24
|
|
|
13
|
-
|
|
25
|
+
async function main() {
|
|
26
|
+
const id = 'dc09fd798802477b8dba0ca1e10134fa';
|
|
14
27
|
|
|
15
|
-
|
|
28
|
+
const { data: estimate } = await client.estimateEpisodeTranscription({ id });
|
|
29
|
+
console.log('Estimated charge in cents', estimate.billing_this_transcription.amount_cents);
|
|
16
30
|
|
|
17
|
-
|
|
31
|
+
const { data: job } = await client.transcribeEpisode({ id });
|
|
32
|
+
console.log('Submission status', job.status);
|
|
18
33
|
|
|
34
|
+
const { data: transcript } = await client.getEpisodeTranscript({ id });
|
|
35
|
+
console.log('Available downloads', transcript.download_urls);
|
|
19
36
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
37
|
+
const { data: page } = await client.listTranscripts({ limit: 20 });
|
|
38
|
+
console.log('Completed transcripts', page.transcripts);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
main().catch((error) => {
|
|
42
|
+
console.error(error.message);
|
|
43
|
+
process.exitCode = 1;
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Request a live transcript
|
|
48
|
+
|
|
49
|
+
Enable transcription and set up billing in your API dashboard. Use `Client({ apiKey })` with a key stored on your server. With a real key, `transcribeEpisode` can start a billable transcription. Check the estimate first. [Transcription settings](https://www.listennotes.com/api/dashboard/#transcription) · [Transcription pricing](https://www.listennotes.com/api/pricing/#on-demand-transcription)
|
|
50
|
+
|
|
51
|
+
Poll `getEpisodeTranscript({ id })` until `response.data.status` is `completed` or `failed`. While the job is queued or processing, wait the number of seconds in the `Retry-After` response header before polling again. The completed response includes signed download URLs in `download_urls`. [Transcription status and downloads](https://www.listennotes.com/api/docs/#get-api-v2-episodes-id-transcript)
|
|
52
|
+
|
|
53
|
+
Pass `next_cursor` from the previous response as `cursor` in the next `listTranscripts` call. A null cursor marks the last page.
|
|
54
|
+
|
|
55
|
+
## Search podcasts and episodes
|
|
56
|
+
|
|
57
|
+
Use `search` to find podcasts and episodes by topic, person, or keyword. This example connects to the mock API when `LISTEN_API_KEY` is unset.
|
|
58
|
+
|
|
59
|
+
```js
|
|
60
|
+
const { Client } = require('podcast-api');
|
|
61
|
+
const client = Client({ apiKey: process.env.LISTEN_API_KEY || null });
|
|
62
|
+
|
|
63
|
+
client.search({ q: 'science fiction', type: 'episode' })
|
|
64
|
+
.then(({ data }) => console.log(data.results))
|
|
65
|
+
.catch((error) => console.error(error.message));
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Use `ClientForWorkers({ apiKey: env.LISTEN_API_KEY })` in Cloudflare Workers or Pages Functions. Store the key as a secret and call the same SDK methods. Keep API keys on the server. [Node.js example](https://github.com/ListenNotes/podcast-api-js/tree/main/examples/PodcastAppForNode) · [Cloudflare Workers example](https://github.com/ListenNotes/podcast-api-js/tree/main/examples/PodcastAppForWorkers)
|
|
69
|
+
|
|
70
|
+
## Frequently asked questions
|
|
71
|
+
|
|
72
|
+
### Can I generate a transcript for a podcast episode?
|
|
73
|
+
|
|
74
|
+
Yes. Use the podcast transcription API with the episode's Listen Notes ID. If the publisher supplied an existing transcript, PRO and ENTERPRISE accounts can retrieve it with `fetchEpisodeById({ id, show_transcript: 1 })`. [Podcast transcription FAQ](https://www.listennotes.com/api/faq/#faq20)
|
|
75
|
+
|
|
76
|
+
### Does the transcription API identify speakers?
|
|
77
|
+
|
|
78
|
+
Yes. When the API detects multiple speakers, TXT, SRT, and VTT outputs label who spoke. A TXT transcript can look like this.
|
|
79
|
+
|
|
80
|
+
```text
|
|
81
|
+
Speaker A: Thanks for joining us.
|
|
82
|
+
Speaker B: Happy to be here.
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Word-level JSON includes start and end timestamps in milliseconds and a speaker ID for each word when available.
|
|
86
|
+
|
|
87
|
+
### Can I store downloaded transcripts?
|
|
88
|
+
|
|
89
|
+
You can store the transcript text generated for your account. The signed links expire after 15 minutes. Call `getEpisodeTranscript` again for fresh links. [API caching FAQ](https://www.listennotes.com/api/faq/#faq7)
|
|
90
|
+
|
|
91
|
+
## API Reference
|
|
26
92
|
|
|
27
93
|
<!-- BEGIN GENERATED METHOD INDEX -->
|
|
28
94
|
|
|
@@ -53,88 +119,17 @@ If you have any questions, please contact [hello@listennotes.com](hello@listenno
|
|
|
53
119
|
- [`fetchPodcastsByDomain`](#fetchpodcastsbydomain) — `GET /podcasts/domains/{domain_name}`
|
|
54
120
|
- [`createPlaylist`](#createplaylist) — `POST /playlists`
|
|
55
121
|
- [`updatePlaylist`](#updateplaylist) — `PUT /playlists/{id}`
|
|
122
|
+
- [`deletePlaylist`](#deleteplaylist) — `DELETE /playlists/{id}`
|
|
56
123
|
- [`addPlaylistItem`](#addplaylistitem) — `POST /playlists/{id}/items`
|
|
57
124
|
- [`deletePlaylistItem`](#deleteplaylistitem) — `DELETE /playlists/{id}/items/{item_id}`
|
|
58
125
|
- [`updatePlaylistItemNotes`](#updateplaylistitemnotes) — `PUT /playlists/{id}/items/{item_id}`
|
|
126
|
+
- [`estimateEpisodeTranscription`](#estimateepisodetranscription) — `GET /episodes/{id}/transcript/estimate`
|
|
127
|
+
- [`transcribeEpisode`](#transcribeepisode) — `POST /episodes/{id}/transcript`
|
|
128
|
+
- [`getEpisodeTranscript`](#getepisodetranscript) — `GET /episodes/{id}/transcript`
|
|
129
|
+
- [`listTranscripts`](#listtranscripts) — `GET /transcripts`
|
|
59
130
|
|
|
60
131
|
<!-- END GENERATED METHOD INDEX -->
|
|
61
132
|
|
|
62
|
-
|
|
63
|
-
## Installation
|
|
64
|
-
|
|
65
|
-
Install [the official NPM package](https://www.npmjs.com/package/podcast-api) of the Listen Notes Podcast API:
|
|
66
|
-
```sh
|
|
67
|
-
npm install podcast-api --save
|
|
68
|
-
# or
|
|
69
|
-
yarn add podcast-api
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
### Requirements
|
|
74
|
-
|
|
75
|
-
- Version 3 requires Node.js 22 or higher.
|
|
76
|
-
|
|
77
|
-
## Usage
|
|
78
|
-
|
|
79
|
-
The library needs to be configured with your account's API key which is
|
|
80
|
-
available in your [Listen API Dashboard](https://www.listennotes.com/podcast-api/dashboard/#apps). Set `apiKey` to its
|
|
81
|
-
value:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
<!-- prettier-ignore -->
|
|
85
|
-
```js
|
|
86
|
-
// If you use our Podcast API with Node.js or browser javascript, then use the Client class.
|
|
87
|
-
const { Client } = require('podcast-api');
|
|
88
|
-
const client = Client({
|
|
89
|
-
apiKey: process.env.LISTEN_API_KEY || null,
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
// If you use our Podcast API with Cloudflare Workers / Pages, then use the ClientForWorkers class.
|
|
93
|
-
// Please make sure you store LISTEN_API_KEY as a secret. See example code:
|
|
94
|
-
// - https://github.com/ListenNotes/podcast-api-js/blob/main/examples/PodcastAppForWorkers/src/index.js
|
|
95
|
-
// const { ClientForWorkers } = require('podcast-api');
|
|
96
|
-
// const client = ClientForWorkers({
|
|
97
|
-
// apiKey: env.LISTEN_API_KEY || null,
|
|
98
|
-
// });
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
client.search({
|
|
102
|
-
q: 'elon musk',
|
|
103
|
-
}).then((response) => {
|
|
104
|
-
console.log(response.data);
|
|
105
|
-
}).catch((error) => {
|
|
106
|
-
if (error.response) {
|
|
107
|
-
switch (error.response.status) {
|
|
108
|
-
case 404:
|
|
109
|
-
// Endpoint not exist or podcast / episode not exist
|
|
110
|
-
break;
|
|
111
|
-
case 401:
|
|
112
|
-
// Wrong API key, or your account is suspended
|
|
113
|
-
break;
|
|
114
|
-
case 400:
|
|
115
|
-
// Invalid parameters
|
|
116
|
-
break;
|
|
117
|
-
case 500:
|
|
118
|
-
// Server-side error
|
|
119
|
-
break;
|
|
120
|
-
default:
|
|
121
|
-
// Unknown errors
|
|
122
|
-
break;
|
|
123
|
-
}
|
|
124
|
-
} else {
|
|
125
|
-
// Failed to connect to Listen API servers
|
|
126
|
-
}
|
|
127
|
-
console.log(error);
|
|
128
|
-
});
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
If `apiKey` is null, then we'll connect to a [mock server](https://www.listennotes.help/article/48-how-to-test-the-podcast-api-without-an-api-key) that returns fake data for testing purposes.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
## API Reference
|
|
137
|
-
|
|
138
133
|
<!-- BEGIN GENERATED API REFERENCE -->
|
|
139
134
|
|
|
140
135
|
Each method accepts a single parameter object and returns a promise. The examples use Node.js; Workers use the same methods on `ClientForWorkers`.
|
|
@@ -374,7 +369,11 @@ Fetch detailed meta data for an episode by id
|
|
|
374
369
|
|
|
375
370
|
`GET /episodes/{id}`
|
|
376
371
|
|
|
377
|
-
Fetch detailed
|
|
372
|
+
Fetch detailed metadata for a specific episode.
|
|
373
|
+
|
|
374
|
+
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.
|
|
375
|
+
|
|
376
|
+
If an episode has no transcript, use `POST /episodes/{id}/transcript` to request on-demand transcription on any plan.
|
|
378
377
|
|
|
379
378
|
```javascript
|
|
380
379
|
const { Client } = require('podcast-api');
|
|
@@ -783,6 +782,31 @@ client.updatePlaylist({
|
|
|
783
782
|
|
|
784
783
|
[Full API documentation](https://www.listennotes.com/api/docs/#put-api-v2-playlists-id)
|
|
785
784
|
|
|
785
|
+
### deletePlaylist
|
|
786
|
+
|
|
787
|
+
Delete a playlist.
|
|
788
|
+
|
|
789
|
+
`DELETE /playlists/{id}`
|
|
790
|
+
|
|
791
|
+
Permanently delete a playlist, including all episode and podcast references saved in this specific playlist and their notes. The actual episodes and podcasts remain in the Listen Notes podcast database.
|
|
792
|
+
|
|
793
|
+
**Warning: Deletion cannot be undone. Once deleted, the playlist is gone, regardless of how many episodes or podcasts it contains. You, the developer, are responsible for adding a confirmation step in your app's UI before calling this endpoint to prevent accidental deletion.**
|
|
794
|
+
|
|
795
|
+
Only playlists owned by your admin API account can be modified; contributor membership does not grant write access.
|
|
796
|
+
|
|
797
|
+
```javascript
|
|
798
|
+
const { Client } = require('podcast-api');
|
|
799
|
+
const client = Client({ apiKey: process.env.LISTEN_API_KEY || null });
|
|
800
|
+
|
|
801
|
+
client.deletePlaylist({
|
|
802
|
+
"id": "m1pe7z60bsw"
|
|
803
|
+
})
|
|
804
|
+
.then((response) => console.log(response.data))
|
|
805
|
+
.catch((error) => console.error(error));
|
|
806
|
+
```
|
|
807
|
+
|
|
808
|
+
[Full API documentation](https://www.listennotes.com/api/docs/#delete-api-v2-playlists-id)
|
|
809
|
+
|
|
786
810
|
### addPlaylistItem
|
|
787
811
|
|
|
788
812
|
Add an episode or podcast to a playlist.
|
|
@@ -855,6 +879,130 @@ client.updatePlaylistItemNotes({
|
|
|
855
879
|
|
|
856
880
|
[Full API documentation](https://www.listennotes.com/api/docs/#put-api-v2-playlists-id-items-item_id)
|
|
857
881
|
|
|
882
|
+
### estimateEpisodeTranscription
|
|
883
|
+
|
|
884
|
+
Estimate episode transcription cost
|
|
885
|
+
|
|
886
|
+
`GET /episodes/{id}/transcript/estimate`
|
|
887
|
+
|
|
888
|
+
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.
|
|
889
|
+
|
|
890
|
+
`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.
|
|
891
|
+
|
|
892
|
+
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.
|
|
893
|
+
|
|
894
|
+
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.
|
|
895
|
+
|
|
896
|
+
```javascript
|
|
897
|
+
const { Client } = require('podcast-api');
|
|
898
|
+
const client = Client({ apiKey: process.env.LISTEN_API_KEY || null });
|
|
899
|
+
|
|
900
|
+
client.estimateEpisodeTranscription({
|
|
901
|
+
"id": "dc09fd798802477b8dba0ca1e10134fa"
|
|
902
|
+
})
|
|
903
|
+
.then((response) => console.log(response.data))
|
|
904
|
+
.catch((error) => console.error(error));
|
|
905
|
+
```
|
|
906
|
+
|
|
907
|
+
[Full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-episodes-id-transcript-estimate)
|
|
908
|
+
|
|
909
|
+
### transcribeEpisode
|
|
910
|
+
|
|
911
|
+
Request episode transcription
|
|
912
|
+
|
|
913
|
+
`POST /episodes/{id}/transcript`
|
|
914
|
+
|
|
915
|
+
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.
|
|
916
|
+
|
|
917
|
+
**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.**
|
|
918
|
+
|
|
919
|
+
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.
|
|
920
|
+
|
|
921
|
+
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.
|
|
922
|
+
|
|
923
|
+
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.
|
|
924
|
+
|
|
925
|
+
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.
|
|
926
|
+
|
|
927
|
+
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.
|
|
928
|
+
|
|
929
|
+
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.
|
|
930
|
+
|
|
931
|
+
No request body is required. Normal API request accounting applies even when the transcription fee is zero.
|
|
932
|
+
|
|
933
|
+
```javascript
|
|
934
|
+
const { Client } = require('podcast-api');
|
|
935
|
+
const client = Client({ apiKey: null });
|
|
936
|
+
|
|
937
|
+
client.transcribeEpisode({
|
|
938
|
+
"id": "1871d978bdc648588441bc5649857ddb"
|
|
939
|
+
})
|
|
940
|
+
.then((response) => console.log(response.data))
|
|
941
|
+
.catch((error) => console.error(error));
|
|
942
|
+
```
|
|
943
|
+
|
|
944
|
+
[Full API documentation](https://www.listennotes.com/api/docs/#post-api-v2-episodes-id-transcript)
|
|
945
|
+
|
|
946
|
+
### getEpisodeTranscript
|
|
947
|
+
|
|
948
|
+
Get episode transcription status and downloads
|
|
949
|
+
|
|
950
|
+
`GET /episodes/{id}/transcript`
|
|
951
|
+
|
|
952
|
+
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.
|
|
953
|
+
|
|
954
|
+
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.
|
|
955
|
+
|
|
956
|
+
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.
|
|
957
|
+
|
|
958
|
+
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.
|
|
959
|
+
|
|
960
|
+
```
|
|
961
|
+
Speaker A: Thanks for joining us.
|
|
962
|
+
|
|
963
|
+
Speaker B: Happy to be here.
|
|
964
|
+
```
|
|
965
|
+
|
|
966
|
+
Word-level JSON includes start and end timestamps in milliseconds and a `speaker` ID for each word, or `null` when a label is unavailable.
|
|
967
|
+
|
|
968
|
+
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.
|
|
969
|
+
|
|
970
|
+
```javascript
|
|
971
|
+
const { Client } = require('podcast-api');
|
|
972
|
+
const client = Client({ apiKey: process.env.LISTEN_API_KEY || null });
|
|
973
|
+
|
|
974
|
+
client.getEpisodeTranscript({
|
|
975
|
+
"id": "1871d978bdc648588441bc5649857ddb"
|
|
976
|
+
})
|
|
977
|
+
.then((response) => console.log(response.data))
|
|
978
|
+
.catch((error) => console.error(error));
|
|
979
|
+
```
|
|
980
|
+
|
|
981
|
+
[Full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-episodes-id-transcript)
|
|
982
|
+
|
|
983
|
+
### listTranscripts
|
|
984
|
+
|
|
985
|
+
List completed episode transcripts
|
|
986
|
+
|
|
987
|
+
`GET /transcripts`
|
|
988
|
+
|
|
989
|
+
List your API account's completed transcripts, newest completion first. Queued, processing, failed, and superseded attempts are excluded.
|
|
990
|
+
|
|
991
|
+
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.
|
|
992
|
+
|
|
993
|
+
```javascript
|
|
994
|
+
const { Client } = require('podcast-api');
|
|
995
|
+
const client = Client({ apiKey: process.env.LISTEN_API_KEY || null });
|
|
996
|
+
|
|
997
|
+
client.listTranscripts({
|
|
998
|
+
"limit": 20
|
|
999
|
+
})
|
|
1000
|
+
.then((response) => console.log(response.data))
|
|
1001
|
+
.catch((error) => console.error(error));
|
|
1002
|
+
```
|
|
1003
|
+
|
|
1004
|
+
[Full API documentation](https://www.listennotes.com/api/docs/#get-api-v2-transcripts)
|
|
1005
|
+
|
|
858
1006
|
<!-- END GENERATED API REFERENCE -->
|
|
859
1007
|
|
|
860
1008
|
## Development
|
|
@@ -877,11 +1025,11 @@ Run the live mock integration suite separately:
|
|
|
877
1025
|
yarn test-integration
|
|
878
1026
|
```
|
|
879
1027
|
|
|
880
|
-
This runs
|
|
1028
|
+
This runs the same cases through each client: Node (Axios) and Workers (fetch in
|
|
881
1029
|
Miniflare). They send real HTTP requests to
|
|
882
1030
|
`https://listen-api-test.listennotes.com/api/v2` without an API key, covering
|
|
883
|
-
search, podcast
|
|
884
|
-
|
|
1031
|
+
search, podcast and playlist requests, transcription, response headers, and a
|
|
1032
|
+
missing route. Requests are restricted to that mock URL, redirects
|
|
885
1033
|
are disabled, and requests have a 15-second timeout. The mock returns fixed
|
|
886
1034
|
responses; these tests do not verify persistence or production authorization.
|
|
887
1035
|
CI runs this suite separately on Node.js 24, so a mock service outage can fail
|
|
@@ -894,3 +1042,5 @@ Generated methods,
|
|
|
894
1042
|
Edit the canonical OpenAPI specification or SDK registry there, then regenerate.
|
|
895
1043
|
The transport implementations and README content outside generation markers
|
|
896
1044
|
remain handwritten. The package and tests run independently of that generator.
|
|
1045
|
+
|
|
1046
|
+
For SDK questions, [email Listen Notes](mailto:hello@listennotes.com).
|
package/package.json
CHANGED
package/src/PodcastApiMethods.js
CHANGED
|
@@ -83,6 +83,9 @@ const addApiMethodsToClient = (client) => {
|
|
|
83
83
|
client.updatePlaylist = (params = {}) => request(
|
|
84
84
|
client.httpClient, "PUT", "/playlists/{id}",
|
|
85
85
|
{"path": ["id"], "query": [], "body": ["name", "description", "visibility", "type"]}, params);
|
|
86
|
+
client.deletePlaylist = (params = {}) => request(
|
|
87
|
+
client.httpClient, "DELETE", "/playlists/{id}",
|
|
88
|
+
{"path": ["id"], "query": [], "body": []}, params);
|
|
86
89
|
client.addPlaylistItem = (params = {}) => request(
|
|
87
90
|
client.httpClient, "POST", "/playlists/{id}/items",
|
|
88
91
|
{"path": ["id"], "query": [], "body": ["episode_id", "podcast_id", "notes"]}, params);
|
|
@@ -92,6 +95,18 @@ const addApiMethodsToClient = (client) => {
|
|
|
92
95
|
client.updatePlaylistItemNotes = (params = {}) => request(
|
|
93
96
|
client.httpClient, "PUT", "/playlists/{id}/items/{item_id}",
|
|
94
97
|
{"path": ["id", "item_id"], "query": [], "body": ["notes"]}, params);
|
|
98
|
+
client.estimateEpisodeTranscription = (params = {}) => request(
|
|
99
|
+
client.httpClient, "GET", "/episodes/{id}/transcript/estimate",
|
|
100
|
+
{"path": ["id"], "query": [], "body": []}, params);
|
|
101
|
+
client.transcribeEpisode = (params = {}) => request(
|
|
102
|
+
client.httpClient, "POST", "/episodes/{id}/transcript",
|
|
103
|
+
{"path": ["id"], "query": [], "body": []}, params);
|
|
104
|
+
client.getEpisodeTranscript = (params = {}) => request(
|
|
105
|
+
client.httpClient, "GET", "/episodes/{id}/transcript",
|
|
106
|
+
{"path": ["id"], "query": [], "body": []}, params);
|
|
107
|
+
client.listTranscripts = (params = {}) => request(
|
|
108
|
+
client.httpClient, "GET", "/transcripts",
|
|
109
|
+
{"path": [], "query": ["limit", "cursor"], "body": []}, params);
|
|
95
110
|
return client;
|
|
96
111
|
};
|
|
97
112
|
|
package/src/api-contract.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema_version": 1,
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"operations": [
|
|
5
5
|
{
|
|
6
6
|
"operationId": "search",
|
|
@@ -394,7 +394,7 @@
|
|
|
394
394
|
"show_transcript": 1
|
|
395
395
|
},
|
|
396
396
|
"summary": "Fetch detailed meta data for an episode by id",
|
|
397
|
-
"description": "Fetch detailed
|
|
397
|
+
"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."
|
|
398
398
|
},
|
|
399
399
|
{
|
|
400
400
|
"operationId": "getEpisodesInBatch",
|
|
@@ -815,6 +815,25 @@
|
|
|
815
815
|
"summary": "Update playlist metadata.",
|
|
816
816
|
"description": "Update any subset of name, description, visibility, and type. Omitted fields remain unchanged; at least one field is required. Switching to private rotates the playlist RSS secret. Type selects the saved default view (episode_list or podcast_list) and the returned listennotes_url; changing it preserves all existing episodes and podcasts.\n\nOnly playlists owned by your admin API account can be modified; contributor membership does not grant write access."
|
|
817
817
|
},
|
|
818
|
+
{
|
|
819
|
+
"operationId": "deletePlaylist",
|
|
820
|
+
"func": "deletePlaylist",
|
|
821
|
+
"available_from": "3.1.0",
|
|
822
|
+
"method": "DELETE",
|
|
823
|
+
"path": "/playlists/{id}",
|
|
824
|
+
"parameters": [
|
|
825
|
+
{
|
|
826
|
+
"name": "id",
|
|
827
|
+
"in": "path",
|
|
828
|
+
"required": true
|
|
829
|
+
}
|
|
830
|
+
],
|
|
831
|
+
"example_params": {
|
|
832
|
+
"id": "m1pe7z60bsw"
|
|
833
|
+
},
|
|
834
|
+
"summary": "Delete a playlist.",
|
|
835
|
+
"description": "Permanently delete a playlist, including all episode and podcast references saved in this specific playlist and their notes. The actual episodes and podcasts remain in the Listen Notes podcast database.\n\n**Warning: Deletion cannot be undone. Once deleted, the playlist is gone, regardless of how many episodes or podcasts it contains. You, the developer, are responsible for adding a confirmation step in your app's UI before calling this endpoint to prevent accidental deletion.**\n\nOnly playlists owned by your admin API account can be modified; contributor membership does not grant write access."
|
|
836
|
+
},
|
|
818
837
|
{
|
|
819
838
|
"operationId": "addPlaylistItem",
|
|
820
839
|
"func": "addPlaylistItem",
|
|
@@ -906,6 +925,87 @@
|
|
|
906
925
|
},
|
|
907
926
|
"summary": "Update notes for a playlist item.",
|
|
908
927
|
"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."
|
|
928
|
+
},
|
|
929
|
+
{
|
|
930
|
+
"operationId": "estimateEpisodeTranscription",
|
|
931
|
+
"func": "estimateEpisodeTranscription",
|
|
932
|
+
"available_from": "3.2.0",
|
|
933
|
+
"method": "GET",
|
|
934
|
+
"path": "/episodes/{id}/transcript/estimate",
|
|
935
|
+
"parameters": [
|
|
936
|
+
{
|
|
937
|
+
"name": "id",
|
|
938
|
+
"in": "path",
|
|
939
|
+
"required": true
|
|
940
|
+
}
|
|
941
|
+
],
|
|
942
|
+
"example_params": {
|
|
943
|
+
"id": "dc09fd798802477b8dba0ca1e10134fa"
|
|
944
|
+
},
|
|
945
|
+
"summary": "Estimate episode transcription cost",
|
|
946
|
+
"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."
|
|
947
|
+
},
|
|
948
|
+
{
|
|
949
|
+
"operationId": "transcribeEpisode",
|
|
950
|
+
"func": "transcribeEpisode",
|
|
951
|
+
"available_from": "3.2.0",
|
|
952
|
+
"method": "POST",
|
|
953
|
+
"path": "/episodes/{id}/transcript",
|
|
954
|
+
"parameters": [
|
|
955
|
+
{
|
|
956
|
+
"name": "id",
|
|
957
|
+
"in": "path",
|
|
958
|
+
"required": true
|
|
959
|
+
}
|
|
960
|
+
],
|
|
961
|
+
"example_params": {
|
|
962
|
+
"id": "1871d978bdc648588441bc5649857ddb"
|
|
963
|
+
},
|
|
964
|
+
"summary": "Request episode transcription",
|
|
965
|
+
"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."
|
|
966
|
+
},
|
|
967
|
+
{
|
|
968
|
+
"operationId": "getEpisodeTranscript",
|
|
969
|
+
"func": "getEpisodeTranscript",
|
|
970
|
+
"available_from": "3.2.0",
|
|
971
|
+
"method": "GET",
|
|
972
|
+
"path": "/episodes/{id}/transcript",
|
|
973
|
+
"parameters": [
|
|
974
|
+
{
|
|
975
|
+
"name": "id",
|
|
976
|
+
"in": "path",
|
|
977
|
+
"required": true
|
|
978
|
+
}
|
|
979
|
+
],
|
|
980
|
+
"example_params": {
|
|
981
|
+
"id": "1871d978bdc648588441bc5649857ddb"
|
|
982
|
+
},
|
|
983
|
+
"summary": "Get episode transcription status and downloads",
|
|
984
|
+
"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."
|
|
985
|
+
},
|
|
986
|
+
{
|
|
987
|
+
"operationId": "listTranscripts",
|
|
988
|
+
"func": "listTranscripts",
|
|
989
|
+
"available_from": "3.2.0",
|
|
990
|
+
"method": "GET",
|
|
991
|
+
"path": "/transcripts",
|
|
992
|
+
"parameters": [
|
|
993
|
+
{
|
|
994
|
+
"name": "limit",
|
|
995
|
+
"in": "query",
|
|
996
|
+
"required": false
|
|
997
|
+
},
|
|
998
|
+
{
|
|
999
|
+
"name": "cursor",
|
|
1000
|
+
"in": "query",
|
|
1001
|
+
"required": false
|
|
1002
|
+
}
|
|
1003
|
+
],
|
|
1004
|
+
"example_params": {
|
|
1005
|
+
"limit": 20
|
|
1006
|
+
},
|
|
1007
|
+
"summary": "List completed episode transcripts",
|
|
1008
|
+
"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."
|
|
909
1009
|
}
|
|
910
1010
|
]
|
|
911
1011
|
}
|