# YouTube Hashtag API (youtube.hashtag)

- Canonical page: [https://everyinfra.com/en/youtube-api/hashtag](https://everyinfra.com/en/youtube-api/hashtag?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "youtube", "action": "hashtag", "params": {...}}
- Price: $0.000792 per call ($0.79 per 1,000 requests); failed calls and empty results are not charged
- Returns: list, one page of up to 36 per call; the number of rows varies from page to page and a short page is not the end (limit is ignored; pass the top-level next_page_token from the response as page_token for the next page; no next_page_token means the end)
- Pagination: pass next_page_token back as page_token for the next page, other params unchanged; one call per page, tokens last 24 hours
- Mode: sync; add "mode": "async" for slow tasks

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=youtube&action=hashtag

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| hashtag | not declared | yes | not declared | The hashtag for `hashtag`: its name with or without `#` (`cooking`, `#cooking`) or a hashtag page link such as `https://www.youtube.com/hashtag/cooking`; case does not matter. Letters, digits and underscores in any script, no spaces, at most 100 characters. A value that is not recognized returns 422 and is not charged; a hashtag with nothing to watch returns an empty result and is not charged. |
| country | not declared | no | not declared | Country, as a two-letter code such as `US` or `JP`; `US` when left out. It changes which videos YouTube shows. A value that is not recognized returns 422 and is not charged. |
| language | not declared | no | not declared | Interface language, as a language code such as `en`, `ja` or `zh-CN`; `en` when left out. It changes how `published_text` is written and which title shows when a creator set titles in several languages; content is not translated. A value that is not recognized returns 422 and is not charged. |
| page_token | not declared | no | not declared | Page token. Leave it out for the first page, then pass back the previous response's `next_page_token` exactly as received, with the other parameters unchanged, `language` and `country` included. About 6 to 36 per page depending on the hashtag, and most hashtags end on the first page; each page is one call and `limit` has no effect. Tokens last 24 hours, and the last page has no `next_page_token`. |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| type | Record type; values depend on the capability (for example video / image / text). |
| id | The record's unique ID on the platform. Unique only within one platform; IDs can repeat across platforms. |
| url | Link to the record on the platform. |
| title | Title. null when the platform has no titles (for example text-only posts). |
| text | Body text with HTML removed, returned in full and never cut short (on a few platforms the list results themselves carry only an excerpt; the platform's field notes say so). |
| author_name | Author's display name. |
| author_username | Author's username (@handle), usually usable in URLs. |
| author_id | Author's unique ID on the platform. |
| author_url | Link to the author's profile on the platform. |
| author_avatar_url | Link to the author's avatar image (on most platforms the link is signed and expires). |
| author_is_verified | Whether the channel has a verified badge. |
| view_count | Views or plays. null means not disclosed, not 0. |
| view_count_estimated | true means view_count (views) is an estimate converted from the rounded figure YouTube displays (such as 1.2M), not an exact count. The field does not appear when the count is exact. |
| duration | Duration; on `channel_lives`, `playlist_videos`, `video_search` and `hashtag` it is written as H:MM:SS. |
| published_text | Publish time as written on the YouTube page, in relative form (e.g. `2 years ago`), returned as is; null when the page shows none. |
| thumbnail_url | Thumbnail link, lower resolution than image_url. |
| preview_url | Link to the video's preview (`channel_lives`, `playlist_videos`, `video_search`, `hashtag`). |
| badges | Badges shown on the video, as an array of strings (e.g. `4K`, `CC`, `New`); an empty array when there are none. |
| is_live | Whether the video is live now. |
| is_upcoming | Whether it is a premiere or scheduled live stream that has not started yet. |
| hashtag_name | The hashtag's name without `#`, as the YouTube hashtag page writes it (`hashtag`); first page only, the same on every row. |
| hashtag_video_count | Number of videos under the hashtag (`hashtag`), the rounded figure on the YouTube hashtag page turned into an integer; first page only, the same on every row, absent when YouTube shows none. |
| hashtag_video_count_estimated | true means hashtag_video_count is an estimate converted from the rounded figure YouTube displays (such as 43M), not an exact count. |
| hashtag_channel_count | Number of channels that used the hashtag (`hashtag`), the rounded figure on the YouTube hashtag page turned into an integer; first page only, the same on every row, absent when YouTube shows none. |
| hashtag_channel_count_estimated | true means hashtag_channel_count is an estimate converted from the rounded figure YouTube displays (such as 4.3M), not an exact count. |
| platform | Source platform identifier, the same as platform in the request (for example xiaohongshu, tiktok). |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "youtube",
  "action": "hashtag",
  "params": {
    "hashtag": "cooking"
  }
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "youtube",
        "action": "hashtag",
        "params": {
            "hashtag": "cooking",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

No real sample for these example parameters yet: structure only, every value is a placeholder (…).

```text
{
  "id": "req_…",
  "platform": "youtube",
  "action": "hashtag",
  "results": [
    {
      "type": …,
      "id": …,
      "url": …,
      "title": …,
      "text": …,
      "author_name": …,
      "author_username": …,
      "author_id": …,
      "author_url": …,
      "author_avatar_url": …,
      "author_is_verified": …,
      "view_count": …,
      "view_count_estimated": …,
      "duration": …,
      "published_text": …,
      "thumbnail_url": …,
      "preview_url": …,
      "badges": …,
      "is_live": …,
      "is_upcoming": …,
      "hashtag_name": …,
      "hashtag_video_count": …,
      "hashtag_video_count_estimated": …,
      "hashtag_channel_count": …,
      "hashtag_channel_count_estimated": …,
      "platform": …
    }
  ],
  "next_page_token": …,
  "pagination": { … },
  "count": …,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=youtube
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
