Developers Guide

Safe YouTube provides a simple API for developers to create safe YouTubes from their websites, the only mandatory parameter required to do this is the YouTube video ID or "yt_id" ex; http://safeYouTube.net/api/generate?yt_id=u9hauSrihYQ the below list of parameters could be added to fully customize your YouTube video:
Parameter Description Validation Required/Optional
yt_id YouTube ID after the "v" parameter in the YouTube URL.
ex; https://www.YouTube.com/watch?v=tT7FFVdl-kk
The yt_id in this case will be tT7FFVdl-kk
It's a blend of 25 alphanumeric characters that could include a dash or hyphen. Required
title This parameter is to rename the video title. A maximum of 100 characters Optional
enable_sharing Show or hide the sharing buttons 0: Disable
1: Enable
(1 is the default)
Optional
enable_download Show or hide the download button 0: Disable
1: Enable
(1 is the default)
Optional
auto_start Automatically start the video without hitting the play button 0: Disable
1: Enable
(1 is the default)
Optional
start Where the video should start playing An integer value in seconds within the video length Optional
end Where the video should end playing An integer value in seconds within the video length Optional
theme The background theme of the video 1: White theme
2: Gray theme
3: Green theme
4: Light blue theme
(1 is the default)
Optional
You will get a response in JSON format, you should get the below response in the case of making a successful request:

{"code": 100,
"description": "Safe YouTube ID created successfully.",
"data": {
"title": "[The title of the video]",
"duration": "[The total duration of the video]",
"safe_youtube_id": "[The ID of the safe YouTube link]",
"safe_youtube_url":"[The generated safe YouTube URL]"
}
}


If there is an error; you should get the below JSON format:

{"code": [Error number], "description": [Error description]}

The below table shows possible error numbers and descriptions:
Code Description Tips
1 YouTube ID is required. yt_id is the only mandatory parameter and must be supplied.
2 Video title must be less than or equal to 100 characters.  
3 Enable_sharing parameter value must be 1 or 0.  
4 Enable_download parameter value must be 1 or 0.  
5 Auto_start parameter value must be 1 or 0.  
6 Start parameter value must be an integer.  
7 End parameter value must be an integer.  
8 End parameter must be greater than start parameter.  
9 Theme parameter must be 1 or 2 or 3 or 4.  
10 Start parameter must be less than video length.  
11 End parameter must be less than or equal to video length.  
12 Video not found.  
13 The owner of this YouTube video restricted viewing it on other sites.  
14 An unexpected error has occurred.  
100 Safe YouTube URL was created successfully.  

Click here to use our sandbox to make API requests and see the responses.