Skip to content

YouTube Search API

Public YouTube search results for a query: videos and Shorts in YouTube’s ranking order, with a cursor for the next page. Calls cost 1 credit each. A cache hit is free, and a failed or empty response is never charged.

Try it

Prefilled with the request that produced the example below. No key yet? Get a free key.

Request

GET/v1/youtube/search
ParameterTypeRequiredDescription
querystringyes—
cursorstringnopagination.cursor from a previous response

Also accepts cache_max_age (a hit costs 0 credits) and include_raw (returns the untouched upstream payload under raw).

curl
curl "$API/v1/youtube/search?query=nasa%20artemis&cache_max_age=7d" \
  -H "x-api-key: $KEY"
JavaScript
const query = new URLSearchParams({
  query: 'nasa artemis',
  cache_max_age: '7d',
});

const response = await fetch(`${API}/v1/youtube/search?${query}`, {
  headers: { 'x-api-key': KEY },
});

const body = await response.json();
if (!body.success) throw new Error(body.error.code);

// 1 credit, 0 on a cache hit
console.log(body.data, body.meta.creditsCharged);
Python
import os, httpx

r = httpx.get(
    f"{os.environ['API']}/v1/youtube/search",
    params={
        "query": "nasa artemis",
        "cache_max_age": "7d",
    },
    headers={"x-api-key": os.environ["KEY"]},
    timeout=30,
)

body = r.json()
if not body["success"]:
    raise RuntimeError(body["error"]["code"])

print(body["data"], body["meta"]["creditsCharged"])

Example response

Captured on , with raw removed and lists cut to two items. A live call returns current data.

response
{
  "success": true,
  "data": {
    "items": [
      {
        "platform": "youtube",
        "id": "jfeVornFhxg",
        "type": "video",
        "url": "https://www.youtube.com/watch?v=jfeVornFhxg",
        "title": "Is this the NASA Artemis lunar landing schedule that Blue Origin and SpaceX finally meet?",
        "text": "As it turns out, there is an Artemis lunar lander update before the live broadcast one this Friday. The NASA quietly published two ...",
        "authorId": "example-user-1",
        "authorHandle": "example_user_1",
        "authorName": "Example User 1",
        "thumbnailUrl": "https://example.com/media/1.jpg",
        "mediaUrls": [],
        "durationSeconds": 812,
        "viewCount": 1772,
        "likeCount": null,
        "commentCount": null,
        "shareCount": null,
        "hashtags": [],
        "mentions": [],
        "isSponsored": null,
        "publishedAt": null,
        "fetchedAt": "2026-10-21T01:55:27.137Z"
      },
      {
        "platform": "youtube",
        "id": "Zezt6EsG9WE",
        "type": "video",
        "url": "https://www.youtube.com/watch?v=Zezt6EsG9WE",
        "title": "NASA Moon Base: Rovers and Lunar Terrain Vehicles (October 2026 Update)",
        "text": "There's a lot of ground to cover when you're building a Moon Base. From robotic rovers exploring the rugged lunar landscape to ...",
        "authorId": "UCLA_DiR1FfKNvjuUpBHmylQ",
        "authorHandle": "NASA",
        "authorName": "NASA",
        "thumbnailUrl": "https://i.ytimg.com/vi/Zezt6EsG9WE/hq720.jpg?sqp=-oaymwEcCNAFEJQDSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLD89hXnM_XZRxc5qbhG2g_q050geQ",
        "mediaUrls": [],
        "durationSeconds": 558,
        "viewCount": 115279,
        "likeCount": null,
        "commentCount": null,
        "shareCount": null,
        "hashtags": [],
        "mentions": [],
        "isSponsored": null,
        "publishedAt": null,
        "fetchedAt": "2026-10-21T01:55:27.137Z"
      }
    ]
  },
  "pagination": {
    "cursor": "eyJ0IjoiRXRnREVneHVZWE5oSUdGeWRHVnRhWE1heEFOVFFsTkRRVkpvVmxFd2VFSllNRkp3VldwR1IxcHJkRTlrYlhBeFZsaENRMU5ITVRWaVJrZERRVkYwY1ZwdFZsZGlNMHAxVW0xb05GbzBTVUpETVhCc1pXNVJNbEpZVGtoUFZtUkdaMmRGVEZNeVZUSlhSbWMwVW10b1VGTkZNa05CVVhSb1pIcHNSbFJyYkVKalYzUkNUMGxKUWtsc1FrMU5iVVpEVjI1V1JGcFZVak5pUmtZeVZHNVNTV0ZGTlV0a1IwWjVZbFJzVUZwWVpGSmtNVnAxWkVoaFEwRlJkR1pXUkdocVltcEtTMDFVVFhST1NVbENRekU1YkZwV2NGSmtlbXhSVVcxTmQyZG5SVXhpYlZwdlVraFdVRk5GTVhkTlJVZERRVkYwVjFwNU1VWlZWR1JPVkROVk1sTlpTVUpEZVRGYVZHeHdjRmxZVGxOU2VrSlNaMmRGVEU0eG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.search",
    "creditsCharged": 1,
    "cached": false,
    "cacheAgeSeconds": null,
    "durationMs": 528,
    "requestId": "req_3w24wldd6ljrt1r5pvhv"
  }
}

Returns

Returns a list of Post in data.items.

Cost and behaviour

Credits1 per live request, 0 on a cache hit
Cacheableyes: cache_max_age accepts a cached copy
Batchableyes: usable as a target in POST /v1/jobs/batch
Subscribableno

Other YouTube endpoints