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

# Get YouTube Video Comments

> Retrieve public comments for a video with pagination and sorting controls.

## Description

This endpoint retrieves comments from a YouTube video with support for pagination and different sorting orders. Includes comment content, author information, engagement metrics, and timestamps.

## Endpoint

```
POST https://app.dumplingai.com/api/v1/youtube/video/comments
```

## Headers

* **Content-Type:** `application/json`
* **Authorization:** Bearer `<API_KEY>` (required)

## Request Body

```json theme={null}
{
  "url": "string", // Required. Full YouTube video URL
  "continuationToken": "string", // Optional. Token for pagination from previous response
  "order": "string" // Optional. Sort order: "top" or "newest". Default: "top"
}
```

### Accepted Values for `order`

| Value  | Description                           |
| ------ | ------------------------------------- |
| top    | Sort by most liked comments first     |
| newest | Sort by most recently posted comments |

## Responses

### Success (200)

Returns an array of comments from the specified video with pagination support.

```json theme={null}
{
  "comments": [
    {
      "id": "Ugz1234567890abcdefghij",
      "content": "This CSS tutorial is incredibly helpful! The flexbox examples at 8:45 finally made it click for me. Thank you! 🎉",
      "publishedTimeText": "2 hours ago",
      "publishedTime": "2024-01-15T14:30:00.000Z",
      "replyLevel": 0,
      "author": {
        "name": "John Doe",
        "channelId": "UCuserChannelId123",
        "isVerified": true,
        "isCreator": false,
        "avatarUrl": "https://yt3.googleusercontent.com/ytc/AIdro_avatar_url",
        "channelUrl": "https://www.youtube.com/channel/UCuserChannelId123"
      },
      "engagement": {
        "likes": 1250,
        "replies": 23
      }
    },
    {
      "id": "Ugz9876543210jihgfedcba",
      "content": "Quick question: would you recommend using CSS Grid for the entire layout or just specific components? Great explanation btw!",
      "publishedTimeText": "1 day ago",
      "publishedTime": "2024-01-14T10:15:00.000Z",
      "replyLevel": 0,
      "author": {
        "name": "Jane Smith",
        "channelId": "UCanotherUserId456",
        "isVerified": false,
        "isCreator": false,
        "avatarUrl": "https://yt3.googleusercontent.com/ytc/AIdro_another_avatar",
        "channelUrl": "https://www.youtube.com/channel/UCanotherUserId456"
      },
      "engagement": {
        "likes": 89,
        "replies": 5
      }
    }
  ],
  "continuationToken": "Eg0SC1UyN..."
}
```

* **Content-Type:** application/json
* **X-RateLimit-Limit:** The rate limit for the user
* **X-RateLimit-Remaining:** The remaining number of requests for the user

### Bad Request (400)

Returned if the request is invalid or missing required parameters.

```json theme={null}
{
  "error": "'url' parameter is required and must be a non-empty string. Please provide a YouTube video URL."
}
```

### Bad Gateway (502)

Returned if the external service is unavailable or returns invalid data.

```json theme={null}
{
  "error": "Failed to retrieve YouTube video comments"
}
```

### Internal Server Error (500)

Returned if there's an unexpected server error.

```json theme={null}
{
  "error": "An unexpected server error occurred while fetching YouTube video comments"
}
```

## Example Request

```bash theme={null}
curl -X POST https://app.dumplingai.com/api/v1/youtube/video/comments \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "order": "top"
}'
```

## Example Response

```json theme={null}
{
  "comments": [
    {
      "id": "Ugz1234567890abcdefghij",
      "content": "This CSS tutorial is incredibly helpful! The flexbox examples at 8:45 finally made it click for me. Thank you! 🎉",
      "publishedTimeText": "2 hours ago",
      "publishedTime": "2024-01-15T14:30:00.000Z",
      "replyLevel": 0,
      "author": {
        "name": "John Doe",
        "channelId": "UCuserChannelId123",
        "isVerified": true,
        "isCreator": false,
        "avatarUrl": "https://yt3.googleusercontent.com/ytc/AIdro_avatar_url",
        "channelUrl": "https://www.youtube.com/channel/UCuserChannelId123"
      },
      "engagement": {
        "likes": 1250,
        "replies": 23
      }
    }
  ],
  "continuationToken": "Eg0SC1UyN..."
}
```

