# Get a transcript

> Speaker-labelled, timestamped transcript of an episode, ours or the one the podcast publishes in its feed.

Source: https://www.podcastlookup.com/documentation/rest-api/get-transcript

`GET /api/v1/podcasts/{id}/episodes/{episode}/transcript` (1 credit)

## Example

```bash
curl "https://www.podcastlookup.com/api/v1/podcasts/8017674/episodes/the-future-of-audio-3f9a1c2b7e/transcript" \
  -H "Authorization: Bearer $PODCAST_LOOKUP_API_KEY"
```

## Response

Two sources share one shape, told apart by `source`:

- `podcast_lookup`: ours. Every speaker is named, with a role (host, guest…), and every segment is timestamped.
- `publisher`: the transcript the podcast publishes in its own feed, read the first time you ask for it. Speakers are as the file labels them (`"Speaker 1"`, a name, or `null` when the file has none), and `timed` is `false` when the file has no timestamps (some plain-text files), with `start_seconds` and `end_seconds` set to `null`.

**Our transcript**

```json
{
  "podcast_id": 8017674,
  "episode_id": "the-future-of-audio-3f9a1c2b7e",
  "source": "podcast_lookup",
  "language": "en",
  "speakers": [
    { "id": "S1", "name": "Jordan Lee", "role": "host" },
    { "id": "S2", "name": "Sam Rivera", "role": "guest" }
  ],
  "segments": [
    { "speaker": "Jordan Lee", "start_seconds": 0.4, "end_seconds": 6.92, "text": "Welcome back to The AI Hour." },
    { "speaker": "Sam Rivera", "start_seconds": 7.1, "end_seconds": 11.3, "text": "Thanks for having me." }
  ],
  "url": "https://www.podcastlookup.com/p/the-ai-hour/episodes/the-future-of-audio-3f9a1c2b7e"
}
```

**Publisher transcript**

```json
{
  "podcast_id": 8017674,
  "episode_id": "the-future-of-audio-3f9a1c2b7e",
  "source": "publisher",
  "language": "en",
  "format": "vtt",
  "timed": true,
  "source_url": "https://example.com/ep142.vtt",
  "files": [
    { "url": "https://example.com/ep142.vtt", "type": "text/vtt" },
    { "url": "https://example.com/ep142.srt", "type": "application/x-subrip" }
  ],
  "speakers": [
    { "id": "speaker-1", "name": "Speaker 1", "role": null },
    { "id": "speaker-2", "name": "Speaker 2", "role": null }
  ],
  "segments": [
    { "speaker": "Speaker 1", "start_seconds": 0.5, "end_seconds": 6.1, "text": "Welcome back to The AI Hour." }
  ],
  "url": "https://www.podcastlookup.com/p/the-ai-hour/episodes/the-future-of-audio-3f9a1c2b7e"
}
```

If the publisher's file can't be read (gone, or not a transcript), you get its links with `"segments": null`.

| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `source` | `"podcast_lookup" \| "publisher"` |  | Who produced the transcript. |
| `language` | `string \| null` |  | Spoken language. |
| `speakers[]` | `{ id, name, role }` |  | People in the episode and their role, such as host or guest. Publisher transcripts: the file's labels, role null. |
| `segments[].speaker` | `string \| null` |  | The speaker's name (or id when unnamed); null in publisher files without speakers. |
| `segments[].start_seconds / end_seconds` | `number \| null` |  | Position in the audio, in seconds; null when timed is false. |
| `timed` | `boolean` |  | Publisher source: whether the file has timestamps. |
| `format` | `"json" \| "vtt" \| "srt" \| "html" \| "text"` |  | Publisher source: the format of the file we read. |
| `source_url` | `string` |  | Publisher source: the file we read. |
| `files[]` | `{ url, type }` |  | Publisher source: every transcript file the feed lists. |

## Turning segments into text

**JavaScript**

```ts
const timestamp = (s: number) => new Date(s * 1000).toISOString().slice(11, 19)

const text = transcript.segments
  .map((segment) => `[${timestamp(segment.start_seconds)}] ${segment.speaker}: ${segment.text}`)
  .join("\n")
```

**Python**

```python
import time

def timestamp(seconds):
    return time.strftime("%H:%M:%S", time.gmtime(seconds))

text = "\n".join(
    f"[{timestamp(s['start_seconds'])}] {s['speaker']}: {s['text']}"
    for s in transcript["segments"]
)
```

## Errors

`404 transcript_not_available` when there is no transcript yet. The message tells you whether transcription was already requested, and how many times. [Request a transcript](https://www.podcastlookup.com/documentation/rest-api/request-transcript.md) to add it to the queue.

## MCP equivalent

`get_transcript` with `podcast_id` and `episode_id`.