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

# YouTube Trending Videos

> Collect the videos trending in a YouTube category for a country, in rank order.

# YouTube Trending Videos

Read the trending page YouTube keeps for a category in a given country and get its videos in rank order. Pick news, gaming, sports, learning, courses, fashion or shopping and a two-letter country code; each video comes back with its rank, title, channel, view count, length, thumbnail and how long ago it was posted. Run the same category and country on a schedule to see which videos and channels hold their place and which ones climb in.

```json theme={"dark"}
{
  "category": "news",
  "region": "US",
  "results_limit": 50
}
```

category is required: news, gaming, sports, learning, courses, fashion or shopping. region is a two-letter country code and defaults to US. Returns the category's trending videos in rank order; results\_limit defaults to 50 and accepts 1 to 50.

## Standard Result Fields

Task results use the stable SocQ fields below. Source-specific field names and formats are normalized without inferring or enriching values that the source did not provide. To request a smaller field set, use `fields` for MCP queries, `_result_fields` for typed tools, or `--result-fields` in the CLI. Declared fields remain present when their value is `null`.

| Field | Type | Nullable | Description |
| - | - | - | - |
| `id` | `string` | Yes | YouTube video ID. |
| `platform` | `string` | No | Platform the result belongs to, such as `instagram` or `linkedin`. |
| `resource` | `string` | No | SocQ resource represented by the result, such as `videos` or `comments`. |
| `type` | `string` | No | Category of the result item, such as `video`, `post`, or `comment`. |
| `url` | `string` | Yes | Watch URL of the video. |
| `published_at` | `string` | Yes | Time the video was published, in ISO 8601 format. The age YouTube shows on the trending page is in published\_time\_text. |
| `collected_at` | `string` | No | Time SocQ collected or processed this result, in ISO 8601 format. |
| `rank` | `integer` | Yes | Position of the video on the trending page, starting at 1. |
| `category` | `string` | Yes | Trending category the video was listed in, such as `news` or `gaming`. |
| `region` | `string` | Yes | Two-letter country code of the trending page. |
| `title` | `string` | Yes | Title of the video. |
| `text` | `string` | Yes | Description snippet shown on the trending page. |
| `author` | `object` | Yes | Channel that published the video. |
| `author.id` | `string` | Yes | Unique identifier of the author. |
| `author.username` | `string` | Yes | Public username or handle of the account. |
| `author.name` | `string` | Yes | Display name of the author. |
| `author.url` | `string` | Yes | Public URL of the author when available. |
| `author.avatar_url` | `string` | Yes | URL of the account avatar image. |
| `author.is_verified` | `boolean` | Yes | Whether the account is verified on the platform. |
| `author.is_private` | `boolean` | Yes | Whether the account is private. |
| `metrics` | `object` | Yes | Counters and measurements available for the result item. |
| `metrics.views_count` | `integer` | Yes | View count shown on the trending page. |
| `duration_seconds` | `number` | Yes | Length of the video in seconds. |
| `thumbnail_url` | `string` | Yes | URL of the video thumbnail. |
| `published_time_text` | `string` | Yes | How long ago the video was published, as YouTube shows it, such as `3h ago`. |

The following example shows the response format for a completed task. Actual data depends on your query.

## Completed Task Response

