Docs menu

YouTube channel details

Beta GET /v1/youtube/channel

GET /v1/youtube/channel

Name, avatar, subscribers, video and view counts, join date, country and linked links. Pass a handle, an id (channelId) or a channel url.

  • 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
handlestringone ofChannel handle, with or without @. Also accepted as username.
idstringone ofChannel id (UC...). Also accepted as channelId, channel_id.
urlURLone ofAny channel URL (/@handle, /channel/UC..., /c/name). Accepted hosts: youtube.com, youtu.be.

Send at least one of handle, id, url. If you send several, the first listed is used and the rest are ignored.

Every request also accepts:

  • 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/channel" \
  -H "x-api-key: $SOCIALSCRAPE_API_KEY" \
  --data-urlencode "handle=NASA"
Python
import os
import requests

params = {
    "handle": "NASA",
}
res = requests.get(
    "https://api.socialscrape.io/v1/youtube/channel",
    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/channel");
url.search = new URLSearchParams({
  "handle": "NASA"
}).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 channel details",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        0,
        0
      ],
      "parameters": {
        "method": "GET",
        "url": "https://api.socialscrape.io/v1/youtube/channel",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "handle",
              "value": "NASA"
            }
          ]
        },
        "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, dash characters in the text are replaced with hyphens. Status 200.

{
  "ok": true,
  "credits_charged": 1,
  "credits_remaining": 4999,
  "cached": false,
  "cached_at": null,
  "request_id": "req_361e8bbed3bc9681bdc6d240",
  "data": {
    "object": "profile",
    "platform": "youtube",
    "id": "UCLA_DiR1FfKNvjuUpBHmylQ",
    "handle": "NASA",
    "name": "NASA",
    "headline": null,
    "url": "https://www.youtube.com/@NASA",
    "kind": "channel",
    "bio": "NASA's mission is to pioneer the future in space exploration, scientific discovery, and aeronautics research.\r\n\r\nTo do that, we have worked around the world - and off it - for more than 60 years, searching for answers to fundamental questions a...",
    "avatar_url": "https://yt3.googleusercontent.com/eIf5fNPcIcj9ig-wZBeq4stFy1lgjWTW1nLT5dYlFkHZprZ03QBiMcbpwNMB6XSBjrSFGtAGQg=s160-c-k-c0x00ffffff-no-rj",
    "banner_url": "https://yt3.googleusercontent.com/y8Srh-oCcilLvBO8jAPI546m1bn0puA5DIvQiBZ1cSxc_rZfKxKSFlTCtoCQCtB6viUf1NGsaQ=w2560-fcrop64=1,00005a57ffffa5a8-k-c0xffffffff-no-nd-rj",
    "verified": true,
    "is_private": null,
    "external_url": "https://www.nasa.gov",
    "links": [
      {
        "title": "nasa.gov",
        "url": "https://www.nasa.gov"
      },
      {
        "title": "X",
        "url": "https://x.com/nasa"
      },
      {
        "title": "Facebook",
        "url": "https://www.facebook.com/NASA"
      }
    ],
    "location": null,
    "category": null,
    "created_at": "2008-06-03T00:00:00Z",
    "stats": {
      "followers": 15100000,
      "following": null,
      "posts": 6195,
      "likes": null,
      "views": 1132794120
    },
    "extra": {
      "channel_url": "https://www.youtube.com/channel/UCLA_DiR1FfKNvjuUpBHmylQ",
      "facebook_profile_id": "NASA",
      "is_family_safe": true,
      "is_live": true,
      "is_unlisted": false,
      "joined_text": "Joined Jun 3, 2008",
      "keywords": [
        "nasa",
        "space",
        "iss"
      ],
      "rss_url": "https://www.youtube.com/feeds/videos.xml?channel_id=UCLA_DiR1FfKNvjuUpBHmylQ",
      "subscribers_approximate": true,
      "subscribers_text": "15.1M subscribers",
      "verified_kind": "verified",
      "video_count_text": "6.1K videos"
    }
  },
  "cursor": null,
  "has_more": null
}

Response#

A Profile object in data.

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.
unsupported_url400noThe URL is not one this endpoint accepts (wrong platform or form).
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.

Example error:

{
  "ok": false,
  "error": {
    "code": "not_found",
    "message": "The platform says this profile, post or item does not exist.",
    "retryable": false
  },
  "credits_charged": 0,
  "request_id": "req_0f0ff40c1be1850878270ad9"
}