Docs menu

YouTube videos by hashtag

Beta GET /v1/youtube/search/hashtag

GET /v1/youtube/search/hashtag

Videos (or Shorts) on a hashtag's page. The all tab holds about 30 videos and usually no next page; the short tab pages with cursor.

  • Cost: 1 credit
  • Status: Beta. Built and tested against recorded responses; the shape may still gain fields.
  • Cache: Results are kept up to 30 days; send max_age_days to reuse them for free.
  • Timeout: A request still running after about 25 seconds answers 202 with a job to poll (Batch and jobs).

Parameters#

NameTypeRequiredDescription
hashtagstringyesHashtag, with or without #.
typestringnoKind of result. One of all, short. Also accepted values: shorts for short.

Every request also accepts:

  • cursor: the cursor from the previous page (Pagination).
  • trim: true for a smaller response without null fields and extra.
  • raw: true to also get the platform's original object as raw.
  • max_age_days: accept a cached result up to this many days old, for 0 credits (Caching).

Example request#

Set your key in the environment first (see Authentication).

curl
curl -G "https://api.socialscrape.io/v1/youtube/search/hashtag" \
  -H "x-api-key: $SOCIALSCRAPE_API_KEY" \
  --data-urlencode "hashtag=minecraft"
Python
import os
import requests

params = {
    "hashtag": "minecraft",
}
res = requests.get(
    "https://api.socialscrape.io/v1/youtube/search/hashtag",
    headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},
    params=params,
)
body = res.json()

if body["ok"]:
    print(body["data"])
else:
    print(body["error"]["code"], body["error"]["message"])
TypeScript
const url = new URL("https://api.socialscrape.io/v1/youtube/search/hashtag");
url.search = new URLSearchParams({
  "hashtag": "minecraft"
}).toString();
const res = await fetch(url, {
  headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },
});
const body = await res.json();

if (body.ok) {
  console.log(body.data);
} else {
  console.error(body.error.code, body.error.message);
}
n8n
{
  "nodes": [
    {
      "name": "SocialScrape YouTube videos by hashtag",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        0,
        0
      ],
      "parameters": {
        "method": "GET",
        "url": "https://api.socialscrape.io/v1/youtube/search/hashtag",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "hashtag",
              "value": "minecraft"
            }
          ]
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "x-api-key",
              "value": "={{ $env.SOCIALSCRAPE_API_KEY }}"
            }
          ]
        }
      }
    }
  ],
  "connections": {}
}

Example response#

This is a sample from a recorded response, lists and long text are shortened. Status 200.

{
  "ok": true,
  "credits_charged": 1,
  "credits_remaining": 4999,
  "cached": false,
  "cached_at": null,
  "request_id": "req_1f827a4f0a9a06a75bba3a8b",
  "data": {
    "object": "list",
    "items": [
      {
        "object": "post",
        "platform": "youtube",
        "id": "PkI-vfHANSE",
        "url": "https://www.youtube.com/watch?v=PkI-vfHANSE",
        "type": "video",
        "author": {
          "id": "UC0h07r_UgTD0Tc-Dn5XLX3g",
          "handle": null,
          "name": "Wisp",
          "url": "https://www.youtube.com/channel/UC0h07r_UgTD0Tc-Dn5XLX3g",
          "avatar_url": null,
          "verified": true
        },
        "title": "Minecraft, But Fishing Drops Custom Items...",
        "text": null,
        "published_at": "2026-10-29T00:00:00Z",
        "duration_seconds": 2376.0,
        "language": null,
        "hashtags": null,
        "mentions": null,
        "stats": {
          "views": 475245,
          "likes": null,
          "comments": null,
          "shares": null,
          "saves": null,
          "dislikes": null
        },
        "media": {
          "thumbnail_url": "https://i.ytimg.com/vi/PkI-vfHANSE/hq2.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLBvwWMnkOQPKX7UyJXSmA1PjZWcfA",
          "video_url": null,
          "audio_url": null,
          "image_urls": null,
          "width": null,
          "height": null
        },
        "song": null,
        "location": null,
        "is_pinned": null,
        "is_sponsored": null,
        "extra": {
          "published_at_approximate": true,
          "published_text": "1 day ago",
          "views_text": "475,245 views"
        }
      },
      {
        "object": "post",
        "platform": "youtube",
        "id": "UJXwiq0AnW4",
        "url": "https://www.youtube.com/watch?v=UJXwiq0AnW4",
        "type": "video",
        "author": {
          "id": "UCWVSknuLPIRVGWf-4bFKT4Q",
          "handle": null,
          "name": "Johnny Minecraft",
          "url": "https://www.youtube.com/channel/UCWVSknuLPIRVGWf-4bFKT4Q",
          "avatar_url": null,
          "verified": true
        },
        "title": "Hiding in a SECRET BASE INSIDE the TOILET in Minecraft",
        "text": null,
        "published_at": "2026-10-29T18:00:00Z",
        "duration_seconds": 807.0,
        "language": null,
        "hashtags": null,
        "mentions": null,
        "stats": {
          "views": 81512,
          "likes": null,
          "comments": null,
          "shares": null,
          "saves": null,
          "dislikes": null
        },
        "media": {
          "thumbnail_url": "https://i.ytimg.com/vi/UJXwiq0AnW4/hq2.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLAlD9UeQyyO3xbKOCesoAfzKuw9xg",
          "video_url": null,
          "audio_url": null,
          "image_urls": null,
          "width": null,
          "height": null
        },
        "song": null,
        "location": null,
        "is_pinned": null,
        "is_sponsored": null,
        "extra": {
          "published_at_approximate": true,
          "published_text": "8 hours ago",
          "views_text": "81,512 views"
        }
      }
    ],
    "cursor": null,
    "has_more": false,
    "parent": null
  },
  "cursor": null,
  "has_more": false
}

Response#

A list of Post objects in data.items, with data.cursor and data.has_more.

See Data models for every field. The envelope around data is described in Responses.

Errors#

Failures are free: credits_charged is 0. Branch on error.code, never on the message.

CodeHTTPRetryMeaning
invalid_params400noA parameter is missing, unknown or has the wrong type.
not_found404noThe platform says this profile, post or item does not exist.

Every request can also fail with the account and platform errors listed on the Errors page.