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

# Search videos by keyword

> This guide demonstrates how to use the YouTube Data API to search for videos using a specific keyword.

## API Endpoint

```bash theme={null}
curl --request GET \
  --url 'https://api.poix.io/search?q=cats&type=video&maxResults=10' \
  --header 'Authorization: Bearer <token>'
```

## Example Usage

To search for videos about "cats", you can make the following API call:

```javascript index.ts theme={null}
const API_URL = 'https://api.poix.io';

const response = await fetch(
  API_URL + '/search?q=cats&type=video&maxResults=10'
);

const data = await response.json();
```

## Response

The API will return a JSON object containing an array of video items. Each item includes:

* `videoId`: The unique identifier for the video
* `title`: The title of the video
* `description`: A brief description of the video
* `thumbnails`: Various thumbnail images for the video
* `channelTitle`: The title of the channel that uploaded the video

```json theme={null}
{
    "regionCode": "US",
    "totalResults": 1000000,
    "resultsPerPage": 10,
    "nextPageToken": "CAoQAA",
    "data": [
        {
            "kind": "youtube#video",
            "videoId": "VZ91YQ8yhkY",
            "publishedAt": "2024-09-25T17:00:21Z",
            "channelId": "UCtXn8EDGHrAL9gLppoHZXSg",
            "title": "Super Weird Things Only MALE Cats Do For Their",
           // ... other details
```

For a complete list of returned fields, please refer to the [API documentation](/api-reference/search/get-search-results).

## Error Handling

If the API call fails, it will return an appropriate HTTP status code along with an error message in the response body. Common errors include:

* 400 Bad Request: Invalid query parameters
* 403 Forbidden: Token is missing or invalid

Always handle potential errors in your code to ensure a smooth user experience.
