# YouTube Trending

Get trending videos from YouTube by category and region.

- **Documentation:** [https://scrappa.co/docs/youtube-api/youtube_trending](https://scrappa.co/docs/youtube-api/youtube_trending)
- **API group:** YouTube API
- **Endpoint:** `GET https://scrappa.co/api/youtube/trending`

## Authentication

Send your Scrappa API key in the `X-API-KEY` request header. Paid endpoints also support accountless x402 payments when called without an API key.

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `type` | string | No | Trending category: now, music, gaming, movies |
| `gl` | string | No | Country code (e.g., US, DE) |
| `hl` | string | No | Language code (e.g., en) |
| `continuation` | string | No | Continuation token from a previous response, used to fetch the next page. |

## Example request

```bash
#!/bin/bash

curl -X GET \
    -H "x-api-key: YOUR_API_KEY_HERE" \
    "https://scrappa.co/api/youtube/trending?type=music&gl=US"
```

## Example response

```json
{
    "results": [
        {
            "type": "video",
            "id": "dQw4w9WgXcQ",
            "title": "Rick Astley - Never Gonna Give You Up (Official Video)",
            "description": "The official video for Never Gonna Give You Up by Rick Astley.",
            "thumbnail": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg",
            "duration": "3:33",
            "viewCount": "1.7B views",
            "publishedTime": "16 years ago",
            "channel": {
                "id": "UCuAXFkgsw1L7xaCfnd5JJOw",
                "name": "Rick Astley",
                "thumbnail": "https://yt3.ggpht.com/example.jpg",
                "verified": false,
                "isVerifiedArtist": true,
                "url": "https://www.youtube.com/@RickAstleyYT"
            },
            "badges": [
                "New"
            ],
            "isLive": false,
            "isShort": false,
            "isPremium": false
        }
    ],
    "pagination": {
        "hasMore": true
    },
    "filters": {
        "type": "music",
        "sort": "view_count",
        "hl": "en",
        "gl": "US"
    },
    "type": "music",
    "source": "trending",
    "locale": {
        "hl": "en",
        "gl": "US"
    }
}
```

## Errors

| Status | Error | Description |
| --- | --- | --- |
|  | Validation failed - type must be one of: now, music, gaming, movies; gl must be a 2-letter country code; hl must be a 2-letter language code |  |

## More Scrappa resources

- [API documentation](https://scrappa.co/docs)
- [Full LLM-readable API reference](https://scrappa.co/llms-full.txt)
- [OpenAPI specification](https://scrappa.co/docs/api.json)
- [Pricing](https://scrappa.co/pricing)
