# 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.net/) with [n8n](https://n8n.io/) to create powerful YouTube automation workflows.
This is a practical guide, and we'll create a competetition tracker workflow for your YouTube channel.
* [**YouTube Trends Tracker**](/api/automation/trends-tracker): leverages TubeLab and AI to automatically create trends reports, analysis of top competitors and new viral ideas based on your channel.
### Pre-requisites
* An active [TubeLab](https://tubelab.net/) subscription
* A valid [TubeLab API Key](https://tubelab.net/developers)
## Setup n8n with TubeLab
### Install TubeLab's Node
[TubeLab's n8n node](https://www.npmjs.com/package/n8n-nodes-tubelab) is now officially available directly in n8n as a node!
1. Go to any **Workflow** > right click **Add Node**
2. Search for **TubeLab** and 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 [trends tracker workflow](/api/automation/trends-tracker).
# YouTube Trends Tracker
URL: /api/automation/trends-tracker
***
title: YouTube Trends Tracker
description: Learn how to create an n8n workflow to track your YouTube competitors
----------------------------------------------------------------------------------
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 setting up the workflow, it helps to break down the process in smaller steps:
1. **Research**: we'll start by analysing your channel with Gemini and then using TubeLab to find outliers from your competitors;
2. **Analysis**: we then fetch the transcript of the top-performing videos and prompt Gemini to analyse them;
3. **Report**: finally we prompt Claude to create a report with the findings and generate new ideas for your channel.
## Pre-requisites
1. Refer to the [Quickstart](/api/automation/quickstart) guide to setup n8n with TubeLab and create the workflow.
2. Setup [OpenRouter credentials](https://jannicknijholt.nl/integrate-openrouter-in-n8n/) in n8n with the OpenAI node.
3. Setup a [Discord Webhook](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks) to send the report to.
We've chosen to use OpenRouter because it let's you use multiple AI models without having to setup multiple credentials and different nodes.
Here's the step-by-step guide:
1. Go to [OpenRouter](https://openrouter.ai/settings/credits) and add $5 to your account.
2. Create an API key [here](https://openrouter.ai/settings/keys) and copy it.
3. Go to your n8n credentials and click on **Create Credential**.
4. Select **OpenAI** as the provider.
5. **Paste your OpenRouter API key**.
6. Update the **Base URL** to `https://openrouter.ai/api/v1` and save.
Now you're all set, just add an **OpenAI** node and select the credential your just created.
You can use any OpenRouter model by selecting the **Model** by ID.
To send the report to a Discord channel of your choice you need to get that channel's webhook URL.
Here's the step-by-step guide:
1. Open your Server Settings and head into the Integrations tab:
2. Click the "Create Webhook" button to create a new webhook!
3. Copy the webhook URL.
4. Go to the your n8n credentials and click on **Create Credential**.
5. Select **Discord Webhook**.
6. **Paste** your Discord webhook URL.
7. Save.
Now on the workflow, go to the last node and select the **Discord Webhook** credential you just created.
## Configuring the workflow
Assuming you have the pre-requisites setup, all you need to do is:
1. Copy this link: `http://tubelab.ai/docs/youtube-trends-tracker.json`.
2. Create a new workflow in n8n and click on the top-right corner '...' > **Import from URL**.
3. Paste the link and click on **Import**.

4. Open the `Get Videos` node and set your `Channel ID`.

**How to find channel IDs?** Paste any video in [TubeLab's Video
Extractor](https://tubelab.net/video-extractor) and copy the channel ID.
## Research

We need to collect data first. This is done by:
1. [Analysing your channel](/api/automation/trends-tracker#analyse-your-channel) with Gemini to understand your niche and audience interests;
2. [Searching for outlier videos](/api/automation/trends-tracker#search-for-outliers-from-your-competitors) from your competitors and adjacent audience interests.
### Analysing your channel
We'll use TubeLab to fetch your channel's videos and prompt Gemini to analyse your niche & audience.
### Searching for outliers from your competitors and adjacent niches
We'll be using TubeLab's real-time outlier data to search for high-performing videos from your competitors and adjacent niches based on your audience interests.
**This data is fundamental to extract the winning patterns that will get you more views.**
## Analysis

Now that we have the data, let's extract the viral patterns of the data we've collected:
* title formulas
* hook formulas
* trending topics
This is done by using TubeLab to get the transcripts of the top-performing videos and prompting Gemini to extract those patterns.
## Create a Report

Finally we have all the data we need to understand what get's more views.
We'll be using Claude to create a report with the findings and generate new ideas for your channel.
Then we'll send the report to a Discord channel.
## 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've setup this workflow, you can extend it and create your own use cases.
Such as:
* Generating new ideas from your channel's comments;
* Generating scripts based on any YouTube video;
Explore TubeLab's API easily directly within n8n.
# 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.