Skip to Content

Search

Videos matching a query, about 20 a page.

GET
/v1/youtube/search

Authorization

apiKey
headerAuthorizationBearer <token>

An API key from the dashboard: Authorization: Bearer sapi_….

Query Parameters

query*string

What to search for.

type?string

videos (the default), shorts or live.

Value in"videos""shorts""live"
sort?string

relevance (the default) or popular (the most viewed first).

Value in"relevance""popular"
uploaded?string

today, week, month or year.

Value in"today""week""month""year"
duration?string

short (under 3 minutes), medium (3 to 20) or long (over 20).

Value in"short""medium""long"
features?string

Features the videos must have, comma-separated: hd, 4k, hdr, subtitles, creative_commons, 360.

cursor?string

nextCursor of the previous page.

maxAge?integer

How old a cached answer may be, in seconds; 0 always fetches. Default and most: the endpoint's cache lifetime.

Formatint64
Range0 <= value

Response Body

The answer.

application/json
  1. response

A page of a list, as every list endpoint answers: { "data": [...], "pagination": … }.

data*array<>
pagination*
Example Request
import { SocialAPI } from "@socialapihq/sdk";const client = new SocialAPI({ apiKey: process.env.SOCIALAPI_API_KEY });const { data, pagination } = await client.youtube.search({ query: "coffee", uploaded: "month" });
Example Response
{  "data": [    {      "id": "CLsCU_JX1eU",      "url": "https://www.youtube.com/watch?v=CLsCU_JX1eU",      "text": "Thanks to Cometeer for sponsoring this video. Get $20 off your first order, go to https://cometeer.com/speeed On Garm, \"Humanity ...",      "createdAt": null,      "author": {        "id": "UC_mmaVYaFmlfdxuKb6U69Yw",        "username": "SpeeedCo",        "displayName": "Speeed",        "avatarUrl": "https://yt3.ggpht.com/LjPimlGIsIMecxBblUySP5XIjFSOvNLR3A45NQkHLwGpwxDIkwDGKAwWzJbrfZj4Ejg72qdVfA=s68-c-k-c0x00ffffff-no-rj",        "verified": false,        "url": "https://www.youtube.com/@SpeeedCo"      },      "stats": {        "views": 3412534,        "likes": null,        "comments": null,        "shares": null,        "saves": null,        "engagementRate": null      },      "media": [        {          "kind": "video",          "url": null,          "thumbnailUrl": "https://i.ytimg.com/vi/CLsCU_JX1eU/hq720.jpg?sqp=-oaymwEcCNAFEJQDSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLBDo5LLTeXHRnOlGhn1JIcfeyIZpA",          "width": null,          "height": null,          "durationSeconds": 2527        }      ],      "hashtags": [],      "mentions": [],      "ext": {        "kind": "video",        "title": "I Tried Every Way to Make Coffee",        "durationSeconds": 2527,        "publishedText": "10 days ago",        "category": null,        "keywords": [],        "chapters": [],        "music": [],        "liveNow": false,        "unlisted": false,        "familySafe": null,        "membersOnly": false,        "channelSubscribers": null      }    },    {      "id": "SoavyxuOalY",      "url": "https://www.youtube.com/watch?v=SoavyxuOalY",      "text": "Raw America host British Chris breaks down this major FAFO as an ICE agent's coffee shop business closes after he gets ...",      "createdAt": null,      "author": {        "id": "UCyeAtCy_GiWYkWGWmgoiyiA",        "username": "RawAmericaMedia",        "displayName": "Raw America",        "avatarUrl": "https://yt3.ggpht.com/bTnKiEROqBV-rmxak5UCqz6Xg8H5vALInZ7hlzr7hMVsB_pfqCA8L1hvBZkVjGQ3MEYXyB-G=s68-c-k-c0x00ffffff-no-rj",        "verified": false,        "url": "https://www.youtube.com/@RawAmericaMedia"      },      "stats": {        "views": 10208,        "likes": null,        "comments": null,        "shares": null,        "saves": null,        "engagementRate": null      },      "media": [        {          "kind": "video",          "url": null,          "thumbnailUrl": "https://i.ytimg.com/vi/SoavyxuOalY/hq720.jpg?sqp=-oaymwEcCNAFEJQDSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLA6TDNComLsUqyQoPEkSqPTEAY3sw",          "width": null,          "height": null,          "durationSeconds": 502        }      ],      "hashtags": [],      "mentions": [],      "ext": {        "kind": "video",        "title": "Chicago coffee shop gets SHUT DOWN after owner EXPOSED as ICE AGENT!",        "durationSeconds": 502,        "publishedText": "16 hours ago",        "category": null,        "keywords": [],        "chapters": [],        "music": [],        "liveNow": false,        "unlisted": false,        "familySafe": null,        "membersOnly": false,        "channelSubscribers": null      }    }  ],  "pagination": {    "nextCursor": "EpcDEgZjb2ZmZWUajANFZ1FJQkJBQlNCU0NBUXREVEhORFZWOUtXREZsVllJQkMxTnZZWFo1ZUhWUFlXeFpnZ0VMVkY5dlVYaHBkVmRRVkZXQ0FRdFlSMDVxUTE5alMwdG1TWUlCQzFOc1VXWXROSHBRVGxOUmdnRUxRbFZrUjBWNVNHeG1aR3VDQVFzMlRIcFFRVkprVDJsbFo0SUJDM1Y1YkdwekxVVXlWbWhaZ2dFTFNYb3hZalJaYWw5VFRIZUNBUXRCYkVwUk4wVnZRbWcwZDRJQkMwWjBMUzB4YUhWSWIxQnJnZ0VMUlZKdGJuWnBZVXB3VUVtQ0FRdFlWVVZ5TmxkM1VtWmpRWUlCQzBGUGJrMUJhelZzUW10bmdnRUxlRzlqT1dsMWNE…",    "hasMore": true  }}