> **For AI agents:** this page is a focused, LLM-optimized view of a
> single Fiber AI operation. Before calling it, fetch the routing
> instructions at [`https://api.fiber.ai/llms.txt`](https://api.fiber.ai/llms.txt) and the full operation
> index at [`https://api.fiber.ai/ai-docs/index.md`](https://api.fiber.ai/ai-docs/index.md).

# youtubeSearch

`POST /v1/youtube/search`

**Tags:** `YouTube`

Search YouTube videos

**Endpoint:** `https://api.fiber.ai/v1/youtube/search`

## Description

Searches YouTube for videos matching a query. Returns video titles, links, channel information, view counts, and durations.

⚡ Rate limit: 60 requests per 1 minute

💰 Cost: 2 credits per page of results ⓘ

## Request body (JSON Schema)

```json
{
  "type": "object",
  "properties": {
    "apiKey": {
      "type": "string",
      "description": "Your Fiber API key"
    },
    "query": {
      "type": "string",
      "minLength": 1,
      "description": "The search query string to find YouTube videos (e.g. 'React Hooks tutorial')."
    },
    "nextPageToken": {
      "type": [
        "string",
        "null"
      ],
      "description": "Pagination token from a previous response to retrieve the next page of search results. Omit for the first page."
    }
  },
  "required": [
    "apiKey",
    "query"
  ]
}
```

## Response — success (JSON Schema)

```json
{
  "type": "object",
  "properties": {
    "output": {
      "type": "object",
      "properties": {
        "videos": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "YouTube video ID — the unique identifier found in the URL. For example, in 'https://www.youtube.com/watch?v=094y1Z2wpJg', the video ID is '094y1Z2wpJg'."
              },
              "title": {
                "type": "string",
                "description": "Video title."
              },
              "url": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "URL to the video."
              },
              "viewCount": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Number of views."
              },
              "durationSeconds": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Video duration in seconds."
              },
              "publishedAt": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "date": {
                    "type": "string",
                    "description": "ISO 8601 date string (e.g. '2024-03-15T00:00:00.000Z')."
                  },
                  "estimated": {
                    "type": "boolean",
                    "description": "True when the date was estimated from an approximate time string (e.g. '2 years ago'). False when an exact date was available."
                  }
                },
                "required": [
                  "date",
                  "estimated"
                ],
                "description": "Publication date. When YouTube only provides approximate time (e.g. '2 years ago'), we estimate the date and set `estimated: true`."
              },
              "channel": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "id": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "YouTube channel ID."
                  },
                  "name": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Channel display name."
                  },
                  "url": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "URL to the channel page."
                  },
                  "verified": {
                    "type": [
                      "boolean",
                      "null"
                    ],
                    "description": "Whether the channel is verified."
                  }
                },
                "description": "Channel information."
              },
              "thumbnailUrl": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "URL of the video thumbnail."
              }
            },
            "required": [
              "id",
              "title"
            ]
          },
          "description": "List of video search results."
        },
        "shorts": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "YouTube video ID for this short — the unique identifier found in the URL. For example, in 'https://www.youtube.com/shorts/gGtuw7Rejtk', the video ID is 'gGtuw7Rejtk'."
              },
              "title": {
                "type": "string",
                "description": "Short title."
              },
              "url": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "URL to the short."
              },
              "viewCount": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Number of views."
              },
              "thumbnailUrl": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "URL of the short thumbnail."
              }
            },
            "required": [
              "id",
              "title"
            ]
          },
          "description": "List of YouTube Shorts matching the query."
        },
        "channels": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "YouTube channel ID."
              },
              "name": {
                "type": "string",
                "description": "Channel display name."
              },
              "url": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "URL to the channel page."
              },
              "handle": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Channel handle (e.g. '@veritasium')."
              },
              "subscriberCount": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Number of subscribers."
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Channel description snippet."
              },
              "verified": {
                "type": [
                  "boolean",
                  "null"
                ],
                "description": "Whether the channel is verified."
              },
              "thumbnailUrl": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "URL of the channel thumbnail."
              }
            },
            "required": [
              "name"
            ]
          },
          "description": "List of channel results matching the query."
        },
        "nextPageToken": {
          "type": [
            "string",
            "null"
          ],
          "description": "Token to retrieve the next page of search results. Pass this as `nextPageToken` in the next request. Null if there are no more pages."
        }
      },
      "required": [
        "videos",
        "shorts",
        "channels"
      ]
    },
    "chargeInfo": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "method": {
              "type": "string",
              "enum": [
                "charged-now"
              ]
            },
            "creditsCharged": {
              "type": "number"
            },
            "lowCreditAlert": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "getMoreCreditsUrl": {
                  "type": "string",
                  "format": "uri",
                  "description": "URL to top up credits or restart billing cycle to get fresh credits."
                },
                "message": {
                  "type": "string",
                  "description": "Human-readable credits warning."
                },
                "availableCredits": {
                  "type": "number",
                  "description": "Number of credits remaining in the current billing period."
                }
              },
              "required": [
                "getMoreCreditsUrl",
                "message",
                "availableCredits"
              ],
              "description": "Contains a link to get more credits, a warning message, and the remaining credit count."
            }
          },
          "required": [
            "method",
            "creditsCharged"
          ],
          "description": "Credits were charged immediately for this operation"
        },
        {
          "type": "object",
          "properties": {
            "method": {
              "type": "string",
              "enum": [
                "charging-later"
              ]
            },
            "message": {
              "type": "string"
            },
            "lowCreditAlert": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "getMoreCreditsUrl": {
                  "type": "string",
                  "format": "uri",
                  "description": "URL to top up credits or restart billing cycle to get fresh credits."
                },
                "message": {
                  "type": "string",
                  "description": "Human-readable credits warning."
                },
                "availableCredits": {
                  "type": "number",
                  "description": "Number of credits remaining in the current billing period."
                }
              },
              "required": [
                "getMoreCreditsUrl",
                "message",
                "availableCredits"
              ],
              "description": "Contains a link to get more credits, a warning message, and the remaining credit count."
            }
          },
          "required": [
            "method",
            "message"
          ],
          "description": "Credits will be charged after the operation completes"
        },
        {
          "type": "object",
          "properties": {
            "method": {
              "type": "string",
              "enum": [
                "charged-for-async-process"
              ]
            },
            "creditsCharged": {
              "type": "number"
            },
            "message": {
              "type": "string"
            },
            "lowCreditAlert": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "getMoreCreditsUrl": {
                  "type": "string",
                  "format": "uri",
                  "description": "URL to top up credits or restart billing cycle to get fresh credits."
                },
                "message": {
                  "type": "string",
                  "description": "Human-readable credits warning."
                },
                "availableCredits": {
                  "type": "number",
                  "description": "Number of credits remaining in the current billing period."
                }
              },
              "required": [
                "getMoreCreditsUrl",
                "message",
                "availableCredits"
              ],
              "description": "Contains a link to get more credits, a warning message, and the remaining credit count."
            }
          },
          "required": [
            "method",
            "creditsCharged",
            "message"
          ],
          "description": "Credits that were charged for an asynchronous operation"
        },
        {
          "type": "object",
          "properties": {
            "method": {
              "type": "string",
              "enum": [
                "free"
              ]
            },
            "message": {
              "type": "string"
            },
            "lowCreditAlert": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "getMoreCreditsUrl": {
                  "type": "string",
                  "format": "uri",
                  "description": "URL to top up credits or restart billing cycle to get fresh credits."
                },
                "message": {
                  "type": "string",
                  "description": "Human-readable credits warning."
                },
                "availableCredits": {
                  "type": "number",
                  "description": "Number of credits remaining in the current billing period."
                }
              },
              "required": [
                "getMoreCreditsUrl",
                "message",
                "availableCredits"
              ],
              "description": "Contains a link to get more credits, a warning message, and the remaining credit count."
            }
          },
          "required": [
            "method",
            "message"
          ],
          "description": "No credits were charged for this operation"
        },
        {
          "type": "object",
          "properties": {
            "method": {
              "type": "string",
              "enum": [
                "credits-refunded"
              ]
            },
            "creditsRefunded": {
              "type": "number"
            },
            "message": {
              "type": "string"
            },
            "lowCreditAlert": {
              "type": [
                "object",
                "null"
              ],
              "properties": {
                "getMoreCreditsUrl": {
                  "type": "string",
                  "format": "uri",
                  "description": "URL to top up credits or restart billing cycle to get fresh credits."
                },
                "message": {
                  "type": "string",
                  "description": "Human-readable credits warning."
                },
                "availableCredits": {
                  "type": "number",
                  "description": "Number of credits remaining in the current billing period."
                }
              },
              "required": [
                "getMoreCreditsUrl",
                "message",
                "availableCredits"
              ],
              "description": "Contains a link to get more credits, a warning message, and the remaining credit count."
            }
          },
          "required": [
            "method",
            "creditsRefunded",
            "message"
          ],
          "description": "Credits were refunded for this operation"
        }
      ]
    },
    "warnings": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string",
            "description": "Full path to extraneous field (e.g., 'searchParams.ExtraField')"
          },
          "message": {
            "type": "string",
            "description": "Warning message"
          }
        },
        "required": [
          "field",
          "message"
        ]
      },
      "description": "Warnings about extraneous fields in request"
    },
    "advice": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string"
      },
      "description": "Tips, recommendations, and suggestions for using this API effectively."
    }
  },
  "required": [
    "output",
    "chargeInfo"
  ],
  "additionalProperties": false
}
```

---

Canonical JSON: [`https://api.fiber.ai/openapi.json`](https://api.fiber.ai/openapi.json)
Operation index: [`https://api.fiber.ai/ai-docs/index.md`](https://api.fiber.ai/ai-docs/index.md)
