# FlashData YouTube Trainability API

Check a YouTube video's license metadata for a Creative Commons label and retrieve the result as JSON.

Canonical reference: https://flashdata.dev/docs/sources/youtube_trainability
Reviewed: 2026-10-23

Endpoint: POST https://data.flashdata.dev/v1/queries/realtime
Authentication: X-API-Key: YOUR_API_KEY
Modes: [Realtime](https://flashdata.dev/docs/reference/realtime-and-async/reference.md#realtime) · [Async](https://flashdata.dev/docs/reference/realtime-and-async/reference.md#async) · [Batch](https://flashdata.dev/docs/reference/batch-and-bulk/reference.md#batch) · [Bulk](https://flashdata.dev/docs/reference/bulk-processing/reference.md)

Required source permission: youtube_trainability

Replace YOUR_API_KEY with an API key that has this source permission and available credits. Run requests on your server or agent host.

[Set up authentication](https://flashdata.dev/docs/guides/headers-and-authentication/reference.md)

[Interpret license labels](https://flashdata.dev/docs/guides/youtube-data-guide/reference.md#license)

<a id="quickstart"></a>

## Send a request

### Python

```bash
python3 -m pip install requests
```

```python
import json

import requests

api_key = "YOUR_API_KEY"
payload = {
    "source": "youtube_trainability",
    "video_id": "dQw4w9WgXcQ",
}

response = requests.post(
    "https://data.flashdata.dev/v1/queries/realtime",
    headers={"X-API-Key": api_key},
    json=payload,
    timeout=120,
)
response.raise_for_status()
print(json.dumps(response.json(), ensure_ascii=False, indent=2))
```

### Bash / cURL

```bash
api_key="YOUR_API_KEY"
curl --fail-with-body --max-time 120 --request POST "https://data.flashdata.dev/v1/queries/realtime" \
  --header "Content-Type: application/json" \
  --header "X-API-Key: $api_key" \
  --data-binary @- <<'FLASHDATA_JSON'
{
  "source": "youtube_trainability",
  "video_id": "dQw4w9WgXcQ"
}
FLASHDATA_JSON
```

<a id="parameters"></a>

## Parameters

<a id="parameters-group-0"></a>

### Request body

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <a id="parameter-source"></a> source | string | Yes | — | Set to youtube_trainability.  |
| <a id="parameter-video_id"></a> video_id | string | Yes | Not set | The 11-character YouTube video ID, such as FUfGcZ092b0. Accepts letters, numbers, underscores and hyphens. Min length: 11. Max length: 11. Pattern: ^[A-Za-z0-9_-]{11}$ |
| <a id="parameter-callback_url"></a> callback_url | string · nullable | No | Not set | Async and batch only. Public HTTPS completion URL on port 443, up to 2,048 characters. No user credentials or URL fragment. Omit, use null or an empty string for no notification. In a batch, set this on each query, outside params.  |

<a id="response"></a>

## Read the result

Save the successful JSON response as response.json. Save this as read-response.py and run python read-response.py. It uses only Python's standard library and makes no new request.

### read-response.py

```python
import json
from pathlib import Path

response = json.loads(Path("response.json").read_text(encoding="utf-8-sig"))
if response.get("status") not in ("done", "completed") or not isinstance(response.get("results"), list):
    raise SystemExit("Expected completed result JSON; inspect the response or job status.")
if not response["results"]:
    print("[]")
    raise SystemExit(0)
result = response["results"][0]

output = {"videoId": result.get("videoId"), "permitted": result.get("permitted", [])}
# Keep the label values; this is not a training-rights authorization.
print(json.dumps(output, ensure_ascii=False, indent=2))
```

## Sample response

Recorded example; fields and counts depend on the source and requested input.
```json
{
  "source": "youtube_trainability",
  "status": "done",
  "results": [
    {
      "videoId": "dQw4w9WgXcQ",
      "kind": "youtube#videoTrainability",
      "etag": "dQw4w9WgXcQ",
      "permitted": [
        "none"
      ]
    }
  ],
  "usage": {
    "credits": 0.01
  },
  "created_at": "2026-09-16T07:45:48.691Z"
}
```

## Response fields

| Field | Type | Description |
| --- | --- | --- |
| source | string | The requested API source. |
| status | string | done when the realtime request succeeds. |
| created_at | string | Response creation time in ISO 8601 format. |
| usage.credits | number | Credits charged for the request, based on your plan. |
| results[0].videoId | string | The requested video ID. |
| results[0].kind | string | FlashData result type: youtube#videoTrainability. |
| results[0].etag | string | Video ID echoed as the response tag. |
| results[0].permitted | array<string> | ["all"] when a Creative Commons label is detected; otherwise ["none"], including when license metadata is missing. These values do not report the creator's YouTube third-party training settings. |

- This endpoint reads video license metadata. It does not retrieve YouTube third-party training permissions, and neither value grants permission to train on the video.

## Response formats

Responses use JSON by default. Choose another format with these optional headers.

- Accept: application/json (default) or text/plain. Plain text presents the same fields in a readable, indented layout.
- X-Respond-With: markdown. Leave unset for original fields. Markdown works with either response format.

Markdown is available for realtime queries and completed results.

The fields below describe the default JSON response.

[Request and response format examples](https://flashdata.dev/docs/guides/response-formats/reference.md#headers)

<a id="job-lifecycle"></a>

<a id="async-batch"></a>

## API basics

The request builder and examples above use this source's parameters. Use the Python and cURL examples below for shared submission, status and result steps. A Batch body is a JSON object containing queries; each item returns its own job ID.

- [Async request and receipt](https://flashdata.dev/docs/reference/realtime-and-async/reference.md#async)

<a id="job-status"></a>

- [Check job status](https://flashdata.dev/docs/reference/realtime-and-async/reference.md#status)

<a id="job-results"></a>

- [Retrieve completed results](https://flashdata.dev/docs/reference/realtime-and-async/reference.md#results)
- [Batch JSON requests](https://flashdata.dev/docs/reference/batch-and-bulk/reference.md#batch)
- [Bulk processing API](https://flashdata.dev/docs/reference/bulk-processing/reference.md)
- [Build a Bulk workflow for this source](https://flashdata.dev/docs/reference/bulk-processing/reference.md?source=youtube_trainability#playground)
- [Customer OpenAPI](https://flashdata.dev/docs/openapi.json)

<a id="webhooks"></a>

<a id="callbacks"></a>

## Completion notifications

- [Receive and verify completion webhooks](https://flashdata.dev/docs/guides/async-batch/reference.md#webhooks)

<a id="troubleshooting"></a>

## Troubleshooting

- [Errors and status codes](https://flashdata.dev/docs/errors/reference.md#status-codes)
- [When to retry](https://flashdata.dev/docs/errors/reference.md#retries)

## Related APIs

- [YouTube Video Metadata API](https://flashdata.dev/docs/sources/youtube_metadata/reference.md)
- [YouTube Download API](https://flashdata.dev/docs/sources/youtube_download/reference.md)
