---
title: "How to Get a YouTube Channel ID (API and Manual)"
description: "Get the UC… ID of any YouTube channel from its @handle, URL, a video or its name, with an API call or by hand, and why you should store the ID, not the handle."
url: "https://fetchtranscript.com/blog/get-youtube-channel-id"
markdown: "https://fetchtranscript.com/blog/get-youtube-channel-id.md"
---

YouTube

# How to Get a YouTube Channel ID from a Handle, URL or Name

Get the UC… ID of any YouTube channel from its @handle, URL, a video or its name, with an API call or by hand, and why you should store the ID, not the handle.

By FetchTranscript team Published December 1, 2026 5 min read

To get the ID of a YouTube channel from code, send its @handle to an API that resolves it: with FetchTranscript, `GET /v1/channels/@handle` returns the permanent `channel_id`, the 24-character string that starts with `UC`. With the official YouTube Data API the same lookup is `channels.list` with `forHandle`, at 1 quota unit. Without any API, open the channel's About panel and choose "Share channel", then "Copy channel ID". This guide covers every starting point developers meet in practice: a handle, a channel URL, an old custom URL, a video, or just a channel name.

## What a channel ID is, and why you want it

Every YouTube channel has one permanent identifier: `UC` followed by 22 letters, digits, dashes or underscores, for example `UCBJycsmduvYEL83R_U4JriQ`. It never changes. Everything else does:

- **Handles** (`@mkbhd`) are unique but the owner can change them.
- **Channel names** ("MKBHD") are not unique at all, and change too.
- **Custom URLs** (`youtube.com/c/name`) and **legacy usernames** (`youtube.com/user/name`) are older schemes that YouTube folded into handles.

So the rule for any database or integration is simple: accept whatever the user pastes, resolve it once to the `UC…` ID, and store the ID. Handles are for display.

