YouTube Data API

Extract transcripts, comments, and insights from any public YouTube video with simple REST API calls.

25 credits free • Simple authentication • RESTful endpoints

Quick start

Get up and running in minutes with simple API calls

1

Get your API key

Sign up for free and generate your API key from the dashboard.

2

Make API calls

Use simple HTTP requests to extract video data and insights.

3

Process the response

Receive structured JSON data ready for your application.

API endpoints

RESTful endpoints for YouTube content extraction

GET

Transcript

GET /api/youtube/{video_id}/transcript

Extract full transcript with accurate timestamps from any public video.

1 credit
GET

Video Analysis

GET /api/youtube/{video_id}/analyze

Get AI-powered insights including topics, summary, and key moments.

2 credits
GET

Comments

GET /api/youtube/{video_id}/comments

Extract up to 300 comments with metadata from any video.

3 credits
GET

Comment Analysis

GET /api/youtube/{video_id}/comments/analyze

Deep sentiment analysis, themes, and patterns from comment threads.

5 credits

Code examples

Ready-to-use code snippets in popular languages

cURL

# Get video transcript
curl -X GET "https://api.taffysearch.com/api/youtube/dQw4w9WgXcQ/transcript" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

# Response
{
  "video_id": "dQw4w9WgXcQ",
  "title": "Rick Astley - Never Gonna Give You Up",
  "duration": 212,
  "transcript": [
    {
      "text": "We're no strangers to love",
      "start_time": 8.2,
      "duration": 2.4
    },
    {
      "text": "You know the rules and so do I",
      "start_time": 10.8,
      "duration": 2.8
    }
  ],
  "credits_used": 1
}

Python

import requests

# Configuration
API_KEY = "your_api_key_here"
VIDEO_ID = "dQw4w9WgXcQ"
BASE_URL = "https://api.taffysearch.com/api/youtube"

headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

# Get transcript
response = requests.get(f"{BASE_URL}/{VIDEO_ID}/transcript", headers=headers)
data = response.json()

print(f"Title: {data['title']}")
print(f"Duration: {data['duration']} seconds")
print(f"Credits used: {data['credits_used']}")

for segment in data['transcript']:
    print(f"{segment['start_time']}s: {segment['text']}")

JavaScript

const API_KEY = 'your_api_key_here';
const VIDEO_ID = 'dQw4w9WgXcQ';
const BASE_URL = 'https://api.taffysearch.com/api/youtube';

async function getVideoTranscript(videoId) {
  try {
    const response = await fetch(`${BASE_URL}/${videoId}/transcript`, {
      method: 'GET',
      headers: {
        'Authorization': `Bearer ${API_KEY}`,
        'Content-Type': 'application/json'
      }
    });

    const data = await response.json();
    console.log('Title:', data.title);
    console.log('Duration:', data.duration + ' seconds');
    console.log('Credits used:', data.credits_used);

    data.transcript.forEach(segment => {
      console.log(`${segment.start_time}s: ${segment.text}`);
    });

    return data;
  } catch (error) {
    console.error('Error fetching transcript:', error);
  }
}

getVideoTranscript(VIDEO_ID);

Authentication

Simple API key authentication for all requests

Header Authentication

Authorization: Bearer YOUR_API_KEY

Include your API key in the Authorization header for all requests. This is the recommended method.

Query Parameter

?api_key=YOUR_API_KEY

Alternative method: pass your API key as a query parameter in the URL.

Rate Limits & Credits

Rate Limits

  • • 100 requests per minute
  • • 1,000 requests per hour
  • • 10,000 requests per day

Credit Usage

  • • Credits deducted per successful response
  • • Failed requests don't consume credits
  • • Check remaining credits in response headers

Response formats

Structured JSON responses for easy integration

Transcript Response

{
  "video_id": "dQw4w9WgXcQ",
  "title": "Rick Astley - Never Gonna Give You Up",
  "duration": 212,
  "language": "en",
  "transcript": [
    {
      "text": "We're no strangers to love",
      "start_time": 8.2,
      "duration": 2.4,
      "confidence": 0.98
    }
  ],
  "credits_used": 1,
  "processing_time": 1.2
}

Comments Response

{
  "video_id": "dQw4w9WgXcQ",
  "title": "Rick Astley - Never Gonna Give You Up",
  "total_comments": 1247,
  "extracted_comments": 300,
  "comments": [
    {
      "text": "This song never gets old!",
      "author": "musiclover123",
      "likes": 42,
      "published_at": "2024-01-15T14:30:00Z",
      "reply_count": 3
    }
  ],
  "credits_used": 3,
  "processing_time": 2.8
}

Analysis Response

{
  "video_id": "dQw4w9WgXcQ",
  "title": "Rick Astley - Never Gonna Give You Up",
  "analysis": {
    "summary": "Classic 80s pop song about unwavering commitment...",
    "topics": [
      "love and relationships",
      "80s music",
      "pop culture"
    ],
    "key_moments": [
      {
        "timestamp": 8.2,
        "description": "Opening lyrics about love"
      }
    ],
    "sentiment": {
      "overall": "positive",
      "confidence": 0.92
    }
  },
  "credits_used": 2,
  "processing_time": 4.1
}

Error handling

Standard HTTP status codes and error responses

Status Codes

200 Success
400 Bad Request
401 Unauthorized
403 Insufficient Credits
404 Video Not Found
429 Rate Limited

Error Response

{
  "error": {
    "code": 403,
    "message": "Insufficient credits",
    "details": "You need 2 credits but only have 1 remaining",
    "credits_remaining": 1,
    "credits_required": 2
  },
  "request_id": "req_123abc456def"
}

SDKs and integrations

Official libraries and community tools

MCP Protocol

Direct integration with ChatGPT Desktop, Claude Code, Cursor, and Windsurf.

Setup guide available after signup

Python SDK

Official Python library with type hints and async support.

Coming soon

JavaScript SDK

TypeScript-ready library for Node.js and browser environments.

Coming soon

Developer FAQ

Common questions about the API

How do I get started with the API?

Sign up for a free account to get 25 credits and an API key. Use the key in your requests via the Authorization header or as a query parameter. All endpoints return structured JSON responses.

What are the rate limits?

The API allows 100 requests per minute, 1,000 per hour, and 10,000 per day. Rate limit headers are included in responses. Contact us if you need higher limits for your application.

Which video IDs are supported?

Standard 11-character YouTube video IDs from public videos. The API accepts IDs from watch URLs (youtube.com/watch?v=), short URLs (youtu.be/), and embed URLs. Private, unlisted, and age-restricted videos are not supported.

How accurate are transcripts and analysis?

Transcription accuracy exceeds 99.8% for clear audio. Analysis includes confidence scores for sentiment and topic classification. Processing time varies from 1-10 seconds depending on video length and analysis type.

Can I use the API for commercial projects?

Yes, the API is designed for both personal and commercial use. All plans include commercial usage rights. For high-volume applications or custom integrations, contact us about enterprise pricing.

What about data privacy and retention?

We process only public YouTube data and don't store video content. API responses are cached for 24 hours for performance. Full privacy policy and data handling details are available in our documentation.

Ready to build with Taffy?

Start extracting insights from YouTube content with our simple, powerful API.

25 free credits
RESTful API
JSON responses
Commercial use