# Quickstart
URL: /api
***
title: Quickstart
description: Unlock powerful YouTube automation workflows with TubeLab's API
icon: intro
-----------
import { Step, Steps } from "fumadocs-ui/components/steps";
import { DynamicCodeBlock } from "fumadocs-ui/components/dynamic-codeblock";
import { Icon } from "@/components/ui/icon";
[TubeLab](https://tubelab.net/)'s API gives you access to the [Niche Finder](https://tubelab.net/youtube-niche-finder) & [Outliers Finder](https://tubelab.net/youtube-outliers-finder) data - including 400K+ channels, 4M+ outliers, and YouTube scans. Updated everyday, in real-time.
This unlocks powerful YouTube automation workflows, such as:
* Automatically finding new niches
* Automatically tracking trends based on a niche
* AI-powered ideation based on outliers
**Why code when AI can do it for you?**
[Paste this link](https://tubelab.net/docs/llms-full.txt) in your AI and he will get the full context of TubeLab's API.
```
https://tubelab.net/docs/llms-full.txt
```
## Call the API
### Create a TubeLab Account
Sign-up to [TubeLab](https://tubelab.net/login) if you don't have an account yet.
### Create an API Key
You must have an [active subscription with available credits](https://tubelab.net/settings).
Create an API key [here](https://tubelab.net/developers) and copy it.
**Beaware, this key won't be shown again.**
### Make your first request
Authenticate by using the `Authorization` header and value as `Api-Key your-api-key`:
response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));`}
/>
## Next steps
Now that you have made your first TubeLab API request, it's time to explore what else is possible:
}>
Use our powerful n8n templates to automate niche finding, competition
tracking, trends, ideation and much more.
}>
Understand what YouTube data is available, and how to use it.
# Introduction
URL: /api/introduction
***
title: Introduction
description: Find new niches automatically, track your competition, new trends and more.
----------------------------------------------------------------------------------------
The [TubeLab](https://tubelab.net/) API is organized around [REST](https://en.wikipedia.org/wiki/REST). The API returns [JSON-encoded](https://www.json.org/json-en.html) responses, and uses standard HTTP response codes, authentication, and verbs.
To use TubeLab's API you must have an [API Key](https://tubelab.net/developers) and an [active subscription](https://tubelab.net/pricing) with [available credits](https://tubelab.net/credits).
`https://public-api.tubelab.net/v1`
## Authentication
[Create an API key here](https://tubelab.net/developers).
All requests to the TubeLab API must include an `Authorization` header with your API key. You'll need to send this header yourself as `Authorization: Api-Key `.
Here's an example with `curl`:
```bash
curl --location 'https://public-api.tubelab.net/v1/outliers?query=minecraft'
--H 'Content-Type: application/json'
--H 'Authorization: Api-Key '
```
## Rate limits
To mitigate misuse and manage capacity on our API, we have implemented limits per api key.
**You're limited to `10` requests every minute per api-key within your available credits.**
Limits are designed to prevent API abuse, while minimizing impact on common customer usage patterns.
## Content types
TubeLab's API accepts JSON in request bodies and returns JSON in response bodies. You will need to send the content-type: `application/json` header in requests.
## Request size limits
The API has a maximum request body size of `100kb` per request.
## Status page
Check the availability of TubeLab's APIs at our [status page](https://status.tubelab.net/).
# Pricing
URL: /api/pricing
***
title: Pricing
description: Learn about TubeLab's API pricing structure
--------------------------------------------------------
For the latest pricing updates, check out [tubelab.net/pricing](https://tubelab.net/pricing).
## Credits System
Some API calls to TubeLab's API uses credits from your account. Your [credit balance](https://tubelab.net/credits) determines how many requests you can make.
Different endpoints may require different credit amounts per request.
### How does the credits system work?
Some **subscriptions comes with credits that refresh each billing cycle** and don't expire right away. Monthly subscribers can use their credits for up to two months - so January credits work through February.
**Annual subscribers get all their credits upfront** and can use them flexibly throughout their subscription, with credits staying active for over a month into the following year.
**Purchased credits** never expire but you must have an active subscription to use them.
## Pricing Table
| Endpoint | Cost per request |
| ----------------------- | ------------------- |
| `GET /outliers` | `5 credits` |
| `GET /outliers/related` | `5 credits` |
| `GET /channels` | `10 credits` |
| `GET /channels/related` | `10 credits` |
| `POST /scan` | `50 to 100 credits` |
| `GET /scan/:id` | `free` |
**Note:** The cost of a [scan](/reference/scans) is based on the mode you choose.
| Mode | Cost |
| -------- | --------------- |
| Fast | **50** credits |
| Standard | **100** credits |
**Cached responses do not use credits**. This means that if you make a request to the same endpoint within a short period of time, you will not be charged extra credits.
## How to get credits?
You can get credits by subscribing to a [TubeLab Pro plan](https://tubelab.net/pricing) and by [topping-up your credits](https://tubelab.net/credits/top-up).
## What happens if I run out of credits?
You can purchase more credits at any time.
These extra credits work alongside your regular subscription credits and stay valid while your subscription is active.
## What happens when a request fails?
When a request fails, the credit will be refunded (reverted).
# Scanning
URL: /api/scanning
***
title: Scanning
description: TubeLab's API let's you scan YouTube to find public channels and outliers in any topic.
----------------------------------------------------------------------------------------------------
You can trigger new YouTube scans, for any niche.
**Allowing for tailored competitor research, in real-time.**
## Starting a YouTube Scan
You can trigger a new YouTube scan by calling the [`/scan` endpoint](/api/reference/post-scan).
**To successfully trigger a scan you need to have an [active subscription with available credits](https://tubelab.net/settings).**
## Searching the results
Once a scan is complete, you can search for the results by calling the [`/channels` endpoint](/api/reference/get-channels) or the [`/outliers` endpoint](/api/reference/get-outliers) with the `referenceId` property set to the desired scan `id`.
```bash
curl -X GET "https://public-api.tubelab.net/v1/channels?referenceId=8794a2ba-b4ca-40ca-9585-ca3fc501e31d" \
-H "Authorization: Api-Key "
curl -X GET "https://public-api.tubelab.net/v1/outliers?referenceId=8794a2ba-b4ca-40ca-9585-ca3fc501e31d" \
-H "Authorization: Api-Key "
```
## Webhooks
You can get notified when a scan status changes by creating a [webhook](/api/webhooks).
Once you've set your [webhook](/api/webhooks), you will receive a payload when the scan status changes:
[TubeLab n8n Node](https://www.npmjs.com/package/n8n-nodes-tubelab) does this
automatically for you.
```json
// body payload
{
"type": "ProcessStatus",
"time": "2025-09-20T14:36:52.211Z",
"data": {
"id": "8794a2ba-b4ca-40ca-9585-ca3fc501e31d",
"status": "Running",
"endedAt": null,
"updatedAt": "2025-09-20T14:36:52.186Z"
}
}
```
## Scan Modes and Pricing
Scans are **resource intensive** and can **take a while to complete**.
There's two available modes that will stop the scan when one of the thresholds is reached.
| Mode | Outliers Threshold | Channels Threshold | Cost | Estimated Time |
| -------- | ------------------ | ------------------ | --------------- | ------------------ |
| Fast | 1000 | 100 | **50** credits | 30 mins to 2 hours |
| Standard | 2500 | 250 | **100** credits | 2-4 hours |
Scans are queued and processed in order, so the expected time is an estimate and can vary.
# Webhooks
URL: /api/webhooks
***
title: Webhooks
description: Listen for Tubelab events on your webhook endpoint so you can automatically trigger reactions.
-----------------------------------------------------------------------------------------------------------
import { Step, Steps } from "fumadocs-ui/components/steps";
import { Accordion, Accordions } from "fumadocs-ui/components/accordion";
[TubeLab's n8n Node](https://www.npmjs.com/package/n8n-nodes-tubelab) handles
webhooks automatically for you.
## Get started
To start receiving webhook events in your app:
1. Create a webhook endpoint handler to receive event data POST requests.
2. Test your webhook endpoint handler locally with our [mock request example](/api/webhooks#2-test-your-handler).
3. Register an enpoint in the Tubelab's [Developers dashboard](https://tubelab.net/developers).
4. Secure your webhook (optional)
**n8n Integration**:
If you're using n8n this is done automatically for you.
### 1. Create a handler
Set up your endpoint function so that it:
* Handles POST requests with JSON payloads
* Quickly returns a successfull status code `2xx` prior to any complex operations
that might cause a timeout
### 2. Test your handler
Before you go-live with your webhook endpoint function, we recommend that you test your application integration.
You can simply POST to your webhook endpoint with the following payload for a completed scan:
```json
{
"type": "ProcessStatus",
"time": "2025-09-20T14:36:52.211Z",
"data": {
"id": "8794a2ba-b4ca-40ca-9585-ca3fc501e31d",
"status": "Completed",
"endedAt": "2025-09-20T14:36:52.186Z",
"updatedAt": "2025-09-20T14:36:52.186Z"
}
}
```
* `type`: always `"ProcessStatus"`
* `status`: one of `"Running" | "Completed" | "ContinuedAsNew" | "Failed" | "Terminated" | "Suspended"`
* `endedAt` present when `status` is `"Completed" | "Failed" | "Terminated" `
### 3. Register your webhook
Create your webhook in [TubeLab's Developer Dashboard](https://tubelab.net/developers).
Scroll down to the "Webhooks" section and click "Create Webhook" then fill in the following:
* `Payload URL`: the URL of your webhook endpoint
* `Secret`: define a secret key to secure your webhook (optional)
Payload URLs must be **Secure HTTPS URLs** and be in the following format:
```bash
https:///
```
### 4. Secure your webhook (optional)
You can set a secret to verify that a webhook delivery is from TubeLab.
**To do this, you need to:**
1. Create a secret token for your webhook
2. Store the secret on your server
3. Validate incoming requests using the payload & secret
Start by going to [TubeLab's Developer Dashboard](https://tubelab.net/developers). On the webhook row, click on the actions and "Edit". **Here you can set the secret token or change an existing one.**
When a secret is set, all requests will include a `X-TubeLab-Signature-256` header with a HMAC-SHA256 signature of the request body.
Headers example:
```json
// headers
"x-tubelab-signature-256": "sha256=9db81febbc4334e338ce23e783e9114a012d68aae59e51eba375ed9493d67f80",
"x-tubelab-delivery": "6f8a7b0b-5602-49b8-9dbf-a1c7bc02bb5f",
"x-tubelab-event": "ProcessStatus",
"x-tubelab-hook-id": "d0b88613-9ca6-4de2-b692-31b869173e76",
```
```js
import * as crypto from 'crypto';
// signature is the value of the x-tubelab-signature-256 header
function verifySignature(payload: string, signature: string) {
if (!signature) return false;
const secret = 'secret'
const expectedSignature = 'sha256=' + crypto
.createHmac('sha256', secret)
.update(JSON.stringify(payload), 'utf8') // Use payload directly, don't JSON.stringify again
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expectedSignature)
);
}
```
This webhook implementation follows Github's [Webhook Signature Verification](https://docs.github.com/en/webhooks/using-webhooks/validating-webhook-deliveries#validating-webhook-deliveries) practises. Please refer to it for further details.
# Quickstart
URL: /api/automation/quickstart
***
title: Quickstart
description: Learn how to setup TubeLab with n8n and create your first workflow.
--------------------------------------------------------------------------------
import { Step, Steps } from "fumadocs-ui/components/steps";
You can easily integrate [TubeLab](https://tubelab.ai/) with [n8n](https://n8n.io/) to create powerful YouTube automation workflows.
This is a practical guide, and we'll create one example workflow:
* [**Trends Tracker**](/api/automation/trends-tracker): leverages TubeLab and AI to automatically create trends reports;
### Pre-requisites
* An active [TubeLab](https://tubelab.net/) subscription
* A valid [TubeLab API Key](https://tubelab.net/developers)
* A [self-hosted n8n instance](https://docs.n8n.io/hosting/self-hosted/installation/)
## Setup n8n with TubeLab
### Install TubeLab's Node
[TubeLab's n8n node](https://www.npmjs.com/package/n8n-nodes-tubelab) is currently under-review to be available on the official n8n marketplace. For the time being you can only installed it on self-hosted n8n instances.
1. Go to **Settings** > **Community Nodes** (`/settings/community-nodes`)
2. Select **Install**.
3. Enter `n8n-nodes-tubelab` in npm package name.
4. **Agree to the risks** of using community nodes: select I understand the risks of installing unverified code from a public source.
5. Select **Install**.
### Setup Credentials
You must first authenticate with TubeLab by setting the `Api Key` in the node.
1. Use **TubeLab's node**
2. Under Credential to connect with, click **Create New Credential**.
3. Paste your **TubeLab API key** and save.
## Next steps
Now that you have setup TubeLab with n8n, it's time to create your [first workflow](/api/automation/trends-tracker).
# Trends Tracker
URL: /api/automation/trends-tracker
***
title: Trends Tracker
description: Learn how to create an n8n workflow to track YouTube trends.
-------------------------------------------------------------------------
import { Step, Steps } from "fumadocs-ui/components/steps";
import { DynamicCodeBlock } from "fumadocs-ui/components/dynamic-codeblock";
import { Accordion, Accordions } from "fumadocs-ui/components/accordion";
Instead of manually searching for what's trending on your niche, you can automate the process with [TubeLab](https://tubelab.net/) and [n8n](https://n8n.io/).
Before starting, it helps to break down the process in smaller steps:
1. **Research**: we'll start by using your channel and TubeLab to spot outliers from your competitors;
2. **Analysis**: we can then prompt ChatGPT to analyse those videos;
3. **Report**: finally we prompt ChatGPT to create a report with the findings and send it to you.
**Note**: This is a simplified version of the workflow. You can extend it to include more steps, such as:
* Analysing viral hook formulas with the [Video Transcript](/api/reference/get-video-transcript) endpoint;
* Creating new ideas from comments with the [Video Comments](/api/reference/get-video-comments) endpoint;

## Pre-requisites
1. Refer to the [Quickstart](/api/automation/quickstart) guide to setup n8n with TubeLab and create the workflow.
2. OpenAI n8n node setup - check the [official n8n guide here](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-langchain.openai/) or watch this [video](https://www.youtube.com/watch?v=IAhx81VLUlk).
## Research
We want to spot what's trending first with fresh data:
1. [Scan your niche](/api/automation/trends-tracker#scan-your-niche-optional) to get fresh data (optional);
2. [Search for outlier videos](/api/automation/trends-tracker#search-for-outliers-from-your-competitors) from your competitors;
### Scan your niche (optional)
With TubeLab you can scan any niche to find outliers and channels that relevant & real-time
* Add a **TubeLab** node to your workflow and select **Start a scan**. Set:
* Find by: **Channels**;
* Channel IDS: **Your Channel ID and your competitors.** (max 5 channels)
**How to find channel IDs?** Paste any video in [TubeLab's Video
Extractor](https://tubelab.net/video-extractor) and copy the channel ID.
**Note**: a niche scan is an expensive operation (credits-wise). You can skip this step. Check the [pricing table here](/api/pricing#pricing-table).
### Search for outliers from your competitors
* Add a **Wait** node to wait for 2 hours to complete the scan.
* Add a **TubeLab** node and select **Search for similar outliers**. Set:
* Similar by: **Channels**;
* Channels: **Channel IDs from previous step**;
* Filters:
* Content Kind: **Video**;
* Published At: **Last 3 Months**;
* Views: **From 5,000**.
The [**Wait**
node](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.wait/)
won't grantee that the fresh data is available. However TubeLab's data is
probably already enough to get decent results.
**Note:** For better results use TubeLab's **On scan status change** trigger node in another flow (within the same workflow) so you can run the workflow again when the scan is complete.
## Analysis
Now let's ask ChatGPT to analyse the videos and create a report.
Here's the prompt:
{{ $input.all().map(item => \`\${item.json.snippet.title}
ID: \${item.json.id}
Views: \${item.json.statistics.viewCount}
Avg. View Ratio: \${
(Math.round((item.json.statistics.averageViewsRatio) \* 100) / 100).toFixed(1)}
Published: \${item.json.snippet.publishedAt}
\`).join('--- \n') }}
\`} />
# :fire: 5 Trending Competitor Videos
**[Video title](https://youtube.com/watch?v=[id])**
Views: X | [Avg. Views To Subs Ratio]X Outlier
Url:
Published: X ago
(Exclude channels's own content)
## :mag: Winning Patterns
- **Topics**: Recurring themes
- **Triggers**: Emotional/psychological angles
- **Title Formulas**: Title templates that get clicks
## :bulb: Ideas
- [5 simple ideas based on trends]
[End with a very short paragraph of unique learnings that I can use to capture more attention & views.]
# Aesthetic Guidelines
- Leverage code blocks for formulas/examples
- Apply italic for explanations and bold for emphasis
- Structure with clear visual hierarchy
- Understand the main topic and ignore irrelevant videos
# Success Metrics
Enable users to:
- Identify current winning content in their niche
- Extract proven viral patterns
- Create optimized videos with higher view/retention potential
# Optimization Rules
- Prioritize highest-impact insights
- Use concise, actionable language
- Combine related points efficiently
- Maintain visual appeal within character limits
# Core Parameters
## Response Format: Discord markdown only
- Character Limit: 2000 characters maximum
- Execution Mode: Auto-execute both data collection tools immediately, then analyze
## Discord Formatting Arsenal
- \_bold\_ | \_italic\_ | ~strikethrough~ | \`code\`
- :emoji: for visual appeal
- do not use seperators
- do not use headers
- avoid double \n\n within same topic header
Analysis:
`}
/>
## Send Report
Finally I decided to send the report to a Discord channel.
All you need to do is install the **Discord Node** and connect your channels' webhook.
## That's it!
Imagine trying to do all of this manually. It would take you hours to search for this outliers and then you would need to manually analyse the videos and write up the report.
With TubeLab and n8n you can automate the process and get the report every week without any effort.
## Next steps
Now that you have setup TubeLab with n8n, it's time to create your first workflow.
# Channel Shorts
URL: /api/reference/get-channel-shorts
***
title: Channel Shorts
full: true
\_openapi:
method: GET
route: /channel/shorts/{id}
toc: \[]
structuredData:
headings: \[]
contents:
* content: Get shorts from a YouTube channel with sampled metrics.
***
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
Get shorts from a YouTube channel with sampled metrics.
# Channel Videos
URL: /api/reference/get-channel-videos
***
title: Channel Videos
full: true
\_openapi:
method: GET
route: /channel/videos/{id}
toc: \[]
structuredData:
headings: \[]
contents:
* content: Get videos from a YouTube channel with sampled metrics.
***
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
Get videos from a YouTube channel with sampled metrics.
# Scan
URL: /api/reference/get-scan
***
title: Scan
full: true
\_openapi:
method: GET
route: /scan/{id}
toc: \[]
structuredData:
headings: \[]
contents:
* content: >-
Get a scan by id.
Read the [**scanning** documentation](/api/scanning) to understand how
to use this endpoint.
***
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
Get a scan by id.
Read the [**scanning** documentation](/api/scanning) to understand how to use this endpoint.
# Video Comments
URL: /api/reference/get-video-comments
***
title: Video Comments
full: true
\_openapi:
method: GET
route: /video/comments/{id}
toc: \[]
structuredData:
headings: \[]
contents:
* content: Get the last 100 comments of a YouTube video.
***
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
Get the last 100 comments of a YouTube video.
# Video Details
URL: /api/reference/get-video-details
***
title: Video Details
full: true
\_openapi:
method: GET
route: /video/{id}
toc: \[]
structuredData:
headings: \[]
contents:
* content: Get details of a YouTube video.
***
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
Get details of a YouTube video.
# Video Transcript
URL: /api/reference/get-video-transcript
***
title: Video Transcript
full: true
\_openapi:
method: GET
route: /video/transcript/{id}
toc: \[]
structuredData:
headings: \[]
contents:
* content: Get the transcript of a YouTube video.
***
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
Get the transcript of a YouTube video.
# Scan
URL: /api/reference/post-scan
***
title: Scan
full: true
\_openapi:
method: POST
route: /scan
toc: \[]
structuredData:
headings: \[]
contents:
* content: >-
Start a YouTube scan to search for outliers and channels on any given
topic.
Read the [**scanning** documentation](/api/scanning) to understand how
to use this endpoint.
***
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
Start a YouTube scan to search for outliers and channels on any given topic.
Read the [**scanning** documentation](/api/scanning) to understand how to use this endpoint.
# Similar Channels
URL: /api/reference/search-channels-related
***
title: Similar Channels
full: true
\_openapi:
method: GET
route: /search/channels/related
toc: \[]
structuredData:
headings: \[]
contents:
* content: >-
Search for YouTube channels with **related content to another
channel**.
***
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
Search for YouTube channels with **related content to another channel**.
# Channels
URL: /api/reference/search-channels
***
title: Channels
full: true
\_openapi:
method: GET
route: /search/channels
toc: \[]
structuredData:
headings: \[]
contents:
* content: >-
Search for channels directly from the [YouTube Niche
Finder](https://tubelab.net/youtube-niche-finder) with AI enhanced
data and 30+ filters. Updated in real-time, 24/7.
***
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
Search for channels directly from the [YouTube Niche Finder](https://tubelab.net/youtube-niche-finder) with AI enhanced data and 30+ filters. Updated in real-time, 24/7.
# Similar Outliers
URL: /api/reference/search-outliers-related
***
title: Similar Outliers
full: true
\_openapi:
method: GET
route: /search/outliers/related
toc: \[]
structuredData:
headings: \[]
contents:
* content: >-
Search for YouTube outliers with **related content to another
outlier(s)**.
***
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
Search for YouTube outliers with **related content to another outlier(s)**.
# Outliers
URL: /api/reference/search-outliers
***
title: Outliers
full: true
\_openapi:
method: GET
route: /search/outliers
toc: \[]
structuredData:
headings: \[]
contents:
* content: >-
Search for videos directly from the [YouTube Outliers
Finder](https://tubelab.net/youtube-outliers-finder) library with AI
enhanced data and 30+ filters. Updated in real-time, 24/7.
***
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
Search for videos directly from the [YouTube Outliers Finder](https://tubelab.net/youtube-outliers-finder) library with AI enhanced data and 30+ filters. Updated in real-time, 24/7.