YouTube Video Downloader
The Endpoints work the following: You send a request with the “Download a YouTube Video” endpoint. That will start downloading the youtube video. You will recieve an ID which you can give to the secone endpoint and check if the video has already been downloaded. Do note: the longer the video is, the longer the download will take. You may only download videos that are not bigger than 1 GB. The video will be stored for 7 days.
Download a YouTube Video
Section titled “Download a YouTube Video”Downloads a YouTube Video
POST/api/youtube/download
https://api.cookie-api.com/api/youtube/download
Authentication Learn how to get your API Key and use it in your requests!
{ "url": "https://youtu.be/YW7NV8J8oxI?si=jipA1bTmTo_qs6Io", "mode": "video" // Can be 'video' or 'audio' for audio export only (useful for music)}
curl --location 'https://api.cookie-api.com/api/youtube/download' \--header 'Authorization: API_Key' \--header 'Content-Type: application/json' \--data '{ "url": "https://youtu.be/YW7NV8J8oxI?si=jipA1bTmTo_qs6Io", "mode": "video"}'
import requests
url = "https://api.cookie-api.com/api/youtube/download"headers = { "Authorization": "API_Key", "Content-Type": "application/json"}payload = { "url": "https://youtu.be/YW7NV8J8oxI?si=jipA1bTmTo_qs6Io", "mode": "video"}
response = requests.post(url, headers=headers, json=payload)print(response.json())
fetch('https://api.cookie-api.com/api/youtube/download', { method: 'POST', headers: { 'Authorization': 'API_Key', 'Content-Type': 'application/json' }, body: JSON.stringify({ url: 'https://youtu.be/YW7NV8J8oxI?si=jipA1bTmTo_qs6Io', mode: 'video' })}).then(res => res.json()).then(console.log).catch(console.error);
package main
import ( "bytes" "encoding/json" "fmt" "net/http")
func main() { payload := map[string]string{ "url": "https://youtu.be/YW7NV8J8oxI?si=jipA1bTmTo_qs6Io", "mode": "video", }
body, _ := json.Marshal(payload) req, _ := http.NewRequest("POST", "https://api.cookie-api.com/api/youtube/download", bytes.NewBuffer(body)) req.Header.Set("Authorization", "API_Key") req.Header.Set("Content-Type", "application/json")
client := &http.Client{} res, err := client.Do(req) if err != nil { panic(err) } defer res.Body.Close()
fmt.Println("Response Status:", res.Status)}
const https = require('https');
const data = JSON.stringify({ url: 'https://youtu.be/YW7NV8J8oxI?si=jipA1bTmTo_qs6Io', mode: 'video'});
const options = { hostname: 'api.cookie-api.com', path: '/api/youtube/download', method: 'POST', headers: { 'Authorization': 'API_Key', 'Content-Type': 'application/json', 'Content-Length': data.length }};
const req = https.request(options, res => { let response = ''; res.on('data', chunk => response += chunk); res.on('end', () => console.log(JSON.parse(response)));});
req.on('error', error => console.error(error));req.write(data);req.end();
require 'net/http'require 'uri'require 'json'
uri = URI.parse("https://api.cookie-api.com/api/youtube/download")request = Net::HTTP::Post.new(uri)request["Authorization"] = "API_Key"request["Content-Type"] = "application/json"request.body = { url: "https://youtu.be/YW7NV8J8oxI?si=jipA1bTmTo_qs6Io", mode: "video"}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request)end
puts response.body
use reqwest::blocking::Client;use serde_json::json;
fn main() { let client = Client::new(); let res = client.post("https://api.cookie-api.com/api/youtube/download") .header("Authorization", "API_Key") .header("Content-Type", "application/json") .json(&json!({ "url": "https://youtu.be/YW7NV8J8oxI?si=jipA1bTmTo_qs6Io", "mode": "video" })) .send() .unwrap();
println!("{:#?}", res.text().unwrap());}
Responses
{ "message": "Video will be available shortly on the url.", "success": true, "url": "https://videos.cookie-api.com/youtube/e81ccd95-c889-45ca-9301-03ff36471808.mp4", "video_id": "e81ccd95-c889-45ca-9301-03ff36471808"}
Get the Status of an upload
Section titled “Get the Status of an upload”Returns the status of the element that is currently being uploaded
GET/api/youtube/video-status
https://api.cookie-api.com/api/youtube/video-status
Authentication Learn how to get your API Key and use it in your requests!
URL Parameters | |
---|---|
video | Either the cdn url directly or the provided video_id |
curl --location 'https://api.cookie-api.com/api/youtube/video-status?video=e7f254b3-6cef-46ac-b30c-c5930789d37e' \--header 'Authorization: API_Key'
import requests
url = 'https://api.cookie-api.com/api/youtube/video-status'params = { 'video': 'e7f254b3-6cef-46ac-b30c-c5930789d37e'}headers = { 'Authorization': 'API_Key'}
response = requests.get(url, params=params, headers=headers)print(response.json())
const fetch = require('node-fetch');
const url = 'https://api.cookie-api.com/api/youtube/video-status?video=e7f254b3-6cef-46ac-b30c-c5930789d37e';const headers = { 'Authorization': 'API_Key'};
fetch(url, { headers }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error));
package main
import ( "fmt" "log" "net/http" "io/ioutil")
func main() { url := "https://api.cookie-api.com/api/youtube/video-status?video=e7f254b3-6cef-46ac-b30c-c5930789d37e" req, err := http.NewRequest("GET", url, nil) if err != nil { log.Fatal(err) } req.Header.Set("Authorization", "API_Key")
client := &http.Client{} resp, err := client.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body) if err != nil { log.Fatal(err) }
fmt.Println(string(body))}
const https = require('https');
const options = { hostname: 'api.cookie-api.com', path: '/api/youtube/video-status?video=e7f254b3-6cef-46ac-b30c-c5930789d37e', method: 'GET', headers: { 'Authorization': 'API_Key' }};
const req = https.request(options, res => { let responseData = '';
res.on('data', chunk => { responseData += chunk; });
res.on('end', () => { console.log(JSON.parse(responseData)); });});
req.on('error', error => { console.error(error);});
req.end();
require 'net/http'require 'json'require 'uri'
url = URI.parse('https://api.cookie-api.com/api/youtube/video-status?video=e7f254b3-6cef-46ac-b30c-c5930789d37e')request = Net::HTTP::Get.new(url)request['Authorization'] = 'API_Key'
response = Net::HTTP.start(url.hostname, url.port) { |http| http.request(request) }
puts JSON.parse(response.body)
use reqwest::blocking::Client;use reqwest::header::HeaderMap;use serde_json::Value;
fn main() { let url = "https://api.cookie-api.com/api/youtube/video-status?video=e7f254b3-6cef-46ac-b30c-c5930789d37e";
let client = Client::new(); let mut headers = HeaderMap::new(); headers.insert("Authorization", "API_Key".parse().unwrap());
let res = client.get(url) .headers(headers) .send() .unwrap();
let body: Value = res.json().unwrap(); println!("{:?}", body);}
Responses
{ "cdn_link": "https://videos.cookie-api.com/youtube/e81ccd95-c889-45ca-9301-03ff36471808.mp4", "media_format": "mp4", "media_type": "video", "status": "uploading", "success": true, "uploaded_at": "1746650585", "youtube_link": "https://youtu.be/YW7NV8J8oxI?si=jipA1bTmTo_qs6Io"}
{ "cdn_link": "https://videos.cookie-api.com/youtube/e81ccd95-c889-45ca-9301-03ff36471808.mp4", "media_format": "mp4", "media_type": "video", "status": "available", "success": true, "uploaded_at": "1746650585", "youtube_link": "https://youtu.be/YW7NV8J8oxI?si=jipA1bTmTo_qs6Io"}
{ "cdn_link": "https://videos.cookie-api.com/youtube/e81ccd95-c889-45ca-9301-03ff36471808.mp4", "media_format": "mp4", "media_type": "video", "status": "deleted", "success": true, "uploaded_at": "1746650585", "youtube_link": "https://youtu.be/YW7NV8J8oxI?si=jipA1bTmTo_qs6Io"}
{ "cdn_link": "https://videos.cookie-api.com/youtube/e81ccd95-c889-45ca-9301-03ff36471808.mp4", "media_format": "mp4", "media_type": "video", "status": "failed", "success": true, "uploaded_at": "1746650585", "youtube_link": "https://youtu.be/YW7NV8J8oxI?si=jipA1bTmTo_qs6Io"}
Delete a YouTube Video
Section titled “Delete a YouTube Video”Deletes a video
Videos are not instantly deleted. They stay cached for a few hours and may be available after deleting the video.
DELETE/api/youtube/delete-video
https://api.cookie-api.com/api/youtube/delete-video
Authentication Learn how to get your API Key and use it in your requests!
URL Parameters | |
---|---|
video | Either the cdn url directly or the provided video_id |
curl --location --request DELETE 'https://api.cookie-api.com/api/youtube/delete-video?video=https%3A%2F%2Fvideos.cookie-api.com%2Fyoutube%2Fc6f4a7c4-ee92-4c8f-a211-299da29b044c.mp4' \--header 'Authorization: API_Key'
import requests
url = 'https://api.cookie-api.com/api/youtube/delete-video'params = { 'video': 'https://videos.cookie-api.com/youtube/c6f4a7c4-ee92-4c8f-a211-299da29b044c.mp4'}headers = { 'Authorization': 'API_Key'}
response = requests.delete(url, params=params, headers=headers)print(response.json())
const fetch = require('node-fetch');
const url = 'https://api.cookie-api.com/api/youtube/delete-video?video=https%3A%2F%2Fvideos.cookie-api.com%2Fyoutube%2Fc6f4a7c4-ee92-4c8f-a211-299da29b044c.mp4';const headers = { 'Authorization': 'API_Key'};
fetch(url, { method: 'DELETE', headers }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error));
package main
import ( "fmt" "log" "net/http" "io/ioutil")
func main() { url := "https://api.cookie-api.com/api/youtube/delete-video?video=https%3A%2F%2Fvideos.cookie-api.com%2Fyoutube%2Fc6f4a7c4-ee92-4c8f-a211-299da29b044c.mp4" req, err := http.NewRequest("DELETE", url, nil) if err != nil { log.Fatal(err) } req.Header.Set("Authorization", "API_Key")
client := &http.Client{} resp, err := client.Do(req) if err != nil { log.Fatal(err) } defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body) if err != nil { log.Fatal(err) }
fmt.Println(string(body))}
const https = require('https');
const options = { hostname: 'api.cookie-api.com', path: '/api/youtube/delete-video?video=https%3A%2F%2Fvideos.cookie-api.com%2Fyoutube%2Fc6f4a7c4-ee92-4c8f-a211-299da29b044c.mp4', method: 'DELETE', headers: { 'Authorization': 'API_Key' }};
const req = https.request(options, res => { let responseData = '';
res.on('data', chunk => { responseData += chunk; });
res.on('end', () => { console.log(JSON.parse(responseData)); });});
req.on('error', error => { console.error(error);});
req.end();
require 'net/http'require 'json'require 'uri'
url = URI.parse('https://api.cookie-api.com/api/youtube/delete-video?video=https%3A%2F%2Fvideos.cookie-api.com%2Fyoutube%2Fc6f4a7c4-ee92-4c8f-a211-299da29b044c.mp4')request = Net::HTTP::Delete.new(url)request['Authorization'] = 'API_Key'
response = Net::HTTP.start(url.hostname, url.port) { |http| http.request(request) }
puts JSON.parse(response.body)
use reqwest::blocking::Client;use reqwest::header::HeaderMap;use serde_json::Value;
fn main() { let url = "https://api.cookie-api.com/api/youtube/delete-video?video=https%3A%2F%2Fvideos.cookie-api.com%2Fyoutube%2Fc6f4a7c4-ee92-4c8f-a211-299da29b044c.mp4";
let client = Client::new(); let mut headers = HeaderMap::new(); headers.insert("Authorization", "API_Key".parse().unwrap());
let res = client.delete(url) .headers(headers) .send() .unwrap();
let body: Value = res.json().unwrap(); println!("{:?}", body);}
Responses
{ "message": "Video deleted successfully", "success": true}