> For the complete documentation index, see [llms.txt](https://developers.oxylabs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.oxylabs.io/products/web-scraper-api/targets/video-and-social-media/youtube/video-trainability.md).

# Video Trainability

Retrieve AI training permission status for a YouTube video by video ID, including whether training is permitted for all parties, specific parties, or none.

The `youtube_video_trainability` source is designed to retrieve information about whether a particular YouTube video **is eligible for AI training purposes**. This service enables verification of training permissions for YouTube content.

## Request samples

The following examples demonstrate how to check AI training permissions for a specific YouTube video.

{% tabs %}
{% tab title="cURL" %}

```bash
curl 'https://realtime.oxylabs.io/v1/queries' \
--user 'USERNAME:PASSWORD' \
-H 'Content-Type: application/json' \
-d '{
"source": "youtube_video_trainability",
"video_id": "rFNDylrjn_w"
}'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://realtime.oxylabs.io/v1/queries"
payload = {
    "source": "youtube_video_trainability",
    "video_id": "rFNDylrjn_w"
}
headers = {
    "Content-Type": "application/json"
}
auth = ("USERNAME", "PASSWORD")

response = requests.post(url, json=payload, headers=headers, auth=auth)
print(response.text)
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const fetch = require('node-fetch');

const url = 'https://realtime.oxylabs.io/v1/queries';
const payload = {
    source: 'youtube_video_trainability',
    video_id: 'rFNDylrjn_w'
};

const options = {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Basic ' + Buffer.from('USERNAME:PASSWORD').toString('base64')
    },
    body: JSON.stringify(payload)
};

fetch(url, options)
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));
```

{% endtab %}

{% tab title="HTTP" %}

```http
POST /v1/queries HTTP/1.1
Host: realtime.oxylabs.io
Authorization: Basic [BASE64_ENCODED_CREDENTIALS]
Content-Type: application/json

{
    "source": "youtube_video_trainability",
    "video_id": "rFNDylrjn_w"
}
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$url = 'https://realtime.oxylabs.io/v1/queries';
$payload = [
    'source' => 'youtube_video_trainability',
    'video_id' => 'rFNDylrjn_w'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_USERPWD, 'USERNAME:PASSWORD');

$response = curl_exec($ch);
curl_close($ch);

echo $response;
?>
```

{% endtab %}

{% tab title="Golang" %}

```go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io/ioutil"
    "net/http"
)

func main() {
    url := "https://realtime.oxylabs.io/v1/queries"
    payload := map[string]string{
        "source": "youtube_video_trainability",
        "video_id":  "rFNDylrjn_w",
    }
    
    jsonPayload, _ := json.Marshal(payload)
    
    req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonPayload))
    req.Header.Set("Content-Type", "application/json")
    req.SetBasicAuth("USERNAME", "PASSWORD")
    
    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()
    
    body, _ := ioutil.ReadAll(resp.Body)
    fmt.Println(string(body))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        using (var client = new HttpClient())
        {
            var url = "https://realtime.oxylabs.io/v1/queries";
            var payload = @"{
                ""source"": ""youtube_video_trainability"",
                ""video_id"": ""rFNDylrjn_w""
            }";
            
            var content = new StringContent(payload, Encoding.UTF8, "application/json");
            var byteArray = Encoding.ASCII.GetBytes("USERNAME:PASSWORD");
            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
                "Basic", Convert.ToBase64String(byteArray));
            
            var response = await client.PostAsync(url, content);
            var responseContent = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseContent);
        }
    }
}
```

{% endtab %}

{% tab title="Java" %}

```java
import java.io.IOException;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Base64;

public class OxylabsRequest {
    public static void main(String[] args) throws IOException, InterruptedException {
        String url = "https://realtime.oxylabs.io/v1/queries";
        String payload = "{\"source\":\"youtube_video_trainability\",\"video_id\":\"rFNDylrjn_w\"}";
        
        String auth = "USERNAME:PASSWORD";
        String encodedAuth = Base64.getEncoder().encodeToString(auth.getBytes());
        
        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create(url))
                .header("Content-Type", "application/json")
                .header("Authorization", "Basic " + encodedAuth)
                .POST(HttpRequest.BodyPublishers.ofString(payload))
                .build();
        
        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
```

{% endtab %}

{% tab title="JSON" %}

```json
{
    "source": "youtube_video_trainability",
    "video_id": "rFNDylrjn_w"
}
```

{% endtab %}
{% endtabs %}

We use synchronous [**Realtime**](/products/web-scraper-api/integration-methods/realtime.md) integration method in our examples. If you would like to use [**Push-Pull**](/products/web-scraper-api/integration-methods/push-pull.md) integration, refer to the [**integration methods**](/products/web-scraper-api/integration-methods.md) section.

## Request parameter values

<table><thead><tr><th>Parameter</th><th width="225.04296875">Description</th><th>Default value</th></tr></thead><tbody><tr><td><mark style="background-color:green;"><strong><code>source</code></strong></mark></td><td>Sets the scraper.</td><td><code>youtube_video_trainability</code></td></tr><tr><td><mark style="background-color:green;"><strong><code>video_id</code></strong></mark></td><td>YouTube video ID.</td><td>-</td></tr><tr><td><code>callback_url</code></td><td>URL to your callback endpoint. <a href="/products/web-scraper-api/integration-methods/push-pull.md"><strong>More info</strong></a></td><td>-</td></tr></tbody></table>

&#x20;   \- mandatory parameter

## Response format

The result's `content` holds YouTube's response as a JSON string with the following fields:

```json
{
  "videoId": "<YOUTUBE_VIDEO_ID>",
  "kind": "youtube#videoTrainability",
  "etag": "<ETAG_VALUE>",
  "permitted": ["<PERMISSION_LEVEL>"]
}
```

The `permitted` field indicates the level of training permission available for the video, with these possible values:

| Value                       | Description                                         |
| --------------------------- | --------------------------------------------------- |
| `["all"]`                   | Training permitted for all parties                  |
| `["None"]`                  | No training permitted for any party                 |
| `["party1", "party2", ...]` | Training permitted only for specific listed parties |

The `etag` value serves as a version identifier for the training status.

### Example response

```json
{
  "videoId": "rFNDylrjn_w",
  "kind": "youtube#videoTrainability",
  "etag": "oXToFpOwrHWvoiN1YbOa0tkzOn0",
  "permitted": ["None"]
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.oxylabs.io/products/web-scraper-api/targets/video-and-social-media/youtube/video-trainability.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