A small bonus of knowing the format: a channel's uploads playlist has the same ID with `UU` instead of `UC` at the start, which is how the Data API lists a channel's videos (see [how to get all videos from a YouTube channel](https://fetchtranscript.com/blog/get-all-videos-from-youtube-channel.md)).

## Without an API: three manual ways

If you need the ID of one channel, right now, no code is required:

1. **The About panel.** Open the channel, click the description line under the channel name to open the About panel, then "Share channel" and "Copy channel ID".
2. **Your own channel.** In YouTube's account settings, "Advanced settings" shows your user ID and your channel ID.
3. **The page source.** On any channel page, view the source and look for `<link rel="canonical"`: its address is `https://www.youtube.com/channel/UC…`, with the ID at the end.

These are fine for a one-off lookup. They do not scale to a form where users paste channels, or to a list of a thousand handles from a spreadsheet.

## With the FetchTranscript API: from a handle

`GET /v1/channels/{channel}` takes a handle (with or without the `@`, any case) or a `UC…` ID, and returns the channel's details, its ID first:

```bash
curl -H "X-API-Key: yt_your_api_key" \
  "https://api.fetchtranscript.com/v1/channels/@mkbhd"
```

```json
{
  "channel_id": "UCBJycsmduvYEL83R_U4JriQ",
  "name": "Marques Brownlee",
  "description": "MKBHD: Quality Tech Videos | YouTuber | Geek | Consumer Electronics | Tech Head | Internet Personality!",
  "subscriber_count": 20200000,
  "video_count": 1700,
  "thumbnail_url": "https://yt3.googleusercontent.com/...",
  "channel_url": "https://www.youtube.com/channel/UCBJycsmduvYEL83R_U4JriQ"
}
```

The values above are illustrative. One call costs 1 credit; an unknown handle answers 404 `channel_not_found` and a value that is neither a handle nor an ID answers 400 `invalid_channel_id`, and neither is billed. Handle lookups are cached for 24 hours, so resolving the same handle again is fast. You can try it with no account on the [YouTube Channel API page](https://fetchtranscript.com/youtube-channel-api#try-it-free), which also accepts a pasted channel URL.

## From a channel URL, in Python

Users rarely paste a clean handle. They paste `https://www.youtube.com/@mkbhd/videos`, `youtube.com/channel/UC…/featured` or `m.youtube.com/@mkbhd`. Parse the address first: an `/channel/UC…` URL already contains the ID and needs no call at all.

```python
import re
import requests

API = "https://api.fetchtranscript.com/v1"
HEADERS = {"X-API-Key": "yt_your_api_key"}

CHANNEL_ID = re.compile(r"^UC[A-Za-z0-9_-]{22}$")
CHANNEL_URL = re.compile(r"youtube\.com/(?:channel/(UC[A-Za-z0-9_-]{22})|(@[\w.-]+))", re.IGNORECASE)

def channel_ref(value: str) -> str:
    """A UC id or an @handle, from whatever the user pasted."""
    value = value.strip()
    match = CHANNEL_URL.search(value)
    if match:
        return match.group(1) or match.group(2)
    return value

def channel_id(value: str) -> str:
    ref = channel_ref(value)
    if CHANNEL_ID.match(ref):
        return ref  # already the ID: no call, no credit
    r = requests.get(f"{API}/channels/{ref}", headers=HEADERS, timeout=30)
    if r.status_code in (400, 404):
        raise LookupError(f"{value}: {r.json()['detail']['error']}")
    r.raise_for_status()
    return r.json()["channel_id"]

for pasted in ["https://www.youtube.com/@mkbhd/videos", "@veritasium", "youtube.com/channel/UCHnyfMqiRRG1u-2MsSQLbXA"]:
    print(pasted, "->", channel_id(pasted))
```

With the official SDK (`pip install fetchtranscript`) the call is `client.channels.get_info("@mkbhd")["channel_id"]`, and a missing channel raises `ChannelNotFoundError`.

## The same in JavaScript with the SDK

```javascript
// Node 18+ as an ES module, after npm install fetchtranscript
import { FetchTranscriptClient, ChannelNotFoundError } from 'fetchtranscript';

const client = new FetchTranscriptClient({ apiKey: 'yt_your_api_key' });

async function channelId(handle) {
  try {
    const channel = await client.channels.getInfo(handle);
    return channel.channel_id;
  } catch (error) {
    if (error instanceof ChannelNotFoundError) return null; // unknown handle, not billed
    throw error;
  }
}

console.log(await channelId('@mkbhd'));
```

## Resolve a whole list of handles

A spreadsheet of creators is the typical batch job. Resolve each handle once, keep the mapping, and record the failures instead of stopping on them:

```python
import csv

with open("handles.csv", encoding="utf-8") as f_in, open("channel_ids.csv", "w", newline="", encoding="utf-8") as f_out:
    writer = csv.writer(f_out)
    writer.writerow(["input", "channel_id", "name"])
    for row in csv.reader(f_in):
        r = requests.get(f"{API}/channels/{channel_ref(row[0])}", headers=HEADERS, timeout=30)
        if r.ok:
            data = r.json()
            writer.writerow([row[0], data["channel_id"], data["name"]])
        else:
            writer.writerow([row[0], "", r.json()["detail"]["error"]])
```

A thousand handles cost a thousand credits, about a dollar, and failed lookups are free. The rate limit is 500 requests per minute.

## From a video URL

Sometimes all you have is a video. `GET /v1/videos/{video_id}` returns its `channel_id` and `channel_name` together with the views, likes and upload date, for 1 credit:

```bash
curl -H "X-API-Key: yt_your_api_key" \
  "https://api.fetchtranscript.com/v1/videos/dQw4w9WgXcQ"
```

This is also the reliable way out for old `/c/name` and `/user/name` URLs, which the channel endpoint does not accept as such: open any video of that channel and read its `channel_id`. Many old custom names became the channel's handle, so trying the name as a handle often works too, but not always. More about the video endpoint in [how to get YouTube video metadata](https://fetchtranscript.com/blog/youtube-video-metadata.md).

## From a channel name

A name is the weakest starting point, because two channels can share it. The practical approach is a search: `GET /v1/search?q=<name>` returns videos, each with its `channel_name` and `channel_id`, so the channels that match the name show up in the results.

```python
r = requests.get(f"{API}/search", headers=HEADERS, params={"q": "Veritasium", "limit": 20}, timeout=30)
r.raise_for_status()
channels = {}
for video in r.json()["results"]:
    if video["channel_id"]:
        channels.setdefault(video["channel_id"], video["channel_name"])
for cid, name in channels.items():
    print(cid, name)
```

Pick the right one by name and, if in doubt, confirm it with `GET /v1/channels/{channel_id}` (subscribers and description make it obvious). Search returns videos only, so a channel with no video in the first results will not appear; for those, ask the user for the handle. Searching is covered in depth in [YouTube search API without quota limits](https://fetchtranscript.com/blog/youtube-search-without-quota.md).

## With the YouTube Data API

If you already have a Google Cloud project and an API key, the Data API is a perfectly good fit for this one lookup, and we would not pretend otherwise:

| You have          | Data API request                                                 | Cost      |
| ----------------- | ---------------------------------------------------------------- | --------- |
| a handle          | `channels.list?part=id&forHandle=@mkbhd`                         | 1 unit    |
| a legacy username | `channels.list?part=id&forUsername=name`                         | 1 unit    |
| a video ID        | `videos.list?part=snippet&id=VIDEO_ID`, then `snippet.channelId` | 1 unit    |
| a name            | `search.list?part=snippet&type=channel&q=name`                   | 100 units |

```bash
curl "https://www.googleapis.com/youtube/v3/channels?part=id&forHandle=@mkbhd&key=YOUR_GOOGLE_API_KEY"
```

The ID is `items[0].id`. With the default 10,000 units a day you can resolve thousands of handles, but only about 100 names. The Data API makes sense when you are already inside Google's ecosystem; FetchTranscript makes sense when the ID is the first step of a job that then lists videos and fetches transcripts or comments, which the Data API cannot do for other people's videos, all with one key and no quota. A comparison of the two for transcripts is in [can the YouTube Data API get transcripts?](https://fetchtranscript.com/blog/youtube-data-api-transcript.md)

## Frequently asked questions

### What does a YouTube channel ID look like?

`UC` followed by 22 characters (letters, digits, `-` and `_`), 24 characters in all, for example `UCBJycsmduvYEL83R_U4JriQ`. It never changes, unlike the handle and the name.

### How do I get a channel ID from a handle with an API?

Call `GET /v1/channels/@handle` and read `channel_id` from the answer; it costs 1 credit and an unknown handle costs nothing. With the YouTube Data API, use `channels.list` with `forHandle`, which costs 1 quota unit.

### Can I get the channel ID from a channel URL?

Yes. A `/channel/UC…` URL already contains the ID. For an `/@handle` URL, extract the handle and resolve it with the API. For old `/c/` and `/user/` URLs, read the `channel_id` of one of the channel's videos.

### How do I find a channel ID from the channel name?

Search for the name and read the `channel_id` and `channel_name` of the video results, then confirm the right channel with its details. Names are not unique, so prefer the handle whenever the user can give it.

### Is there a way without an API key?

Yes: the channel's About panel has "Share channel" and "Copy channel ID", and the canonical link in the page source contains the ID. The [YouTube Channel API page](https://fetchtranscript.com/youtube-channel-api#try-it-free) also resolves a handle or URL for free, a few times a day.

### Should I store the handle or the channel ID?

Store the `UC…` ID. Handles can be changed by the channel owner at any time; the ID stays the same for the life of the channel.

Try it on your own videos

100 free calls every month, no credit card. Then $1 per 1,000 calls, only for the calls that succeed.

[Get your free API key](https://fetchtranscript.com/auth/sign-up)[Read the docs](https://fetchtranscript.com/docs.md)

## Related guides

- [How to Get a YouTube Channel’s Name and Stats via API](https://fetchtranscript.com/blog/get-youtube-channel-details.md)

  Get a YouTube channel’s name, description, subscribers, video count and avatar as JSON by @handle or ID, compared honestly with the Data API channels.list.

- [How to Get All Videos from a YouTube Channel](https://fetchtranscript.com/blog/get-all-videos-from-youtube-channel.md)

  Retrieve every video of a YouTube channel via API: by @handle with a cursor, to CSV, with or without Shorts, or with the Data API uploads playlist.

- [How to Search Within a YouTube Channel via API](https://fetchtranscript.com/blog/search-youtube-channel-api.md)

  Search the videos of one YouTube channel from code: the Data API search.list with channelId and its limits, a full title search, and search inside transcripts.

[← All articles](https://fetchtranscript.com/blog.md)
