# YouTube Video Transcript (Provenance) (`youtube.video_transcript_full`)

Transcript of a YouTube video or Short with timed segments, whether the captions are creator-written or speech recognition, and the video metadata in one response.

Docs: https://primaryapi.com/docs/api-reference/youtube/video_transcript_full

- Endpoint: `POST https://api.primaryapi.com/v1/run/youtube.video_transcript_full`
- Category: Video · Platform: `youtube` · Kind: transcript · Status: live
- Price: 3 credits per call; up to 7 credits if a call is retried elsewhere. A quote’s `maxCredits` is the most a given call can cost.
- Billing unit: per successful call
- Reliability: routed to a healthy upstream and retried automatically when an attempt fails; live 30-day status: `GET https://api.primaryapi.com/v1/status/apis?sku=youtube.video_transcript_full`
- Execution: synchronous (answers 202 only if it outlives the wait window)

## Input

| Field | Type | Required | Default | Constraints | Description |
|---|---|---|---|---|---|
| `url` | string | yes |  | max 2048 chars | YouTube video or Short URL, e.g. https://www.youtube.com/watch?v=dQw4w9WgXcQ or https://www.youtube.com/shorts/Fir1x9cw2vg. |
| `captionKind` | enum | no | "any" | one of: manual, automatic, any | Which caption track to accept: manual (creator-written only), automatic (speech recognition only) or any. |
| `language` | string | no |  | pattern: ^[A-Za-z]{2,3}([-_][A-Za-z0-9]{2,8})?$ | Preferred caption language code such as "en" or "es". Omit for the default track. |

Unknown fields are rejected with `400 invalid_input`. The routing controls `preferLatencyUnderMs` and `maxCredits` may be sent in the same JSON body.

## Output

When `output.found` is `true`, `output.data` has this shape:

| Field | Type | Description |
|---|---|---|
| `videoId` | string | 11-character video ID |
| `url` | string | Canonical watch URL |
| `title` | string \| null |  |
| `description` | string \| null |  |
| `image` | string \| null | Thumbnail URL |
| `channel` | string \| null | Channel title |
| `authorId` | string \| null | Channel ID (UC…) |
| `authorUrl` | string \| null |  |
| `category` | string \| null | YouTube category |
| `keywords` | string[] \| null | Creator tags |
| `likes` | integer \| null |  |
| `views` | integer \| null |  |
| `createdUtc` | string \| null | Publish time (or date), ISO 8601 |
| `durationSeconds` | number \| null | Video length in seconds |
| `language` | string \| null | Language of the returned caption track (code, or a name when the source only gives one) |
| `isAutoGenerated` | boolean \| null | true = YouTube speech recognition (ASR), false = creator-written captions, null = the source could not tell |
| `transcript` | string | Full transcript text |
| `segments` | object[] | Timed caption segments |
| `segments[].text` | string |  |
| `segments[].startSeconds` | number \| null |  |
| `segments[].endSeconds` | number \| null |  |

When the thing you asked about does not exist (or a search matches nothing) the call still succeeds: `output.found` is `false`, `output.data` is `null` and `output.reason` says why (`not_found`, `private`, `no_results`, …). Misses are free unless the notes below say misses are billed.

## Example request

```bash
curl -sS -X POST "https://api.primaryapi.com/v1/run/youtube.video_transcript_full" \
  -H "Authorization: Bearer $PRIMARYAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://www.youtube.com/watch?v=p8gV_7zFN44"}'
```

## Example response

_Values are placeholders that follow the output schema; `credits` is what this call would cost at the usual price._

```json
{
  "output": {
    "found": true,
    "data": {
      "videoId": "p8gV_7zFN44",
      "url": "https://www.youtube.com/watch?v=p8gV_7zFN44",
      "title": "Some video title",
      "description": null,
      "image": "https://i.ytimg.com/vi/p8gV_7zFN44/hqdefault.jpg",
      "channel": "Some Channel",
      "authorId": "UCxxxxxxxxxxxxxxxxxxxxxx",
      "authorUrl": "https://www.youtube.com/channel/UCxxxxxxxxxxxxxxxxxxxxxx",
      "category": "Education",
      "keywords": [
        "education",
        "tutorial"
      ],
      "likes": 234567,
      "views": 12345678,
      "createdUtc": "2024-05-12T00:00:00.000Z",
      "durationSeconds": 4783,
      "language": "en",
      "isAutoGenerated": false,
      "transcript": "Hello and welcome to this video...",
      "segments": [
        {
          "text": "Hello and welcome to this video",
          "startSeconds": 0.08,
          "endSeconds": 3.58
        }
      ]
    }
  },
  "provider": "PrimaryAPI",
  "credits": 3,
  "items": 1,
  "requestId": "req_01JBXK6Y2N9V8T4R3Q2P1M0A7Z"
}
```

## Pricing and reliability

- Usual price: 3 credits per call
- Price ceiling: up to 7 credits if a call is retried elsewhere. A quote’s `maxCredits` is the most a given call can cost; the `maxCredits` routing control caps it per call
- Live 30-day status, success rate, uptime and latency: `GET https://api.primaryapi.com/v1/status/apis?sku=youtube.video_transcript_full`

## Errors to handle

`invalid_input`, `unauthorized`, `insufficient_balance`, `key_limit_reached`, `trial_cap_reached`, `forbidden`, `not_found`, `idempotency_conflict`, `rate_limited`, `all_sources_failed`, `service_unavailable`, `timeout`. See https://primaryapi.com/docs/errors.

