> ## 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 Search

> Search public YouTube videos with portable filters.

# YouTube Search

Search public videos using stable, provider-independent filters.

```json theme={"system"}
{
  "query": "web scraping tutorials",
  "results_limit": 50,
  "sort_by": "relevance",
  "published_within": "month",
  "duration": "medium",
  "has_captions": true
}
```

## Use with MCP

| Interface      | Value                                            |
| -------------- | ------------------------------------------------ |
| REST           | `POST /v1/youtube/search`                        |
| Compact MCP    | `socq_execute` with `endpoint: "youtube/search"` |
| Typed MCP      | `socq_youtube_search`                            |
| Exact-tool URL | `https://api.socq.ai/mcp?tools=youtube_search`   |
| CLI            | `socq youtube search`                            |

Use the JSON request body above as the nested `input` object for `socq_execute`, or pass the same fields directly to the typed tool. Typed tools also accept `_wait_seconds`, `_result_limit`, and `_idempotency_key`.

<Info>
  A successful collection returns a `task_id`. Continue with `socq_get_task` until the task succeeds, then read normalized records from `results.items`.
</Info>

See [MCP quickstart](/integrations/mcp) for the complete submission and polling flow.

| Field              | Accepted values                             |
| ------------------ | ------------------------------------------- |
| `sort_by`          | `relevance`, `date`, `rating`, `view_count` |
| `published_within` | `hour`, `day`, `week`, `month`, `year`      |
| `duration`         | `short`, `medium`, `long`                   |

`results_limit` defaults to 100.

Results use the normalized video structure documented in [YouTube Videos](/api-manual/youtube/videos), with `resource` set to `search`.


## OpenAPI

````yaml api-manual/agent-api/agent-api.json POST /v1/youtube/search
openapi: 3.1.0
info:
  title: SocQ Agent API
  version: v1-063d1c96173a
  description: Asynchronous social data API generated from the SocQ Capability Registry.
servers:
  - url: https://api.socq.ai
security: []
paths:
  /v1/youtube/search:
    post:
      tags:
        - youtube
      summary: YouTube Search API
      description: YouTube Search API
      operationId: socq_youtube_search
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $schema: https://json-schema.org/draft/2020-12/schema
              type: object
              additionalProperties: false
              properties:
                duration:
                  type: string
                  minLength: 1
                has_captions:
                  type: boolean
                published_within:
                  type: string
                  minLength: 1
                query:
                  type: string
                  minLength: 1
                  description: Search query.
                results_limit:
                  type: integer
                  minimum: 1
                  maximum: 2000
                sort_by:
                  type: string
                  minLength: 1
              required:
                - query
      responses:
        '200':
          description: Task accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentSubmitResponse'
      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'
            idempotent_replay:
              type: boolean
          required:
            - task_id
            - status
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````