{
  "openapi": "3.1.0",
  "info": {
    "title": "Pipefetch API",
    "version": "1.0.0",
    "description": "YouTube data as a simple JSON API: transcripts, videos, channels, search, comments and Shorts. Prepaid credits that never expire, no quota, no OAuth. Documentation: https://pipefetch.com/docs"
  },
  "servers": [
    {
      "url": "https://pipefetch.com"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "paths": {
    "/v1/youtube/transcript": {
      "get": {
        "operationId": "youtube_transcript",
        "summary": "YouTube Transcript API",
        "description": "The transcript of any public video with captions, as plain text, timestamped segments, SRT or WebVTT. Costs 1 credit per request; only requests that return data are charged.",
        "tags": [
          "YouTube"
        ],
        "parameters": [
          {
            "name": "video",
            "in": "query",
            "required": true,
            "description": "Video URL or 11-character video id. Watch, youtu.be, Shorts, embed and live links all work.",
            "schema": {
              "type": "string"
            },
            "example": "jNQXAC9IVRw"
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "description": "Preferred caption language code, such as en, es or pt-BR. Without it you get the video's original language.",
            "schema": {
              "type": "string"
            },
            "example": "en"
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "description": "What the text field holds: plain text, text with [0:12] timestamps, or a ready SRT or WebVTT file.",
            "schema": {
              "type": "string",
              "enum": [
                "text",
                "timestamped",
                "srt",
                "vtt"
              ],
              "default": "text"
            },
            "example": "text"
          },
          {
            "name": "segments",
            "in": "query",
            "required": false,
            "description": "Include the list of timed segments (start, duration, text).",
            "schema": {
              "type": "boolean",
              "default": true
            },
            "example": true
          }
        ],
        "responses": {
          "200": {
            "description": "The data, and the credits this request used.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "data": {
                    "videoId": "jNQXAC9IVRw",
                    "url": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
                    "title": "Me at the zoo",
                    "channel": {
                      "id": "UC4QobU6STFB0P71PMvOGN5A",
                      "name": "jawed",
                      "handle": "@jawed",
                      "url": "https://www.youtube.com/@jawed"
                    },
                    "publishedAt": "2005-04-23",
                    "durationSeconds": 19,
                    "language": "en",
                    "languageName": "English",
                    "isAutoGenerated": false,
                    "isPreferredLanguage": true,
                    "availableLanguages": [
                      {
                        "code": "en",
                        "name": "English",
                        "isAutoGenerated": false
                      },
                      {
                        "code": "de",
                        "name": "German",
                        "isAutoGenerated": false
                      }
                    ],
                    "format": "text",
                    "text": "All right, so here we are, in front of the elephants the cool thing about these guys is that they have really... really really long trunks and that's …",
                    "wordCount": 39,
                    "segments": [
                      {
                        "start": 1.2,
                        "duration": 2.16,
                        "text": "All right, so here we are, in front of the elephants"
                      },
                      {
                        "start": 5.318,
                        "duration": 2.656,
                        "text": "the cool thing about these guys is that they have really..."
                      }
                    ],
                    "chapters": [
                      {
                        "title": "Intro",
                        "startSeconds": 0,
                        "endSeconds": 5
                      },
                      {
                        "title": "The cool thing",
                        "startSeconds": 5,
                        "endSeconds": 17
                      }
                    ]
                  },
                  "credits": {
                    "used": 1,
                    "remaining": 99
                  }
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or not valid. Not charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing or not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Not enough credits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Nothing to return for this request. Not charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry after a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "YouTube did not answer. Not charged; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/youtube/video": {
      "get": {
        "operationId": "youtube_video",
        "summary": "YouTube Video API",
        "description": "Exact views, likes and comment count, description, tags, chapters and channel for one video. Costs 1 credit per request; only requests that return data are charged.",
        "tags": [
          "YouTube"
        ],
        "parameters": [
          {
            "name": "video",
            "in": "query",
            "required": true,
            "description": "Video URL or 11-character video id. Watch, youtu.be, Shorts, embed and live links all work.",
            "schema": {
              "type": "string"
            },
            "example": "jNQXAC9IVRw"
          }
        ],
        "responses": {
          "200": {
            "description": "The data, and the credits this request used.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "data": {
                    "videoId": "jNQXAC9IVRw",
                    "url": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
                    "title": "Me at the zoo",
                    "description": "Microplastics are accumulating in human brains at an alarming rate\nhttps://www.youtube.com/watch?v=0PT5c1z3LL8\n\n“Nanoplastics and Human Health” with M…",
                    "publishedAt": "2005-04-24T03:31:52.000Z",
                    "durationSeconds": 19,
                    "viewCount": 448773635,
                    "likeCount": 20141346,
                    "commentCount": 10644331,
                    "category": "Film & Animation",
                    "keywords": [
                      "me at the zoo",
                      "jawed karim"
                    ],
                    "hashtags": [],
                    "chapters": [
                      {
                        "title": "Intro",
                        "startSeconds": 0
                      },
                      {
                        "title": "The cool thing",
                        "startSeconds": 5
                      }
                    ],
                    "thumbnailUrl": "https://i.ytimg.com/vi/jNQXAC9IVRw/hqdefault.jpg",
                    "isLive": false,
                    "isUpcoming": false,
                    "isFamilySafe": true,
                    "isAgeRestricted": false,
                    "commentsTurnedOff": false,
                    "channel": {
                      "id": "UC4QobU6STFB0P71PMvOGN5A",
                      "name": "jawed",
                      "handle": "@jawed",
                      "url": "https://www.youtube.com/@jawed",
                      "isVerified": true,
                      "avatarUrl": "https://yt3.ggpht.com/uI3VE4PVqvCy0xnWLqMJnEzyBUm3T8VHOCp4ee-1RxdHqKXCdUE_qXYQnpf9AfuEoIPactVyDhM=s800-c-k-c0x00ffffff-no-rj",
                      "subscriberCount": 6740000
                    }
                  },
                  "credits": {
                    "used": 1,
                    "remaining": 99
                  }
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or not valid. Not charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing or not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Not enough credits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Nothing to return for this request. Not charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry after a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "YouTube did not answer. Not charged; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/youtube/channel": {
      "get": {
        "operationId": "youtube_channel",
        "summary": "YouTube Channel API",
        "description": "Subscribers, video count, description, keywords and avatar for a channel, from a handle, id or URL. Costs 1 credit per request; only requests that return data are charged.",
        "tags": [
          "YouTube"
        ],
        "parameters": [
          {
            "name": "channel",
            "in": "query",
            "required": true,
            "description": "Channel handle (@mkbhd), channel id (UC…) or any channel URL.",
            "schema": {
              "type": "string"
            },
            "example": "@mkbhd"
          }
        ],
        "responses": {
          "200": {
            "description": "The data, and the credits this request used.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "data": {
                    "id": "UCBJycsmduvYEL83R_U4JriQ",
                    "handle": "@mkbhd",
                    "title": "Marques Brownlee",
                    "url": "https://www.youtube.com/@mkbhd",
                    "description": "MKBHD: Quality Tech Videos | YouTuber | Geek | Consumer Electronics | Tech Head | Internet Personality!\n\nbusiness@MKBHD.com\n\nNYC",
                    "keywords": [
                      "MKBHD",
                      "MarquesBrownlee"
                    ],
                    "subscriberCount": 21400000,
                    "videoCount": 1800,
                    "avatarUrl": "https://yt3.googleusercontent.com/qu4TmIaYUlS41-dJ9gZ7DUR3nilvmB5_11i6OKSdvNnBNiyOusZP1bMN6ICnuxtjFBb6ioKgRQ=s900-c-k-c0x00ffffff-no-rj",
                    "rssUrl": "https://www.youtube.com/feeds/videos.xml?channel_id=UCBJycsmduvYEL83R_U4JriQ",
                    "isFamilySafe": true
                  },
                  "credits": {
                    "used": 1,
                    "remaining": 99
                  }
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or not valid. Not charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing or not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Not enough credits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Nothing to return for this request. Not charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry after a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "YouTube did not answer. Not charged; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/youtube/channel/videos": {
      "get": {
        "operationId": "youtube_channel_videos",
        "summary": "YouTube Channel Videos API",
        "description": "The latest uploads of a channel, newest first, with views, duration and publish time. Costs 1 credit per request; only requests that return data are charged.",
        "tags": [
          "YouTube"
        ],
        "parameters": [
          {
            "name": "channel",
            "in": "query",
            "required": true,
            "description": "Channel handle (@mkbhd), channel id (UC…) or any channel URL.",
            "schema": {
              "type": "string"
            },
            "example": "@mkbhd"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many of the latest uploads to return.",
            "schema": {
              "type": "integer",
              "default": 30,
              "minimum": 1,
              "maximum": 30
            },
            "example": 10
          }
        ],
        "responses": {
          "200": {
            "description": "The data, and the credits this request used.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "data": {
                    "channel": {
                      "id": "UCBJycsmduvYEL83R_U4JriQ",
                      "handle": "@mkbhd",
                      "title": "Marques Brownlee",
                      "url": "https://www.youtube.com/@mkbhd",
                      "description": "MKBHD: Quality Tech Videos | YouTuber | Geek | Consumer Electronics | Tech Head | Internet Personality!\n\nbusiness@MKBHD.com\n\nNYC",
                      "keywords": [
                        "MKBHD",
                        "MarquesBrownlee"
                      ],
                      "subscriberCount": 21400000,
                      "videoCount": 1800,
                      "avatarUrl": "https://yt3.googleusercontent.com/qu4TmIaYUlS41-dJ9gZ7DUR3nilvmB5_11i6OKSdvNnBNiyOusZP1bMN6ICnuxtjFBb6ioKgRQ=s900-c-k-c0x00ffffff-no-rj",
                      "rssUrl": "https://www.youtube.com/feeds/videos.xml?channel_id=UCBJycsmduvYEL83R_U4JriQ",
                      "isFamilySafe": true
                    },
                    "videos": [
                      {
                        "videoId": "KTDJiVpSDTI",
                        "url": "https://www.youtube.com/watch?v=KTDJiVpSDTI",
                        "title": "Can You Trust MKBHD?",
                        "publishedAt": "2026-11-17T19:30:11.900Z",
                        "publishedText": "10 hours ago",
                        "durationSeconds": 859,
                        "viewCount": 1700000,
                        "viewCountIsExact": false,
                        "isShort": false,
                        "isLive": false,
                        "thumbnailUrl": "https://i.ytimg.com/vi/KTDJiVpSDTI/hq720.jpg?sqp=-oaymwEcCNAFEJQDSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLBOWjJjhywnruZoW1bRSHpWiDaawA"
                      },
                      {
                        "videoId": "hdMszZ2ah5Q",
                        "url": "https://www.youtube.com/watch?v=hdMszZ2ah5Q",
                        "title": "Macbook PROLED Review: It's Not About That",
                        "publishedAt": "2026-11-12T05:30:11.900Z",
                        "publishedText": "6 days ago",
                        "durationSeconds": 914,
                        "viewCount": 6300000,
                        "viewCountIsExact": false,
                        "isShort": false,
                        "isLive": false,
                        "thumbnailUrl": "https://i.ytimg.com/vi/hdMszZ2ah5Q/hq720.jpg?sqp=-oaymwEcCNAFEJQDSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLD0HF46llGxRDz9L9cu4IGbzzIDPg"
                      }
                    ]
                  },
                  "credits": {
                    "used": 1,
                    "remaining": 99
                  }
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or not valid. Not charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing or not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Not enough credits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Nothing to return for this request. Not charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry after a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "YouTube did not answer. Not charged; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/youtube/channel/shorts": {
      "get": {
        "operationId": "youtube_channel_shorts",
        "summary": "YouTube Shorts API",
        "description": "The Shorts of a channel, newest first, with view counts and thumbnails. Costs 1 credit per request; only requests that return data are charged.",
        "tags": [
          "YouTube"
        ],
        "parameters": [
          {
            "name": "channel",
            "in": "query",
            "required": true,
            "description": "Channel handle (@mkbhd), channel id (UC…) or any channel URL.",
            "schema": {
              "type": "string"
            },
            "example": "@mkbhd"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many of the latest Shorts to return.",
            "schema": {
              "type": "integer",
              "default": 20,
              "minimum": 1,
              "maximum": 40
            },
            "example": 20
          }
        ],
        "responses": {
          "200": {
            "description": "The data, and the credits this request used.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "data": {
                    "channel": {
                      "id": "UCX6OQ3DkcsbYNE6H8uQQuVA",
                      "name": "MrBeast",
                      "url": "https://www.youtube.com/channel/UCX6OQ3DkcsbYNE6H8uQQuVA"
                    },
                    "shorts": [
                      {
                        "videoId": "sHpEqeSByPI",
                        "url": "https://www.youtube.com/shorts/sHpEqeSByPI",
                        "title": "Unboxing The World’s Largest Toy",
                        "viewCount": 22000000,
                        "viewCountIsExact": false,
                        "thumbnailUrl": "https://i.ytimg.com/vi/sHpEqeSByPI/sardefault.jpg?sqp=-oaymwEdCJUDENAFSFWQAgHyq4qpAwwIARUAAIhCcAHAAQY=&rs=AOn4CLB2V7YWBrDdLVa4cnMdEBvQYu00hA"
                      },
                      {
                        "videoId": "kPI9Mc35mOg",
                        "url": "https://www.youtube.com/shorts/kPI9Mc35mOg",
                        "title": "Trap Door Roulette",
                        "viewCount": 103000000,
                        "viewCountIsExact": false,
                        "thumbnailUrl": "https://i.ytimg.com/vi/kPI9Mc35mOg/sardefault.jpg?sqp=-oaymwEdCJUDENAFSFWQAgHyq4qpAwwIARUAAIhCcAHAAQY=&rs=AOn4CLCFqW_X3pokjvblVc71mCamXfPyhQ"
                      }
                    ]
                  },
                  "credits": {
                    "used": 1,
                    "remaining": 99
                  }
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or not valid. Not charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing or not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Not enough credits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Nothing to return for this request. Not charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry after a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "YouTube did not answer. Not charged; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/youtube/search": {
      "get": {
        "operationId": "youtube_search",
        "summary": "YouTube Search API",
        "description": "YouTube search results for a query, with the same sorting and filters the site offers. Costs 1 credit per request; only requests that return data are charged.",
        "tags": [
          "YouTube"
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "description": "The search query.",
            "schema": {
              "type": "string"
            },
            "example": "web scraping tutorial"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many results to return.",
            "schema": {
              "type": "integer",
              "default": 20,
              "minimum": 1,
              "maximum": 40
            },
            "example": 20
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "Kind of result.",
            "schema": {
              "type": "string",
              "enum": [
                "video",
                "short",
                "channel",
                "playlist",
                "all"
              ],
              "default": "video"
            },
            "example": "video"
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Result order.",
            "schema": {
              "type": "string",
              "enum": [
                "relevance",
                "popularity",
                "newest",
                "mostViewed"
              ],
              "default": "relevance"
            },
            "example": "relevance"
          },
          {
            "name": "uploaded",
            "in": "query",
            "required": false,
            "description": "Only results uploaded within this period.",
            "schema": {
              "type": "string",
              "enum": [
                "hour",
                "today",
                "week",
                "month",
                "year"
              ]
            },
            "example": "month"
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "description": "Two-letter country code the search is run for.",
            "schema": {
              "type": "string"
            },
            "example": "US"
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "description": "Interface language code for titles and labels.",
            "schema": {
              "type": "string"
            },
            "example": "en"
          }
        ],
        "responses": {
          "200": {
            "description": "The data, and the credits this request used.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "data": {
                    "query": "web scraping tutorial",
                    "results": [
                      {
                        "type": "video",
                        "id": "QhD015WUMxE",
                        "url": "https://www.youtube.com/watch?v=QhD015WUMxE",
                        "title": "Beginners Guide To Web Scraping with Python - All You Need To Know",
                        "description": "The web is full of data. Lots and lots of data. Data prime for scraping. But manually going to a website and copying and pasting the ...",
                        "publishedAt": "2022-05-19T14:34:23.927Z",
                        "publishedAtPrecision": "estimated",
                        "durationSeconds": 456,
                        "viewCount": 491436,
                        "viewCountIsExact": true,
                        "isLive": false,
                        "thumbnailUrl": "https://i.ytimg.com/vi/QhD015WUMxE/hq720.jpg",
                        "position": 1,
                        "channel": {
                          "id": "UCZDA1kA3y3EIg25BpcHSpwQ",
                          "name": "Tinkernut",
                          "handle": "@Tinkernut",
                          "url": "https://www.youtube.com/@Tinkernut",
                          "isVerified": true
                        }
                      },
                      {
                        "type": "video",
                        "id": "hHQlcnubuFI",
                        "url": "https://www.youtube.com/watch?v=hHQlcnubuFI",
                        "title": "Learn Web Scraping in 5 Minutes (NO PRIOR KNOWLEDGE)",
                        "description": "Get Rid of IP Blocking for just $1 with DataImpulse: ...",
                        "publishedAt": "2026-03-04T12:19:23.927Z",
                        "publishedAtPrecision": "estimated",
                        "durationSeconds": 293,
                        "viewCount": 191388,
                        "viewCountIsExact": true,
                        "isLive": false,
                        "thumbnailUrl": "https://i.ytimg.com/vi/hHQlcnubuFI/hq720.jpg",
                        "position": 2,
                        "channel": {
                          "id": "UCFVteOob_YXJHPaGTqlDV2Q",
                          "name": "CodeHead",
                          "handle": "@codehead01",
                          "url": "https://www.youtube.com/@codehead01",
                          "isVerified": true
                        }
                      }
                    ]
                  },
                  "credits": {
                    "used": 1,
                    "remaining": 99
                  }
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or not valid. Not charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing or not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Not enough credits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Nothing to return for this request. Not charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry after a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "YouTube did not answer. Not charged; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/youtube/comments": {
      "get": {
        "operationId": "youtube_comments",
        "summary": "YouTube Comments API",
        "description": "Top or newest comments of a video with likes, reply counts, pinned and hearted flags. Costs 1 credit per 20 items requested; only requests that return data are charged.",
        "tags": [
          "YouTube"
        ],
        "parameters": [
          {
            "name": "video",
            "in": "query",
            "required": true,
            "description": "Video URL or 11-character video id. Watch, youtu.be, Shorts, embed and live links all work.",
            "schema": {
              "type": "string"
            },
            "example": "jNQXAC9IVRw"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "How many comments to return. Every started 20 comments cost 1 credit.",
            "schema": {
              "type": "integer",
              "default": 20,
              "minimum": 1,
              "maximum": 100
            },
            "example": 20
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Top comments first, or newest first.",
            "schema": {
              "type": "string",
              "enum": [
                "top",
                "newest"
              ],
              "default": "top"
            },
            "example": "top"
          }
        ],
        "responses": {
          "200": {
            "description": "The data, and the credits this request used.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "data": {
                    "videoId": "jNQXAC9IVRw",
                    "totalComments": 10000000,
                    "comments": [
                      {
                        "id": "UgzuC3zzpRZkjc5Qzsd4AaABAg",
                        "text": "We're so honored that the first ever YouTube video was filmed here!",
                        "likeCount": 4800000,
                        "replyCount": 986,
                        "publishedText": "6 years ago",
                        "isPinned": true,
                        "isHeartedByCreator": true,
                        "author": {
                          "name": "@SanDiegoZoo",
                          "channelId": "UCC5NfQ6Mf0dq_eEwv4P_hWA",
                          "channelUrl": "https://www.youtube.com/channel/UCC5NfQ6Mf0dq_eEwv4P_hWA",
                          "avatarUrl": "https://yt3.ggpht.com/i8RqA9tYqbbnOi4mlnYEY7IR3kXAoDqQbM_5Sfzw7OjTubiGsOaTdlrIZmj-I0q0Vup68eqs=s88-c-k-c0x00ffffff-no-rj",
                          "isVerified": true,
                          "isChannelOwner": false
                        }
                      }
                    ]
                  },
                  "credits": {
                    "used": 1,
                    "remaining": 99
                  }
                }
              }
            }
          },
          "400": {
            "description": "A parameter is missing or not valid. Not charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing or not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Not enough credits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Nothing to return for this request. Not charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests. Retry after a moment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "YouTube did not answer. Not charged; retry.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}