> ## Documentation Index
> Fetch the complete documentation index at: https://docs.poix.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Extracting video captions for YouTube video

> Unlock the ability to retrieve captions (subtitles) for YouTube videos. 

This guide covers fetching captions (subtitles) for YouTube videos using the Poix.io API.

### Request examples

<CodeGroup>
  ```typescript TypeScript theme={null}
  const options = {
    method: 'GET',
    headers: {
      Authorization: 'Bearer poix-xxx',
    },
  };

  fetch('https://api.poix.io/captions/dQw4w9WgXcQ', options)
    .then((response) => response.json())
    .then((response) => console.log(response))
    .catch((err) => console.error(err));
  ```

  ```bash cURL theme={null}
  curl --request GET \
    --url https://api.poix.io/captions/dQw4w9WgXcQ \
    --header 'Authorization: Bearer poix-xxx'
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.poix.io/captions/dQw4w9WgXcQ"

  headers = {"Authorization": "Bearer poix-xxx"}

  response = requests.request("GET", url, headers=headers)

  print(response.text)
  ```
</CodeGroup>

In this request, we are fetching data for the YouTube video with the ID `dQw4w9WgXcQ`. You can provide up to 1k video IDs in the `ids` array to fetch data for multiple videos.

### Response example

```json theme={null}
[
  {
    "text": "[Music]",
    "duration": 14.65,
    "offset": 0,
    "lang": "en",
    "wordCount": 1,
    "speechRate": 5
  },
  {
    "text": "we&amp;#39;re no strangers to",
    "duration": 7.239,
    "offset": 18.8,
    "lang": "en",
    "wordCount": 7,
    "speechRate": 59
  },
  // ...
  {
    "text": "goodbye",
    "duration": 5.32,
    "offset": 208.68,
    "lang": "en",
    "wordCount": 1,
    "speechRate": 12
  },
  {
    "text": "and",
    "duration": 3,
    "offset": 211,
    "lang": "en",
    "wordCount": 1,
    "speechRate": 20
  }
]
```

The response contains an array of caption objects, each representing a caption line.

Make your first request in playground on docs at [Get video captions](/api-reference/captions/get-video-captions).