## Notes

* The `url` parameter must be a valid YouTube video URL
* Comments are returned in the specified sort order (`top` or `newest`)
* The `continuationToken` from the response can be used to fetch additional comments
* `replyLevel` indicates the nesting level of the comment (0 = top-level comment)
* Author information includes verification status and creator badges
* Engagement metrics show like count and reply count for each comment
* Some videos may have comments disabled, resulting in an empty comments array
* This endpoint uses **10 credits** per request

## Rate Limiting

Rate limit headers (`X-RateLimit-Limit` and `X-RateLimit-Remaining`) are included in the response to indicate the user's current rate limit status.


## OpenAPI

````yaml POST /api/v1/youtube/video/comments
openapi: 3.0.3
info:
  title: DumplingAI API
  version: 1.0.0
  description: >
    REST API for DumplingAI's content intelligence and automation platform.

    All endpoints are grouped under `/api/v1`; most are secured via Bearer API
    keys unless an operation explicitly sets `security: []`.
servers:
  - url: https://app.dumplingai.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: YouTube
    description: Access metadata, search results, and transcripts from YouTube.
  - name: TikTok
    description: Retrieve TikTok profile, video, follower, and transcript data.
  - name: LinkedIn
    description: Programmatically fetch LinkedIn company and profile data.
  - name: Search
    description: Search-orientated endpoints spanning web, news, maps, and autocomplete.
  - name: Google
    description: Integrations with Google business listings and location data.
  - name: Scraping
    description: Webpage capture, crawling, and structured content extraction utilities.
  - name: Documents
    description: Document processing, conversion, and metadata utilities.
  - name: AI
    description: DumplingAI agent and knowledge base endpoints.
  - name: Developer Tools
    description: Utilities for executing sandboxed code via API.
paths:
  /api/v1/youtube/video/comments:
    post:
      tags:
        - YouTube
      summary: List YouTube video comments
      description: >-
        Retrieve public comments for a video with pagination and sorting
        controls.
      operationId: listYouTubeVideoComments
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/YouTubeCommentsRequest'
      responses:
        '200':
          description: Comments retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/YouTubeCommentsResponse'
        '400':
          description: Invalid request payload.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid API key.
        '500':
          description: Unexpected server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: Upstream YouTube data provider returned an error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    YouTubeCommentsRequest:
      type: object
      required:
        - url
      properties:
        url:
          type: string
          format: uri
        continuationToken:
          type: string
          description: Token to fetch the next page of comments.
        order:
          type: string
          enum:
            - top
            - newest
          default: top
        requestSource:
          $ref: '#/components/schemas/RequestSource'
    YouTubeCommentsResponse:
      type: object
      properties:
        comments:
          type: array
          items:
            $ref: '#/components/schemas/YouTubeComment'
        continuationToken:
          type: string
          nullable: true
      additionalProperties: true
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Human-readable description of what went wrong.
      required:
        - error
    RequestSource:
      type: string
      description: Optional identifier describing where the API request originated.
      enum:
        - API
        - WEB
        - MAKE_DOT_COM
        - ZAPIER
        - N8N
        - PLAYGROUND
        - DEFAULT_AUTOMATION
        - AGENT_PREVIEW
        - AGENT_LIVE
        - AUTOPILOT
        - STUDIO
    YouTubeComment:
      type: object
      properties:
        id:
          type: string
        content:
          type: string
        publishedTimeText:
          type: string
          nullable: true
        publishedTime:
          type: string
          format: date-time
          nullable: true
        replyLevel:
          type: integer
          minimum: 0
        author:
          type: object
          properties:
            name:
              type: string
            channelId:
              type: string
            isVerified:
              type: boolean
            isCreator:
              type: boolean
            avatarUrl:
              type: string
              format: uri
            channelUrl:
              type: string
              format: uri
          additionalProperties: true
        engagement:
          type: object
          properties:
            likes:
              type: integer
              nullable: true
            replies:
              type: integer
              nullable: true
          additionalProperties: false
      additionalProperties: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````