> **Building with AI coding agents?** If you're using an AI coding agent, install the official Scalekit plugin. It gives your agent full awareness of the Scalekit API — reducing hallucinations and enabling faster, more accurate code generation.
>
> - **Claude Code**: `/plugin marketplace add scalekit-inc/claude-code-authstack` then `/plugin install <auth-type>@scalekit-auth-stack`
> - **GitHub Copilot CLI**: `copilot plugin marketplace add scalekit-inc/github-copilot-authstack` then `copilot plugin install <auth-type>@scalekit-auth-stack`
> - **Codex**: run the bash installer, restart, then open Plugin Directory and enable `<auth-type>`
> - **Skills CLI** (Windsurf, Cline, 40+ agents): `npx skills add scalekit-inc/skills --list` then `--skill <skill-name>`
>
> `<auth-type>` / `<skill-name>`: `agentkit`, `full-stack-auth`, `mcp-auth`, `modular-sso`, `modular-scim` — [Full setup guide](https://docs.scalekit.com/dev-kit/build-with-ai/)

---

# YouTube

**Authentication:** OAuth 2.0
**Categories:** Communication
## What you can do

Connect this agent connector to let your agent:

- **Search search** — Search for videos, channels, and playlists on YouTube
- **List reporting, analytics groups** — List reports that have been generated for a YouTube reporting job
- **Query analytics** — Query YouTube Analytics data to retrieve metrics like views, watch time, subscribers, revenue, etc
- **Update videos, analytics groups, playlist** — Update metadata for an existing YouTube video
- **Delete subscriptions, reporting jobs, analytics groups** — Unsubscribe the authenticated user from a YouTube channel using the subscription ID
- **Insert playlist, playlist items, analytics group item** — Create a new YouTube playlist for the authenticated user

## Authentication

This connector uses **OAuth 2.0**. Scalekit acts as the OAuth client: it redirects your user to YouTube, obtains an access token, and automatically refreshes it before it expires. Your agent code never handles tokens directly — you only pass a `connectionName` and a user `identifier`.

You supply your YouTube **Connected App** credentials (Client ID + Secret) once per environment in the Scalekit dashboard.

Before calling this connector from your code, create the YouTube connection in **AgentKit** > **Connections** and copy the exact **Connection name** from that connection into your code. The value in code must match the dashboard exactly.

## Set up the connector

Register your Google OAuth 2.0 credentials with Scalekit so it can manage the OAuth 2.0 authentication flow and token lifecycle for YouTube on your behalf. You'll need a Client ID and Client Secret from the [Google Cloud Console](https://console.cloud.google.com/).

1. ### Create an OAuth 2.0 client in Google Cloud

   - Go to the [Google Cloud Console](https://console.cloud.google.com/) and select your project (or create a new one).

     <img src={googleCloudConsoleImg.src} alt="Google Cloud Console welcome page" width="540" />

   - Search for **OAuth** in the top search bar. Select **Credentials** under **APIs & Services**.

     <img src={searchOauthImg.src} alt="Searching for OAuth in Google Cloud Console" width="540" />

   - On the **Credentials** page, click **+ Create credentials** and select **OAuth client ID**.

     <img src={credentialsPageImg.src} alt="Google Cloud Credentials page showing OAuth 2.0 Client IDs" width="540" />

     <img src={createCredentialsDropdownImg.src} alt="Create credentials dropdown with OAuth client ID option" width="540" />

   - Set the **Application type** to **Web application** and enter a **Name** (e.g., `Scalekit`).

     <img src={createOauthClientIdImg.src} alt="Create OAuth client ID form with Web application type and Scalekit name" width="540" />

   - Leave the **Authorized redirect URIs** section empty for now — you'll add the Scalekit redirect URI in a later step.

2. ### Create a connection in Scalekit

   - In [Scalekit dashboard](https://app.scalekit.com), go to **AgentKit** > **Connections** > **Create Connection**.

     <img src={scalekitAgentAuthImg.src} alt="Scalekit Agent Auth connections page" width="540" />

   - Search for **YouTube** and click **Create**.

     <img src={scalekitSearchYoutubeImg.src} alt="Searching for YouTube in Scalekit Create Connection" width="540" />

   - Copy the **Redirect URI** from the connection configuration panel. It looks like `https:///sso/v1/oauth//callback`.

     <img src={configureYoutubeConnectionImg.src} alt="Configure YouTube Connection panel showing Redirect URI, Client ID, Client Secret, and Scopes fields" width="540" />

3. ### Configure the redirect URI in Google Cloud

   - Back in the [Google Cloud Console](https://console.cloud.google.com/), open your OAuth 2.0 client (or continue from step 1).

   - Under **Authorized redirect URIs**, click **+ Add URI** and paste the Scalekit Redirect URI.

     <img src={googleRedirectUriImg.src} alt="Google Cloud OAuth client with Scalekit redirect URI added" width="540" />

   - Click **Create** (or **Save** if editing an existing client). A dialog displays your **Client ID** and **Client secret**. Copy both values.

     <img src={oauthClientCreatedImg.src} alt="OAuth client created dialog showing Client ID and Client secret" width="540" />

4. ### Add credentials in Scalekit

   - In [Scalekit dashboard](https://app.scalekit.com), go to **AgentKit** > **Connections** and open the YouTube connection you created.

   - Enter your credentials:
     - **Client ID** — the Client ID from your Google OAuth 2.0 client
     - **Client Secret** — the Client secret from the dialog in step 3
     - **Scopes** — select the scopes your app needs (e.g., `youtube.readonly`, `youtube`, `youtube.force-ssl`, `yt-analytics.readonly`)

     <img src={scalekitCredentialsFilledImg.src} alt="Configure YouTube Connection panel filled with Client ID and Client Secret" width="540" />

   - Click **Save**.

## Tool list

Use the exact tool names from the **Tool list** below when you call `execute_tool`. If you're not sure which name to use, list the tools available for the current user first.

## Tool list

### `youtube_analytics_group_create`

Create a YouTube Analytics group to organize videos, playlists, channels, or assets for collective analytics reporting.

Parameters:

- `item_type` (`string`, required): Type of items the group will contain
- `title` (`string`, required): Title of the analytics group
- `on_behalf_of_content_owner` (`string`, optional): Content owner ID. For content partners only.

### `youtube_analytics_group_item_insert`

Add a video, playlist, or channel to a YouTube Analytics group.

Parameters:

- `group_id` (`string`, required): ID of the Analytics group to add the item to
- `resource_id` (`string`, required): ID of the resource (video ID, channel ID, or playlist ID)
- `resource_kind` (`string`, required): Type of the resource
- `on_behalf_of_content_owner` (`string`, optional): Content owner ID. For content partners only.

### `youtube_analytics_group_items_delete`

Remove an item (video, channel, or playlist) from a YouTube Analytics group.

Parameters:

- `id` (`string`, required): ID of the group item to remove
- `on_behalf_of_content_owner` (`string`, optional): Content owner ID on whose behalf the request is being made

### `youtube_analytics_group_items_list`

Retrieve a list of items (videos, playlists, channels, or assets) that belong to a YouTube Analytics group.

Parameters:

- `group_id` (`string`, required): ID of the group whose items to retrieve
- `on_behalf_of_content_owner` (`string`, optional): Content owner ID on whose behalf the request is being made

### `youtube_analytics_groups_delete`

Delete a YouTube Analytics group. This removes the group but does not delete the videos, channels, or playlists within it.

Parameters:

- `group_id` (`string`, required): ID of the Analytics group to delete
- `on_behalf_of_content_owner` (`string`, optional): Content owner ID on whose behalf the request is being made

### `youtube_analytics_groups_list`

Retrieve a list of YouTube Analytics groups for a channel or content owner. Specify either id or mine to filter results.

Parameters:

- `id` (`string`, optional): Comma-separated list of group IDs to retrieve
- `mine` (`boolean`, optional): If true, return only groups owned by the authenticated user. Required if id is not set.
- `on_behalf_of_content_owner` (`string`, optional): Content owner ID on whose behalf the request is being made
- `page_token` (`string`, optional): Token for retrieving the next page of results

### `youtube_analytics_groups_update`

Update the title of an existing YouTube Analytics group.

Parameters:

- `group_id` (`string`, required): ID of the Analytics group to update
- `title` (`string`, required): New title for the Analytics group
- `on_behalf_of_content_owner` (`string`, optional): Content owner ID. For content partners only.

### `youtube_analytics_query`

Query YouTube Analytics data to retrieve metrics like views, watch time, subscribers, revenue, etc. for channels or content owners.

Parameters:

- `end_date` (`string`, required): End date for the analytics report in YYYY-MM-DD format
- `ids` (`string`, required): Channel or content owner ID. Format: channel==CHANNEL_ID or contentOwner==CONTENT_OWNER_ID
- `metrics` (`string`, required): Comma-separated list of metrics to retrieve (e.g., views,estimatedMinutesWatched,likes,subscribersGained)
- `start_date` (`string`, required): Start date for the analytics report in YYYY-MM-DD format
- `currency` (`string`, optional): Currency for monetary metrics (ISO 4217 code, e.g., USD)
- `dimensions` (`string`, optional): Comma-separated list of dimensions to group results by (e.g., day,country,video)
- `filters` (`string`, optional): Filter expression to narrow results (e.g., country==US, video==VIDEO_ID)
- `include_historical_channel_data` (`boolean`, optional): Include historical channel data recorded before the channel was linked to a content owner
- `max_results` (`integer`, optional): Maximum number of rows to return in the response (maximum value: 200)
- `sort` (`string`, optional): Comma-separated list of columns to sort by. Prefix with - for descending order (e.g., -views)
- `start_index` (`integer`, optional): 1-based index of the first row to return (for pagination)

### `youtube_captions_list`

Retrieve a list of caption tracks for a YouTube video. The part parameter is fixed to 'snippet'. Requires youtube.force-ssl scope.

Parameters:

- `video_id` (`string`, required): ID of the video to list captions for
- `id` (`string`, optional): Comma-separated list of caption track IDs to filter results

### `youtube_channels_list`

Retrieve information about one or more YouTube channels including subscriber count, video count, and channel metadata. You must provide exactly one filter: id, mine, for_handle, for_username, or managed_by_me. Requires a valid YouTube OAuth2 connection.

Parameters:

- `part` (`string`, required): Comma-separated list of channel resource parts to include in the response
- `for_handle` (`string`, optional): YouTube channel handle to look up (e.g., @MrBeast). Use instead of id, mine, or for_username.
- `for_username` (`string`, optional): YouTube username of the channel to look up (legacy). Use instead of id, mine, or for_handle.
- `id` (`string`, optional): Comma-separated list of YouTube channel IDs. Use instead of mine, for_handle, or for_username.
- `managed_by_me` (`boolean`, optional): Return channels managed by the authenticated user (content partners only). Use instead of id, mine, for_handle, or for_username.
- `max_results` (`integer`, optional): Maximum number of results to return (0-50, default: 5)
- `mine` (`boolean`, optional): Return the authenticated user's channel. Use instead of id, for_handle, or for_username.
- `page_token` (`string`, optional): Token for pagination

### `youtube_comment_threads_insert`

Post a new top-level comment on a YouTube video. Requires youtube.force-ssl scope.

Parameters:

- `text` (`string`, required): Text of the comment
- `video_id` (`string`, required): ID of the video to comment on

### `youtube_comment_threads_list`

Retrieve top-level comment threads for a YouTube video or channel. You must provide exactly one filter: video_id, all_threads_related_to_channel_id, or id. Each thread includes the top-level comment and optionally its replies. Requires a valid YouTube OAuth2 connection.

Parameters:

- `part` (`string`, required): Comma-separated list of comment thread resource parts to include
- `all_threads_related_to_channel_id` (`string`, optional): Return all comment threads associated with a specific channel. Use instead of video_id or id.
- `id` (`string`, optional): Comma-separated list of comment thread IDs to retrieve. Use instead of video_id or all_threads_related_to_channel_id.
- `max_results` (`integer`, optional): Maximum number of comment threads to return (1-100, default: 20)
- `order` (`string`, optional): Sort order for comment threads
- `page_token` (`string`, optional): Token for pagination
- `search_terms` (`string`, optional): Limit results to comments containing these search terms
- `video_id` (`string`, optional): YouTube video ID to fetch comment threads for. Use instead of all_threads_related_to_channel_id or id.

### `youtube_comments_list`

Retrieve a list of replies to a specific YouTube comment thread. You must provide exactly one filter: parent_id or id. The part parameter is fixed to 'snippet'. Requires youtube.readonly scope.

Parameters:

- `id` (`string`, optional): Comma-separated list of comment IDs to retrieve. Use instead of parent_id.
- `max_results` (`integer`, optional): Maximum number of replies to return (1-100, default: 20). Cannot be used with id filter.
- `page_token` (`string`, optional): Token for pagination to retrieve the next page of replies. Cannot be used with id filter.
- `parent_id` (`string`, optional): ID of the comment thread (top-level comment) to list replies for. Use instead of id.
- `text_format` (`string`, optional): Format of the comment text in the response

### `youtube_playlist_delete`

Permanently delete a YouTube playlist. This action cannot be undone. Requires youtube scope.

Parameters:

- `playlist_id` (`string`, required): ID of the playlist to delete

### `youtube_playlist_insert`

Create a new YouTube playlist for the authenticated user. Requires youtube scope.

Parameters:

- `title` (`string`, required): Playlist title
- `default_language` (`string`, optional): Default language of the playlist
- `description` (`string`, optional): Playlist description
- `privacy_status` (`string`, optional): Privacy setting
- `tags` (`array`, optional): Tags for the playlist

### `youtube_playlist_items_delete`

Remove a video from a YouTube playlist by its playlist item ID. Requires youtube scope.

Parameters:

- `playlist_item_id` (`string`, required): ID of the playlist item to remove (not the video ID)

### `youtube_playlist_items_insert`

Add a video to a YouTube playlist at an optional position. Requires youtube scope.

Parameters:

- `playlist_id` (`string`, required): Playlist to add the video to
- `video_id` (`string`, required): YouTube video ID to add
- `note` (`string`, optional): Optional note for this playlist item
- `position` (`integer`, optional): Zero-based position in the playlist. Omit to add at end.

### `youtube_playlist_items_list`

Retrieve a list of videos in a YouTube playlist. Returns playlist items with video details, positions, and metadata. Requires a valid YouTube OAuth2 connection.

Parameters:

- `part` (`string`, required): Comma-separated list of playlist item resource parts to include
- `playlist_id` (`string`, required): YouTube playlist ID to retrieve items from
- `max_results` (`integer`, optional): Maximum number of playlist items to return (0-50, default: 5)
- `page_token` (`string`, optional): Token for pagination to retrieve the next page
- `video_id` (`string`, optional): Filter results to items containing a specific video

### `youtube_playlist_update`

Update an existing YouTube playlist's title, description, privacy status, or default language. Requires youtube scope.

Parameters:

- `playlist_id` (`string`, required): ID of the playlist to update
- `default_language` (`string`, optional): Language of the playlist
- `description` (`string`, optional): New playlist description
- `privacy_status` (`string`, optional): New privacy setting
- `title` (`string`, optional): New playlist title

### `youtube_playlists_list`

Retrieve a list of YouTube playlists for a channel or the authenticated user. You must provide exactly one filter: channel_id, id, or mine. Requires a valid YouTube OAuth2 connection.

Parameters:

- `part` (`string`, required): Comma-separated list of playlist resource parts to include
- `channel_id` (`string`, optional): Return playlists for a specific channel. Use instead of id or mine.
- `id` (`string`, optional): Comma-separated list of playlist IDs to retrieve. Use instead of channel_id or mine.
- `max_results` (`integer`, optional): Maximum number of playlists to return (0-50, default: 5)
- `mine` (`boolean`, optional): Return playlists owned by the authenticated user. Use instead of channel_id or id.
- `page_token` (`string`, optional): Token for pagination

### `youtube_reporting_create_job`

Create a YouTube reporting job to schedule daily generation of a specific report type. Once created, YouTube will generate the report daily.

Parameters:

- `name` (`string`, required): Human-readable name for the reporting job
- `report_type_id` (`string`, required): ID of the report type to generate (e.g., channel_basic_a2, channel_demographics_a1)
- `on_behalf_of_content_owner` (`string`, optional): Content owner ID on whose behalf the job is being created

### `youtube_reporting_jobs_delete`

Delete a scheduled YouTube Reporting API job. Stopping a job means new reports will no longer be generated.

Parameters:

- `job_id` (`string`, required): ID of the reporting job to delete
- `on_behalf_of_content_owner` (`string`, optional): Content owner ID on whose behalf the request is being made

### `youtube_reporting_list_jobs`

List all YouTube Reporting API jobs scheduled for a channel or content owner.

Parameters:

- `include_system_managed` (`boolean`, optional): If true, include system-managed reporting jobs in the response
- `on_behalf_of_content_owner` (`string`, optional): Content owner ID on whose behalf the request is being made
- `page_size` (`integer`, optional): Maximum number of jobs to return per page
- `page_token` (`string`, optional): Token for retrieving the next page of results

### `youtube_reporting_list_report_types`

List all YouTube Reporting API report types available for a channel or content owner (e.g., channel_basic_a2, channel_demographics_a1).

Parameters:

- `include_system_managed` (`boolean`, optional): If true, include system-managed report types in the response
- `on_behalf_of_content_owner` (`string`, optional): Content owner ID on whose behalf the request is being made
- `page_size` (`integer`, optional): Maximum number of report types to return per page
- `page_token` (`string`, optional): Token for retrieving the next page of results

### `youtube_reporting_list_reports`

List reports that have been generated for a YouTube reporting job. Each report is a downloadable CSV file.

Parameters:

- `job_id` (`string`, required): ID of the reporting job whose reports to list
- `created_after` (`string`, optional): Only return reports created after this timestamp (RFC3339 format, e.g., 2024-01-01T00:00:00Z)
- `on_behalf_of_content_owner` (`string`, optional): Content owner ID on whose behalf the request is being made
- `page_size` (`integer`, optional): Maximum number of reports to return per page
- `page_token` (`string`, optional): Token for retrieving the next page of results
- `start_time_at_or_after` (`string`, optional): Only return reports whose data start time is at or after this timestamp (RFC3339 format)
- `start_time_before` (`string`, optional): Only return reports whose data start time is before this timestamp (RFC3339 format)

### `youtube_search`

Search for videos, channels, and playlists on YouTube. Returns a list of resources matching the search query. The part parameter is fixed to 'snippet'. Requires a valid YouTube OAuth2 connection.

Parameters:

- `channel_id` (`string`, optional): Restrict search results to a specific channel
- `max_results` (`integer`, optional): Maximum number of results to return (0-50, default: 10)
- `order` (`string`, optional): Sort order for search results
- `page_token` (`string`, optional): Token for pagination to retrieve the next page of results
- `published_after` (`string`, optional): Filter results to resources published after this date (RFC 3339 format)
- `published_before` (`string`, optional): Filter results to resources published before this date (RFC 3339 format)
- `q` (`string`, optional): Search query keywords
- `safe_search` (`string`, optional): Safe search filter level
- `type` (`string`, optional): Restrict results to a specific resource type
- `video_duration` (`string`, optional): Filter videos by duration (only applies when type is 'video')

### `youtube_subscriptions_delete`

Unsubscribe the authenticated user from a YouTube channel using the subscription ID. Requires youtube scope.

Parameters:

- `subscription_id` (`string`, required): ID of the subscription to delete

### `youtube_subscriptions_insert`

Subscribe the authenticated user to a YouTube channel. Requires youtube scope.

Parameters:

- `channel_id` (`string`, required): ID of the YouTube channel to subscribe to

### `youtube_subscriptions_list`

Retrieve a list of YouTube channel subscriptions for the authenticated user or a specific channel. You must provide exactly one filter: channel_id, id, mine, my_recent_subscribers, or my_subscribers. Requires a valid YouTube OAuth2 connection with youtube.readonly scope.

Parameters:

- `part` (`string`, required): Comma-separated list of subscription resource parts to include
- `channel_id` (`string`, optional): Return subscriptions for a specific channel. Use instead of id, mine, my_recent_subscribers, or my_subscribers.
- `for_channel_id` (`string`, optional): Filter subscriptions to specific channels (comma-separated channel IDs)
- `id` (`string`, optional): Comma-separated list of subscription IDs to retrieve. Use instead of channel_id, mine, my_recent_subscribers, or my_subscribers.
- `max_results` (`integer`, optional): Maximum number of subscriptions to return (0-50, default: 5)
- `mine` (`boolean`, optional): Return subscriptions for the authenticated user. Use instead of channel_id, id, my_recent_subscribers, or my_subscribers.
- `my_recent_subscribers` (`boolean`, optional): Return the authenticated user's recent subscribers. Use instead of channel_id, id, mine, or my_subscribers.
- `my_subscribers` (`boolean`, optional): Return the authenticated user's subscribers. Use instead of channel_id, id, mine, or my_recent_subscribers.
- `order` (`string`, optional): Sort order for subscriptions
- `page_token` (`string`, optional): Token for pagination

### `youtube_video_categories_list`

Retrieve a list of YouTube video categories available in a given region or by ID. You must provide exactly one filter: id or region_code. The part parameter is fixed to 'snippet'. Useful for setting the category when updating a video. Requires youtube.readonly scope.

Parameters:

- `hl` (`string`, optional): Language for the category names in the response (BCP-47)
- `id` (`string`, optional): Comma-separated list of category IDs to retrieve. Use instead of region_code.
- `region_code` (`string`, optional): ISO 3166-1 alpha-2 country code to retrieve categories available in that region. Use instead of id.

### `youtube_videos_delete`

Permanently delete a YouTube video. This action cannot be undone. Requires youtube scope.

Parameters:

- `video_id` (`string`, required): ID of the video to delete

### `youtube_videos_get_rating`

Retrieve the authenticated user's rating (like, dislike, or none) for one or more YouTube videos. The part parameter is fixed to 'id'. Requires youtube.readonly scope.

Parameters:

- `id` (`string`, required): Comma-separated list of YouTube video IDs to get ratings for

### `youtube_videos_list`

Retrieve detailed information about one or more YouTube videos including statistics, snippet, content details, and status. You must provide exactly one filter: id, chart, or my_rating. Requires a valid YouTube OAuth2 connection.

Parameters:

- `part` (`string`, required): Comma-separated list of video resource parts to include in the response
- `chart` (`string`, optional): Retrieve a chart of the most popular videos. Use instead of id or my_rating.
- `id` (`string`, optional): Comma-separated list of YouTube video IDs. Use instead of chart or my_rating.
- `max_results` (`integer`, optional): Maximum number of results to return when using chart filter (1-50, default: 5)
- `my_rating` (`string`, optional): Filter videos by the authenticated user's rating. Use instead of id or chart.
- `page_token` (`string`, optional): Token for pagination
- `region_code` (`string`, optional): ISO 3166-1 alpha-2 country code to filter trending videos by region
- `video_category_id` (`string`, optional): Filter most popular videos by category ID

### `youtube_videos_rate`

Like, dislike, or remove a rating from a YouTube video on behalf of the authenticated user. Requires youtube scope with youtube.force-ssl.

Parameters:

- `rating` (`string`, required): Rating to apply to the video
- `video_id` (`string`, required): YouTube video ID to rate

### `youtube_videos_update`

Update metadata for an existing YouTube video. When updating snippet, both title and category_id are required together. Requires youtube scope.

Parameters:

- `video_id` (`string`, required): ID of the video to update
- `category_id` (`string`, optional): YouTube video category ID. Required together with title when updating snippet.
- `default_language` (`string`, optional): Language of the video
- `description` (`string`, optional): New video description
- `embeddable` (`boolean`, optional): Whether the video can be embedded
- `license` (`string`, optional): Video license
- `privacy_status` (`string`, optional): New privacy setting
- `public_stats_viewable` (`boolean`, optional): Whether stats are publicly visible
- `tags` (`array`, optional): Video tags
- `title` (`string`, optional): New video title. Required together with category_id when updating snippet.


---

## More Scalekit documentation

| Resource | What it contains | When to use it |
|----------|-----------------|----------------|
| [/llms.txt](/llms.txt) | Structured index with routing hints per product area | Start here — find which documentation set covers your topic before loading full content |
| [/llms-full.txt](/llms-full.txt) | Complete documentation for all Scalekit products in one file | Use when you need exhaustive context across multiple products or when the topic spans several areas |
| [sitemap-0.xml](https://docs.scalekit.com/sitemap-0.xml) | Full URL list of every documentation page | Use to discover specific page URLs you can fetch for targeted, page-level answers |