```json theme={"dark"}
{
  "code": 200,
  "data": {
    "task_id": "example-youtube-trending-videos",
    "status": "succeeded",
    "public_id": "youtube/trending-videos",
    "result_count": 2,
    "credits_amount": 1,
    "results": {
      "limit": 50,
      "next_cursor": null,
      "has_more": false,
      "schema_id": "trending-video",
      "schema_version": "1.0",
      "items": [
        {
          "id": "X92BwhZZKOU",
          "platform": "youtube",
          "resource": "trending-videos",
          "type": "video",
          "url": "https://www.youtube.com/watch?v=X92BwhZZKOU",
          "published_at": null,
          "collected_at": "2026-11-20T08:10:17Z",
          "rank": 1,
          "category": "news",
          "region": "US",
          "title": "Historic or just a photo op? Reading Trump's Xi-Putin summit",
          "text": "US President Donald Trump hailed his unprecedented three-way summit with Chinese President Xi Jinping and Russian President Vladimir Putin as a success.",
          "author": {
            "id": "UChqUTb7kYRX8-EiaN3XFrSQ",
            "username": "Reuters",
            "name": "Reuters",
            "url": "https://www.youtube.com/@Reuters",
            "avatar_url": "https://example.com/reuters-avatar.jpg",
            "is_verified": true,
            "is_private": null
          },
          "metrics": {
            "views_count": 387
          },
          "duration_seconds": 177,
          "thumbnail_url": "https://i.ytimg.com/vi/X92BwhZZKOU/hqdefault.jpg",
          "published_time_text": "15 min ago"
        },
        {
          "id": "FKBYgR7fz0I",
          "platform": "youtube",
          "resource": "trending-videos",
          "type": "video",
          "url": "https://www.youtube.com/watch?v=FKBYgR7fz0I",
          "published_at": null,
          "collected_at": "2026-11-20T08:10:17Z",
          "rank": 2,
          "category": "news",
          "region": "US",
          "title": "Trump put Xi Jinping in HIS PLACE, expert says",
          "text": "Fox News co-host Charlie Hurt and author Gordon Chang discuss President Donald Trump's trilateral meeting with Xi Jinping and Vladimir Putin in China on 'Hannity.'",
          "author": {
            "id": "UCXIJgqnII2ZOINSWNOGFThA",
            "username": "FoxNews",
            "name": "Fox News",
            "url": "https://www.youtube.com/@FoxNews",
            "avatar_url": "https://example.com/foxnews-avatar.jpg",
            "is_verified": true,
            "is_private": null
          },
          "metrics": {
            "views_count": 4987
          },
          "duration_seconds": 496,
          "thumbnail_url": "https://i.ytimg.com/vi/FKBYgR7fz0I/hqdefault.jpg",
          "published_time_text": "1 hr ago"
        }
      ]
    }
  }
}
```


## OpenAPI

````yaml api-manual/agent-api/agent-api.json POST /v1/youtube/trending-videos
openapi: 3.1.0
info:
  title: SocQ Agent API
  version: v1-c5d5a0c07a78
  description: Asynchronous social data API generated from the SocQ Capability Registry.
servers:
  - url: https://api.socq.ai
security: []
paths:
  /v1/youtube/trending-videos:
    post:
      tags:
        - youtube
      summary: YouTube Trending Videos API
      description: >-
        Collect the videos trending in a YouTube category for a country, in rank
        order, with titles, channels, view counts, durations and thumbnails.
      operationId: socq_youtube_trending_videos
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $schema: https://json-schema.org/draft/2020-12/schema
              type: object
              additionalProperties: false
              properties:
                callback_url:
                  type: string
                  format: uri
                category:
                  type: string
                  minLength: 1
                  enum:
                    - courses
                    - fashion
                    - gaming
                    - learning
                    - news
                    - shopping
                    - sports
                  description: >-
                    Trending category: news, gaming, sports, learning, courses,
                    fashion or shopping.
                region:
                  type: string
                  minLength: 1
                  pattern: ^[A-Za-z]{2}$
                  default: US
                  description: >-
                    Two-letter country code of the trending page, such as US, GB
                    or JP.
                results_limit:
                  type: integer
                  minimum: 1
                  maximum: 50
                  default: 50
              required:
                - category
              description: >-
                category is required: news, gaming, sports, learning, courses,
                fashion or shopping. region is a two-letter country code and
                defaults to US. Returns the category's trending videos in rank
                order; results_limit defaults to 50 and accepts 1 to 50.
      responses:
        '200':
          description: Task accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentSubmitResponse'
        '422':
          description: Input validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentValidationErrorResponse'
      security:
        - bearerAuth: []
        - apiKeyAuth: []
components:
  schemas:
    AgentSubmitResponse:
      type: object
      properties:
        code:
          type: integer
          const: 200
        data:
          type: object
          properties:
            task_id:
              type: string
            status:
              type: string
            created_time:
              type:
                - string
                - 'null'
          required:
            - task_id
            - status
    AgentValidationErrorResponse:
      type: object
      properties:
        code:
          type: integer
          const: 422
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            details:
              type: object
          required:
            - message
            - type
      required:
        - code
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````

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