YouTube Video Details API (V1)
API health status
Healthy Available Limited Mostly unavailable No data
Loading health status...
Retrieve public details for a YouTube video identified by video ID. Use it to inspect a known video before further content or comment analysis.
Parameters
| Name | In | Type | Required | Default | Description |
|---|---|---|---|---|---|
token | query | string | Yes | - | Access token for this API service. |
videoId | query | string | Yes | - | The unique identifier for a YouTube video. |
lang | query | string | No | - | Optional IETF language tag for localized video details, such as en-US. Leave empty to use the default language. |
Code Samples
bash
curl --max-time 120 -X GET 'https://api.justoneapi.com/api/youtube/get-video-detail/v1?token=YOUR_API_KEY&videoId=VALUE'text
I want to use the "Video Details (V1)" API from JustOneAPI.
Base URL: https://api.justoneapi.com.
API Path: /api/youtube/get-video-detail/v1?token=YOUR_API_KEY&videoId=VALUE
API Endpoint: BASE_URL + /api/youtube/get-video-detail/v1?token=YOUR_API_KEY&videoId=VALUE
HTTP Method: GET
Authentication: Append the "token" query parameter to the URL.
OpenAPI Definition: https://docs.justoneapi.com/openapi/youtube/video-details-v1-en.json
Parameters:
- token (query): Access token for this API service. (Required)
- videoId (query): The unique identifier for a YouTube video. (Required)
- lang (query): Optional IETF language tag for localized video details, such as en-US. Leave empty to use the default language.
Return format: safely handle JSON or text according to the actual Content-Type.
Response Handling & Error Codes:
1. Business results should be determined by the "code" field in the response body (code 0 means success).
2. Timeout Recommendation: Set the request timeout to 120 seconds. If 120 seconds is too long for your use case, use at least 60 seconds, but a small number of requests may time out before receiving a result.
3. Business Code Reference:
- 0: Success
- 100: Invalid or Inactive Token
- 301: Collection Failed. Please Retry.
- 302: Rate Limit Exceeded
- 303: Daily Quota Exceeded
- 400: Invalid Parameters
- 500: Internal Server Error
- 600: Permission Denied
- 601: Insufficient Balance
- 602: Token Budget Exceeded
4. Code 601 means the shared account balance is insufficient. Code 602 means the current API token's own cumulative budget limit has been reached. Token budget limits do not transfer funds out of the shared account balance.
Please help me write a script in my preferred programming language to call this API and handle the response.python
import requests
BASE_URL = "https://api.justoneapi.com" # Provided by OpenAPI servers
url = BASE_URL + "/api/youtube/get-video-detail/v1?token=YOUR_API_KEY&videoId=VALUE"
response = requests.get(url, timeout=120)
print(response.status_code)
if response.content:
content_type = response.headers.get("content-type", "").lower()
if "json" in content_type:
try:
print(response.json())
except ValueError:
print(response.text)
elif content_type.startswith("text/") or "xml" in content_type or content_type.split(";", 1)[0].strip() in {"application/javascript", "application/x-www-form-urlencoded", "application/graphql"}:
print(response.text)
else:
with open("response.bin", "wb") as output:
output.write(response.content)
print(f"Saved {len(response.content)} bytes to response.bin")js
const BASE_URL = "https://api.justoneapi.com"; // Provided by OpenAPI servers
const url = BASE_URL + "/api/youtube/get-video-detail/v1?token=YOUR_API_KEY&videoId=VALUE";
const response = await fetch(url, {
method: "GET",
signal: AbortSignal.timeout(120000)
});
console.log(response.status);
const responseBytes = await response.arrayBuffer();
if (responseBytes.byteLength) {
const contentType = (response.headers.get("content-type") || "").toLowerCase();
const mediaType = contentType.split(";", 1)[0].trim();
const textual = contentType.startsWith("text/") || contentType.includes("json") || contentType.includes("xml") || ["application/javascript", "application/x-www-form-urlencoded", "application/graphql"].includes(mediaType);
if (textual) {
const responseText = new TextDecoder().decode(responseBytes);
let data = responseText;
if (contentType.includes("json")) {
try { data = JSON.parse(responseText); } catch { /* Keep the raw body. */ }
}
console.log(data);
} else {
console.log(`Received ${responseBytes.byteLength} binary bytes`);
}
}java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
public class Main {
public static void main(String[] args) throws Exception {
final String BASE_URL = "https://api.justoneapi.com"; // Provided by OpenAPI servers
final String url = BASE_URL + "/api/youtube/get-video-detail/v1?token=YOUR_API_KEY&videoId=VALUE";
HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(120)).build();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create(url))
.timeout(Duration.ofSeconds(120))
.method("GET", HttpRequest.BodyPublishers.noBody());
HttpRequest request = builder.build();
HttpResponse<byte[]> response = client.send(request, HttpResponse.BodyHandlers.ofByteArray());
System.out.println(response.statusCode());
String contentType = response.headers().firstValue("content-type").orElse("").toLowerCase();
String mediaType = contentType.split(";", 2)[0].trim();
if (contentType.startsWith("text/") || contentType.contains("json") || contentType.contains("xml") || mediaType.equals("application/javascript") || mediaType.equals("application/x-www-form-urlencoded") || mediaType.equals("application/graphql")) {
System.out.println(new String(response.body(), StandardCharsets.UTF_8));
} else {
Files.write(Path.of("response.bin"), response.body());
System.out.println("Saved " + response.body().length + " bytes to response.bin");
}
}
}go
package main
import (
"fmt"
"io"
"os"
"strings"
"net/http"
"time"
)
const BASE_URL = "https://api.justoneapi.com" // Provided by OpenAPI servers
func main() {
client := &http.Client{Timeout: 120 * time.Second}
url := BASE_URL + "/api/youtube/get-video-detail/v1?token=YOUR_API_KEY&videoId=VALUE"
req, _ := http.NewRequest("GET", url, nil)
resp, _ := client.Do(req)
defer resp.Body.Close()
fmt.Println(resp.StatusCode)
bodyBytes, _ := io.ReadAll(resp.Body)
contentType := strings.ToLower(resp.Header.Get("Content-Type"))
mediaType := strings.TrimSpace(strings.SplitN(contentType, ";", 2)[0])
if strings.HasPrefix(contentType, "text/") || strings.Contains(contentType, "json") || strings.Contains(contentType, "xml") || mediaType == "application/javascript" || mediaType == "application/x-www-form-urlencoded" || mediaType == "application/graphql" {
fmt.Println(string(bodyBytes))
} else {
os.WriteFile("response.bin", bodyBytes, 0600)
fmt.Printf("Saved %d bytes to response.bin\n", len(bodyBytes))
}
}php
<?php
$BASE_URL = 'https://api.justoneapi.com'; // Provided by OpenAPI servers
$url = $BASE_URL . '/api/youtube/get-video-detail/v1?token=YOUR_API_KEY&videoId=VALUE';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
$contentType = strtolower((string) curl_getinfo($ch, CURLINFO_CONTENT_TYPE));
curl_close($ch);
echo $status . PHP_EOL;
$mediaType = trim(explode(';', $contentType, 2)[0]);
if (str_starts_with($contentType, 'text/') || str_contains($contentType, 'json') || str_contains($contentType, 'xml') || in_array($mediaType, ['application/javascript', 'application/x-www-form-urlencoded', 'application/graphql'], true)) {
echo $response;
} else {
file_put_contents('response.bin', $response);
echo 'Saved ' . strlen($response) . ' bytes to response.bin' . PHP_EOL;
}Response Fields
Key fields in a successful response (code = 0).
Video details13 fields
data
Public details for the requested YouTube video.
| Field | Type | Description |
|---|---|---|
errorId | string | Status returned in the video detail payload. It is Success for successful details. |
type | string | Content type reported for the video. |
id | string | YouTube video identifier. |
title | string | Video title. |
description | string | Video description text. |
lengthSeconds | integer | Video duration in seconds. |
publishedTime | string | Video publication date and time as text with a UTC offset. |
publishedTimeText | string | Video publication time as display text. |
thumbnails | array | Video thumbnail image options. |
thumbnails[] | object | One thumbnail image option. |
thumbnails[].url | string | URL of the image. |
thumbnails[].width | integer | Image width in pixels. |
thumbnails[].height | integer | Image height in pixels. |
Channel13 fields
data
| Field | Type | Description |
|---|---|---|
channel | object | YouTube channel that published the video. |
channel.type | string | Reported type of the channel entry. |
channel.id | string | YouTube channel identifier. |
channel.name | string | Channel display name. |
channel.handle | string | Public handle of the YouTube channel. |
channel.isVerified | boolean | Whether the channel is marked as verified. |
channel.isVerifiedArtist | boolean | Whether the channel is marked as a verified artist. |
channel.subscriberCountText | string | Channel subscriber count as display text. |
channel.avatar | array | Channel avatar image options. |
channel.avatar[] | object | One channel avatar image option. |
channel.avatar[].url | string | URL of the image. |
channel.avatar[].width | integer | Image width in pixels. |
channel.avatar[].height | integer | Image height in pixels. |
Engagement and availability8 fields
data
| Field | Type | Description |
|---|---|---|
viewCount | integer | Reported video view count. |
likeCount | integer | Reported video like count. |
isLiveStream | boolean | Whether the video is identified as a live stream. Use isLiveNow to check current live status. |
isLiveNow | boolean | Whether the video is currently live. |
isRegionRestricted | boolean | Whether a regional availability restriction is reported for the video. |
isUnlisted | boolean | Whether the video is marked as unlisted. |
isCommentDisabled | boolean | Whether comments are disabled for this video. |
commentCountText | string | Video comment count as display text. |
Music credits9 fields
data
| Field | Type | Description |
|---|---|---|
musicCredits | array | Music attribution entries attached to the video. |
musicCredits[] | object | One music attribution entry. |
musicCredits[].title | string | Title of the credited music track. |
musicCredits[].artist | string | Artist displayed in the music credit. |
musicCredits[].album | string | Album displayed in the music credit. |
musicCredits[].description | string | Description text associated with the music credit. |
musicCredits[].thumbnails | array | Thumbnail images for this music credit. |
musicCredits[].thumbnails[] | object | One thumbnail image option. |
musicCredits[].thumbnails[].url | string | URL of the image. |
Video formats17 fields
data
| Field | Type | Description |
|---|---|---|
videos | object | Video format bundle for this video. |
videos.errorId | string | Status reported for this media bundle. |
videos.reason | string | Reason the media formats or tracks were unavailable, when provided. |
videos.expiration | integer | Unix timestamp in seconds when the URLs in this bundle expire. |
videos.items | array | Available video formats. |
videos.items[] | object | One available video format. |
videos.items[].url | string | URL for this video format. The URL can expire. |
videos.items[].lengthMs | integer | Duration of this format in milliseconds. |
videos.items[].mimeType | string | Media MIME type for this format. |
videos.items[].extension | string | File extension for this format. |
videos.items[].lastModified | integer | Reported last modification timestamp for this media format. |
videos.items[].size | integer | Reported size of this format in bytes. |
videos.items[].sizeText | string | File size of this format as display text. |
videos.items[].hasAudio | boolean | Whether the video format includes an audio track. |
videos.items[].quality | string | Reported video quality label. |
videos.items[].width | integer | Video frame width in pixels. |
videos.items[].height | integer | Video frame height in pixels. |
Audio formats14 fields
data
| Field | Type | Description |
|---|---|---|
audios | object | Audio format bundle for this video. |
audios.errorId | string | Status reported for this media bundle. |
audios.reason | string | Reason the media formats or tracks were unavailable, when provided. |
audios.expiration | integer | Unix timestamp in seconds when the URLs in this bundle expire. |
audios.items | array | Available audio formats. |
audios.items[] | object | One available audio format. |
audios.items[].url | string | URL for this audio format. The URL can expire. |
audios.items[].lengthMs | integer | Duration of this format in milliseconds. |
audios.items[].mimeType | string | Media MIME type for this format. |
audios.items[].extension | string | File extension for this format. |
audios.items[].lastModified | integer | Reported last modification timestamp for this media format. |
audios.items[].size | integer | Reported size of this format in bytes. |
audios.items[].sizeText | string | File size of this format as display text. |
audios.items[].isDrc | boolean | Whether dynamic range compression is indicated for this audio format. |
Subtitle tracks8 fields
data
| Field | Type | Description |
|---|---|---|
subtitles | object | Subtitle track bundle for this video. |
subtitles.errorId | string | Status reported for this media bundle. |
subtitles.reason | string | Reason the media formats or tracks were unavailable, when provided. |
subtitles.expiration | integer | Unix timestamp in seconds when the URLs in this bundle expire. |
subtitles.items | array | Available subtitle tracks. |
subtitles.items[] | object | One available subtitle track. |
subtitles.items[].url | string | URL for this subtitle track. The URL can expire. |
subtitles.items[].code | string | Language or track code reported for the subtitle. |
Related videos43 fields
data
| Field | Type | Description |
|---|---|---|
related | object | Related video results included with the details. |
related.nextToken | string | Opaque continuation value reported for the related video results. |
related.items | array | Related video entries returned with the details. |
related.items[] | object | One related video entry. |
related.items[].type | string | Content type reported for the related video. |
related.items[].id | string | YouTube video identifier. |
related.items[].title | string | Title of the related video. |
related.items[].channel | object | YouTube channel that published the related video. |
related.items[].channel.type | string | Reported type of the channel entry. |
related.items[].channel.id | string | YouTube channel identifier. |
related.items[].channel.name | string | Channel display name. |
related.items[].channel.handle | string | Public handle of the YouTube channel. |
related.items[].channel.isVerified | boolean | Whether the channel is marked as verified. |
related.items[].channel.isVerifiedArtist | boolean | Whether the channel is marked as a verified artist. |
related.items[].channel.avatar | array | Channel avatar image options. |
related.items[].channel.avatar[] | object | One channel avatar image option. |
related.items[].channel.avatar[].url | string | URL of the image. |
related.items[].channel.avatar[].width | integer | Image width in pixels. |
related.items[].channel.avatar[].height | integer | Image height in pixels. |
related.items[].isLiveNow | boolean | Whether the related video is currently live. |
related.items[].lengthText | string | Related video duration as display text. |
related.items[].viewCountText | string | Related video view count as display text. |
related.items[].publishedTimeText | string | Related video publication time as display text. |
related.items[].thumbnails | array | Related video thumbnail image options. |
related.items[].thumbnails[] | object | One thumbnail image option. |
related.items[].thumbnails[].url | string | URL of the image. |
related.items[].thumbnails[].width | integer | Image width in pixels. |
related.items[].thumbnails[].height | integer | Image height in pixels. |
related.items[].thumbnails[].moving | boolean | Whether the thumbnail is an animated preview. |
related.items[].collaborators | array | Collaborating channels listed for the related video. |
related.items[].collaborators[] | object | A collaborating YouTube channel listed for the related video. |
related.items[].collaborators[].type | string | Reported type of the channel entry. |
related.items[].collaborators[].id | string | YouTube channel identifier. |
related.items[].collaborators[].name | string | Channel display name. |
related.items[].collaborators[].handle | string | Public handle of the YouTube channel. |
related.items[].collaborators[].isVerified | boolean | Whether the channel is marked as verified. |
related.items[].collaborators[].isVerifiedArtist | boolean | Whether the channel is marked as a verified artist. |
related.items[].collaborators[].subscriberCountText | string | Channel subscriber count as display text. |
related.items[].collaborators[].avatar | array | Channel avatar image options. |
related.items[].collaborators[].avatar[] | object | One channel avatar image option. |
related.items[].collaborators[].avatar[].url | string | URL of the image. |
related.items[].collaborators[].avatar[].width | integer | Image width in pixels. |
related.items[].collaborators[].avatar[].height | integer | Image height in pixels. |
Response Example
Loading the response example...