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

# YouTube Comments

> Extract YouTube comments — text, likes, timestamps, and reply threads — from video URLs, specifying max comments

`$0.7 / 1k comments`

Extract YouTube comments — text, likes, timestamps, and reply threads — from video URLs, specifying max comments

## Endpoint

`POST /api/v1/agents/youtube/comments/run`

## Parameters

<ParamField body="urls" type="array" required>
  **List** · YouTube video URLs to scrape comments from. One per line.
</ParamField>

<ParamField body="maxComments" type="integer" default={50}>
  **Number** · Max comments per video. Use 0 for all.
</ParamField>

<ParamField body="sortBy" type="string" default="0">
  **Dropdown** · Sort order for comments.

  **Options:** `0`, `1`

  *Legend: `0` = Top comments, `1` = Newest first*
</ParamField>

## Response columns

| Field              | Display name       | Type    |
| ------------------ | ------------------ | ------- |
| `videoUrl`         | Video URL          | url     |
| `videoTitle`       | Video Title        | text    |
| `commentText`      | Comment Text       | text    |
| `author`           | Author             | text    |
| `likes`            | Likes              | number  |
| `replyCount`       | Reply Count        | number  |
| `totalComments`    | Total Comments     | number  |
| `channelOwner`     | Channel Owner      | boolean |
| `heartedByCreator` | Hearted by Creator | boolean |
| `type`             | Type               | text    |

## Example

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://api.mindcase.co/api/v1/agents/youtube/comments/run \
    -H "Authorization: Bearer mk_live_abc123def456" \
    -H "Content-Type: application/json" \
    -d '{
    "params": {
      "urls": [
        {
          "url": "https://www.youtube.com/watch?v=erLbbextvlY"
        }
      ],
      "maxComments": 10
    }
  }'
  ```

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

  resp = requests.post(
      "https://api.mindcase.co/api/v1/agents/youtube/comments/run",
      headers={"Authorization": "Bearer mk_live_abc123def456"},
      json={"params": {
      "urls": [
          {
              "url": "https://www.youtube.com/watch?v=erLbbextvlY"
          }
      ],
      "maxComments": 10
  }},
  )
  data = resp.json()
  ```
</CodeGroup>

### Example response

```json Response theme={null}
{
  "job_id": "job_7f3a2b1c",
  "status": "completed",
  "data": [
    {
      "videoUrl": "https://www.youtube.com/watch?v=erLbbextvlY",
      "videoTitle": "7 Days Stranded On An Island",
      "commentText": "I tried to really slow this video down, let me know if you liked it :)",
      "author": "@MrBeast",
      "likes": 266000,
      "replyCount": 725,
      "totalComments": 151541,
      "channelOwner": true,
      "heartedByCreator": false,
      "type": "comment"
    }
  ]
}
```
