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

# YouTube Comments API

> Extract YouTube comments (text, likes, replies, author details, and publish date) from any video URL

`POST /v1/data/youtube/comments/run`

**Pricing:** $0.0005 per comment ($0.5 per 1,000).

## Request

Send the inputs under `params`. Only the keys below are accepted; any other key returns `422 invalid_params`.

**videoUrl** `string` *required*

YouTube video URL to scrape comments from. E.g. [https://www.youtube.com/watch?v=dQw4w9WgXcQ](https://www.youtube.com/watch?v=dQw4w9WgXcQ)

Format e.g. `https://www.youtube.com/watch?v=uf8ur6z6klc`.

**maxResults** `integer`

Number of comments to return (minimum 100). Use 0 for all.

Min `100`.

## Example

```bash cURL theme={null}
curl -X POST "https://api.mindcase.co/v1/data/youtube/comments/run?wait=true" \
  -H "Authorization: Bearer $MINDCASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "params": {
    "videoUrl": "https://www.youtube.com/watch?v=UF8uR6Z6KLc",
    "maxResults": 100
  }
}'
```

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

r = requests.post(
    "https://api.mindcase.co/v1/data/youtube/comments/run",
    params={"wait": "true"},
    headers={"Authorization": f"Bearer {os.environ['MINDCASE_API_KEY']}"},
    json={"params": {
    "videoUrl": "https://www.youtube.com/watch?v=UF8uR6Z6KLc",
    "maxResults": 100
}},
)
job = r.json()
rows = job.get("data", [])  # if job["status"] == "running", poll /v1/jobs/{job_id}/results
```

```javascript Node.js theme={null}
const r = await fetch("https://api.mindcase.co/v1/data/youtube/comments/run?wait=true", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MINDCASE_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ params: {
  "videoUrl": "https://www.youtube.com/watch?v=UF8uR6Z6KLc",
  "maxResults": 100
} }),
});
const job = await r.json();
const rows = job.data ?? []; // if job.status === "running", poll /v1/jobs/{job_id}/results
```

## Response fields

Each row in `data` is one comment, keyed by these fields.

| Field | Name | Type |
| - | - | - |
| `comment` | Comment | text |
| `likes` | Likes | number |
| `replies` | Replies | number |
| `author` | Author | text |
| `authorChannelId` | Author Channel ID | text |
| `authorVerified` | Author Verified | boolean |
| `authorIsArtist` | Author Is Artist | boolean |
| `authorIsOwner` | Author Is Owner | boolean |
| `authorThumbnail` | Author Thumbnail | url |
| `published` | Published | text |
| `publishedRelative` | Published (relative) | text |
| `commentId` | Comment ID | text |
| `videoUrl` | Video URL | url |
| `commentUrl` | Comment URL | url |

## Example response

Abridged: long text and lists are shortened.

```json theme={null}
{
  "job_id": "7f3a1c2e-0b9d-4c55-9a51-3f2e8d1b6a40",
  "agent": "youtube/comments",
  "status": "completed",
  "row_count": 1,
  "truncated": false,
  "data": [
    {
      "authorIsOwner": false,
      "authorChannelId": "UC9cOXafVqm4M7jHPy6axtmg",
      "videoUrl": "https://www.youtube.com/watch?v=UF8uR6Z6KLc",
      "author": "@frea05",
      "authorIsArtist": false,
      "comment": "\"Your time is limited, so don't waste it living someone else's life\" - Steve Jobs",
      "published": "2021-08-16T00:00:00Z",
      "commentId": "UgxliuUei-a616X3PcV4AaABAg",
      "authorThumbnail": null,
      "authorVerified": false,
      "commentUrl": "https://www.youtube.com/watch?v=UF8uR6Z6KLc&lc=UgxliuUei-a616X3PcV4AaABAg",
      "likes": 12000,
      "replies": 52,
      "publishedRelative": "5 years ago"
    }
  ]
}
```

## Related APIs

For the video itself use [`youtube/videos`](https://docs.mindcase.co/apis/youtube/videos).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.