# YouTube Search API

> Search YouTube by keyword and get up to 50 videos with statistics.

**Retired on 15 Sep 2026.** This endpoint is retired as of 15 September 2026. It receives no further fixes or support and may be switched off without further notice. Remove it from existing integrations; no replacement is offered.

Runs a YouTube video search and enriches each hit with duration and view, like and comment counts. Only videos with public statistics are included.

- **Endpoint:** `GET https://api.zactonz.com/tuber/v1/yt-search.php`
- **Category:** Video
- **Version:** 1
- **Status:** retired
- **Reference page:** https://developers.zactonz.com/apis/youtube-search/

## Parameters

Send parameters in the query string.

| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| `key` | string | yes |  | Your API key, repeated as a query parameter. Kept for existing integrations; the `Authorization: Bearer` header is the supported way to authenticate. |
| `q` | string | yes |  | Search terms. |

## Response

Matching videos, most relevant first.

| Field | Type | Description |
|---|---|---|
| `status` | string | `"200"` on success (a string). |
| `results` | array of object |  |
| `results[].videoId` | string | YouTube video id. |
| `results[].publishedAt` | string | ISO 8601 publish time. |
| `results[].title` | string |  |
| `results[].description` | string |  |
| `results[].thumbnail` | string | `hqdefault` thumbnail URL. |
| `results[].channelId` | string |  |
| `results[].channelTitle` | string |  |
| `results[].duration` | string | `H:MM:SS` or `MM:SS`. |
| `results[].viewCount` | string |  |
| `results[].likeCount` | string |  |
| `results[].dislikeCount` | null | Always `null`. |
| `results[].commentCount` | string |  |

```json
{
    "status": "200",
    "results": [
        {
            "videoId": "jfKfPfyJRdk",
            "publishedAt": "2022-07-12T12:00:15Z",
            "title": "lofi hip hop radio",
            "description": "beats to relax/study to",
            "thumbnail": "https://img.youtube.com/vi/jfKfPfyJRdk/hqdefault.jpg",
            "channelId": "UCSJ4gkVC6NrvII8umztf0Ow",
            "channelTitle": "Lofi Girl",
            "duration": "0:00",
            "viewCount": "1240391",
            "likeCount": "38102",
            "dislikeCount": null,
            "commentCount": "2210"
        }
    ]
}
```

## Status codes

The outcome is reported in the JSON `status` field. General rules: https://developers.zactonz.com/apis/errors.md

| status | Meaning | Description |
|---|---|---|
| `200` | OK | The search ran. `results` may be empty. |
| `502` | Search failed | YouTube's Data API rejected the request. Retry later. |
| `null` | Rejected | `key` was missing or invalid, or `q` was empty. |

## Notes

Each result costs an extra lookup for statistics, so a full page of 50 can take a few seconds. `dislikeCount` is always `null`: YouTube retired it from its Data API in 2021 and the key is kept for older clients.
