# YouTube Search API (youtube.search)

- Canonical page: https://everyinfra.com/en/youtube-api/search
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "youtube", "action": "search", "params": {...}}
- Price: $0.000778 per call ($0.78 per 1,000 requests); failed calls and empty results are not charged
- Returns: list, default 10, max 50 per call
- 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=search

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| keyword | not declared | yes | not declared | The search query term for the YouTube search action. If passed to compatibility inputs for the shorts action, this parameter acts as a channel name rather than initiating a site-wide Shorts search. |
| sort | enum: most_viewed / newest / relevance / top_rated | no | not declared | The sort order applied across YouTube actions. For search, accepted values are relevance, newest, most_viewed, and top_rated. For channel videos and Shorts, accepted values are newest, oldest, and popular. For comments, accepted values are newest and popular. Specifying this parameter on a single-video query does not filter that video's content. |
| limit | integer (1–50) | no | 10 | The most rows to return in this call, an integer from 1 to 50. The default applies when you leave it out, and a call can return fewer rows. Larger values return 422 before any charge. |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| 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. |
| like_count | Likes. null means the platform or this capability does not disclose it; it is not 0. |
| comment_count | Comments. null means not disclosed, not 0. |
| view_count | Views or plays. null means not disclosed, not 0. |
| duration | platform-native meaning |
| posted_at | Publish time in ISO 8601, UTC (for example 2026-08-07T12:34:56+00:00). Non-standard strings from the platform are passed through as is, so parse defensively. null means the platform does not disclose it. |
| thumbnail_url | Thumbnail link, lower resolution than image_url. |
| hashtags | Hashtags in the text, in order of appearance; absent when there are none. |
| is_comments_disabled | platform-native meaning |
| is_members_only | platform-native meaning |
| is_paid_partnership | platform-native meaning |
| author_follower_count | Author's follower count. null means not disclosed. |
| author_video_count | platform-native meaning |
| author_view_count | platform-native meaning |
| author_created_at | platform-native meaning |
| description_links | platform-native meaning |
| search_rank | platform-native meaning |
| 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": "search",
  "params": {
    "keyword": "urban gardening tutorial"
  }
}'
```

```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": "search",
        "params": {
            "keyword": "urban gardening tutorial",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

Real response to the example request above, captured 2026-09-26T08:56:04Z. `results` and `count` are real with personal information (names, handles, avatars, profile links, contact details) removed; the list keeps the first 2 of 10. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "youtube",
  "action": "search",
  "results": [
    {
      "id": "SgqP8fgnzgI",
      "url": "https://www.youtube.com/watch?v=SgqP8fgnzgI",
      "title": "Fall Garden Seed Starting: Onions, Tomatoes, Collards & More 🌱 (North Texas Guide)",
      "text": "It's time to start thinking about the fall garden here in North Texas. Starting seeds indoors now gives you a head start on cooler-weather crops and extends your growing season well into autumn.\n\nIn this video, I'm walking you through everything I'm starting right now—from bunchi…",
      "author_name": "•••",
      "author_username": "•••",
      "author_id": "•••",
      "author_url": "https://www.youtube.com/•••",
      "like_count": 867,
      "comment_count": 194,
      "view_count": 7618,
      "duration": "00:42:07",
      "posted_at": "2026-08-17T05:39:08+00:00",
      "platform": "youtube"
    },
    {
      "id": "DZuMFAlLrmE",
      "url": "https://www.youtube.com/watch?v=DZuMFAlLrmE",
      "title": "How to Fill a Raised Garden Bed for FREE!",
      "text": "Instead of buying expensive soil, I filled this garden bed organically with stuff I had lying around!\n\nHere’s the free recipe:\n🟫 Cardboard — weed blocker + worm buffet\n🌿 Old sticks — drainage + spongey structure (the older, the better)\n🍂 Dried leaves — quick compost, full of micr…",
      "author_name": "•••",
      "author_username": "•••",
      "author_id": "•••",
      "author_url": "https://www.youtube.com/•••",
      "like_count": 86115,
      "comment_count": 1232,
      "view_count": 2811422,
      "duration": "00:00:58",
      "posted_at": "2025-06-21T21:47:59+00:00",
      "platform": "youtube"
    }
  ],
  "count": 10,
  "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
