> ## Documentation Index
> Fetch the complete documentation index at: https://creatorinsights.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# YouTube

Default YouTube tool for niche-based popular/viral inspiration, matching the dashboard API source operation. Pass a concise natural search phrase of roughly two to five meaningful words that describes the subject or proven content angle. Preserve exact product, company and creator names; do not put ranking, geography or creative-review instructions inside query. Use type=shorts for Shorts or type=videos for regular videos, uploadDate for recency, sortBy=popular for popularity and region separately. Do not use fetch\_youtube\_trending\_shorts for a niche-specific request.

Searches YouTube by keyword query and returns matching videos, channels, playlists, shorts, shelves, and live streams. Each video result includes title, URL, thumbnail, view count (views), publish date, duration, channel info, and badges. Supports filtering by upload date, sorting by relevance or popularity, and paginating with continuationToken. Search with the exact creator, product, topic or short content phrase. Keep important entity names intact. Put supported date, sorting and region choices in their separate arguments, not natural-language instructions inside query. Evaluate engagement, production quality and audience fit from returned data; those criteria are not guaranteed search filters. See the Search Locations & Credits guide for query examples. Scraper responses preserve their public source field names by default (trim omitted or true) while removing only noisy, heavy, or unsafe fields. Set trim=false for the full sanitized source response.

Intelligence uses plan credits; niche searches start at 2, other ordinary fetches at 1, and applicable options can cost more.

> [!NOTE]
>
> region is optional. Explicit country codes are normalized to two uppercase letters. When omitted, no country override is sent; Creator Insights does not choose a fixed country. A request location does not restrict results to creators or posts from that country. Keep the same query, region and other filters when paginating. See [Search locations & credits](https://creatorinsights.mintlify.site/search-locations-and-credits.md).

> [!NOTE]
>
> Examples use illustrative values. The playground sends a real request. Intelligence can consume plan credits. Publishing examples save drafts.

## Endpoint

**GET** `https://api.creatorinsights.in/v1/youtube/search`

**Content type:** Query parameters; no JSON request body.

**Authentication:** `x-api-key: YOUR_SAVED_API_KEY`

**MCP tool:** `search_youtube`. See [MCP Setup](https://creatorinsights.mintlify.site/mcp-setup.md) for AI clients.

## Request parameters

**x-workspace-id** `string`

Active workspace ID or current name in your organization. Optional header alternative to passing workspace in the query.

**query** `string` *required*

Search query. For stricter title matching, use YouTube's intitle: operator, for example intitle:"Foursquare Swarm". Quoted queries by themselves may still be broadened by YouTube when no fresh exact matches are available.

**uploadDate** `string`

Upload date Allowed values: `today`, `this_week`, `this_month`, `this_year`.

**sortBy** `string`

Sort by Allowed values: `relevance`, `popular`.

**type** `string`

Type of content to search for Allowed values: `videos`, `shorts`, `channels`, `playlists`.

**duration** `string`

Duration of the video. Only applies to videos (not shorts). Allowed values: `under_3_min`, `between_3_and_20_min`, `over_20_min`.

**region** `string`

Optional two-letter proxy country code, such as US, GB or FR. This selects the request location, not the country where creators or posts originate. When omitted, no country override is sent; Creator Insights does not select a fixed country. Availability and results depend on the platform.

**continuationToken** `string`

Continuation token to get more videos. Get 'continuationToken' from previous response.

**includeExtras** `string`

This will get you the like + comment count and the description. To get the full details of the video, use the fetch\_youtube\_video\_info endpoint. *This will slow down the response slightly.*

**workspace** `string`

Workspace ID or current name in the authenticated organization. Required for paid requests when the organization has more than one active workspace. The selected workspace receives this request charge.

**trim** `boolean` (default: true)

Defaults to true: preserve public source field names, metrics, and public media URLs while removing only noisy, heavy, or unsafe fields. Set false for the full sanitized source response; credentials, transport headers/context, internal credit data, and upstream-provider identity are always removed.

## Request example

Send these arguments as URL query parameters.

```json theme={null}
{
  "query": "solar panels",
  "region": "GB",
  "uploadDate": "this_month",
  "sortBy": "popular",
  "workspace": "YOUR_WORKSPACE_ID_OR_CURRENT_NAME"
}
```

```bash cURL theme={null}
curl --get 'https://api.creatorinsights.in/v1/youtube/search' \
  -H "x-api-key: $CREATOR_INSIGHTS_API_KEY" \
  --data-urlencode 'query=solar panels' \
  --data-urlencode 'region=GB' \
  --data-urlencode 'uploadDate=this_month' \
  --data-urlencode 'sortBy=popular' \
  --data-urlencode 'workspace=YOUR_WORKSPACE_ID_OR_CURRENT_NAME'
```

```javascript Node.js theme={null}
const parameters = {
  "query": "solar panels",
  "region": "GB",
  "uploadDate": "this_month",
  "sortBy": "popular",
  "workspace": "YOUR_WORKSPACE_ID_OR_CURRENT_NAME"
};
const url = new URL('https://api.creatorinsights.in/v1/youtube/search');
for (const [name, value] of Object.entries(parameters)) url.searchParams.set(name, String(value));
const response = await fetch(url, { headers: { 'x-api-key': process.env.CREATOR_INSIGHTS_API_KEY } });
const raw = await response.text();
let result;
try { result = JSON.parse(raw); } catch { throw new Error('Non-JSON response: ' + response.status); }
if (!response.ok || result.success === false) throw new Error(result.message || result.error || 'Request failed');
console.log(result.data);
```

```python Python theme={null}
import json, os, requests

arguments = json.loads("{\"query\":\"solar panels\",\"region\":\"GB\",\"uploadDate\":\"this_month\",\"sortBy\":\"popular\",\"workspace\":\"YOUR_WORKSPACE_ID_OR_CURRENT_NAME\"}")
response = requests.get("https://api.creatorinsights.in/v1/youtube/search",
    headers={"x-api-key": os.environ["CREATOR_INSIGHTS_API_KEY"]},
    params=arguments, timeout=120)
response.raise_for_status()
result = response.json()
print(result["data"])
```

## Response example

HTTP 200. Illustrative values; optional fields can be omitted, null, or empty. Additional platform fields may be returned.

```json Success theme={null}
{
  "success": true,
  "data": {
    "success": true,
    "videos": [
      {
        "type": "example",
        "id": "example_id",
        "url": "https://example.com/sample",
        "title": "Example creator content",
        "thumbnail": "https://media.example.com/sample.jpg",
        "channel": {
          "id": "example_id",
          "title": "Example creator content",
          "handle": "examplecreator",
          "thumbnail": "https://media.example.com/sample.jpg"
        },
        "view_count_text": "Example creator content",
        "view_count_int": 120,
        "published_time_text": "Example creator content",
        "published_time": "example",
        "length_text": "Example creator content",
        "length_seconds": 1,
        "badges": []
      }
    ],
    "channels": [],
    "playlists": [],
    "shorts": [
      {
        "type": "example",
        "id": "example_id",
        "url": "https://example.com/sample",
        "title": "Example creator content",
        "thumbnail": "https://media.example.com/sample.jpg",
        "channel": {
          "id": "example_id",
          "title": "Example creator content",
          "handle": "examplecreator",
          "thumbnail": "https://media.example.com/sample.jpg"
        },
        "view_count_text": "Example creator content",
        "view_count_int": 120,
        "published_time_text": "Example creator content",
        "published_time": "example",
        "length_text": "Example creator content",
        "length_seconds": 1,
        "badges": []
      }
    ],
    "shelves": [
      {
        "type": "example",
        "title": "Example creator content",
        "items": [
          {
            "type": "example",
            "id": "example_id",
            "url": "https://example.com/sample",
            "title": "Example creator content",
            "thumbnail": "https://media.example.com/sample.jpg",
            "view_count_text": "Example creator content",
            "view_count_int": 120
          }
        ]
      }
    ],
    "lives": [],
    "continuation_token": "EXAMPLE_CURSOR"
  },
  "credits_charged": 2
}
```

## Response fields

**success** `boolean` *required*

Whether this operation succeeded. Also check HTTP status and nested platform statuses.

**data** `object` *required*

Operation-specific payload. See the nested field table and response example below.

**credits\_charged** `number`

Creator Insights plan credits for this call; the example is illustrative.

| Field | Type | Description |
| - | - | - |
| `success` | boolean | Example response field. Availability depends on the record and selected options. |
| `data` | object | Public source field names are preserved by default when trim is omitted or true; only noisy, heavy, or unsafe fields are removed. Set trim=false for the full sanitized source response. Fields vary with source availability; unavailable metrics are null. |
| `data.success` | boolean | Example response field. Availability depends on the record and selected options. |
| `data.videos` | array | List of returned entries; may be empty. |
| `data.videos[].type` | string | Example response field. Availability depends on the record and selected options. |
| `data.videos[].id` | string | Example response field. Availability depends on the record and selected options. |
| `data.videos[].url` | string | Example response field. Availability depends on the record and selected options. |
| `data.videos[].title` | string | Example response field. Availability depends on the record and selected options. |
| `data.videos[].thumbnail` | string | Example response field. Availability depends on the record and selected options. |
| `data.videos[].channel` | object | Nested object. Expand the response schema for its fields. |
| `data.videos[].channel.id` | string | Example response field. Availability depends on the record and selected options. |
| `data.videos[].channel.title` | string | Example response field. Availability depends on the record and selected options. |
| `data.videos[].channel.handle` | string | Example response field. Availability depends on the record and selected options. |
| `data.videos[].channel.thumbnail` | string | Example response field. Availability depends on the record and selected options. |
| `data.videos[].view_count_text` | string | Example response field. Availability depends on the record and selected options. |
| `data.videos[].view_count_int` | integer | Example response field. Availability depends on the record and selected options. |
| `data.videos[].published_time_text` | string | Example response field. Availability depends on the record and selected options. |
| `data.videos[].published_time` | string | Example response field. Availability depends on the record and selected options. |
| `data.videos[].length_text` | string | Example response field. Availability depends on the record and selected options. |
| `data.videos[].length_seconds` | integer | Example response field. Availability depends on the record and selected options. |
| `data.videos[].badges` | array | List of returned entries; may be empty. |
| `data.channels` | array | List of returned entries; may be empty. |
| `data.playlists` | array | List of returned entries; may be empty. |
| `data.shorts` | array | List of returned entries; may be empty. |
| `data.shorts[].type` | string | Example response field. Availability depends on the record and selected options. |
| `data.shorts[].id` | string | Example response field. Availability depends on the record and selected options. |
| `data.shorts[].url` | string | Example response field. Availability depends on the record and selected options. |
| `data.shorts[].title` | string | Example response field. Availability depends on the record and selected options. |
| `data.shorts[].thumbnail` | string | Example response field. Availability depends on the record and selected options. |
| `data.shorts[].channel` | object | Nested object. Expand the response schema for its fields. |
| `data.shorts[].channel.id` | string | Example response field. Availability depends on the record and selected options. |
| `data.shorts[].channel.title` | string | Example response field. Availability depends on the record and selected options. |
| `data.shorts[].channel.handle` | string | Example response field. Availability depends on the record and selected options. |
| `data.shorts[].channel.thumbnail` | string | Example response field. Availability depends on the record and selected options. |
| `data.shorts[].view_count_text` | string | Example response field. Availability depends on the record and selected options. |
| `data.shorts[].view_count_int` | integer | Example response field. Availability depends on the record and selected options. |
| `data.shorts[].published_time_text` | string | Example response field. Availability depends on the record and selected options. |
| `data.shorts[].published_time` | string | Example response field. Availability depends on the record and selected options. |
| `data.shorts[].length_text` | string | Example response field. Availability depends on the record and selected options. |
| `data.shorts[].length_seconds` | integer | Example response field. Availability depends on the record and selected options. |
| `data.shorts[].badges` | array | List of returned entries; may be empty. |
| `data.shelves` | array | List of returned entries; may be empty. |
| `data.shelves[].type` | string | Example response field. Availability depends on the record and selected options. |
| `data.shelves[].title` | string | Example response field. Availability depends on the record and selected options. |
| `data.shelves[].items` | array | List of returned entries; may be empty. |
| `data.shelves[].items[].type` | string | Example response field. Availability depends on the record and selected options. |
| `data.shelves[].items[].id` | string | Example response field. Availability depends on the record and selected options. |
| `data.shelves[].items[].url` | string | Example response field. Availability depends on the record and selected options. |
| `data.shelves[].items[].title` | string | Example response field. Availability depends on the record and selected options. |
| `data.shelves[].items[].thumbnail` | string | Example response field. Availability depends on the record and selected options. |
| `data.shelves[].items[].view_count_text` | string | Example response field. Availability depends on the record and selected options. |
| `data.shelves[].items[].view_count_int` | integer | Example response field. Availability depends on the record and selected options. |
| `data.lives` | array | List of returned entries; may be empty. |
| `data.continuation_token` | string | Example response field. Availability depends on the record and selected options. |
| `credits_charged` | number | Example response field. Availability depends on the record and selected options. |

The interactive schema includes deeper nested fields. Sample fields are descriptive, not a promise that every record includes them.

## n8n and JSON tool endpoint

**POST** `https://api.creatorinsights.in/api/v1/tools/search_youtube`. Use Header Auth with `x-api-key` and body content type JSON. This alias returns the n8n envelope below; included operations can report zero credits\_deducted.

```bash theme={null}
curl -X POST 'https://api.creatorinsights.in/api/v1/tools/search_youtube' \
  -H "x-api-key: $CREATOR_INSIGHTS_API_KEY" \
  -H 'Content-Type: application/json' \
  --data '{"query":"solar panels","region":"GB","uploadDate":"this_month","sortBy":"popular","workspace":"YOUR_WORKSPACE_ID_OR_CURRENT_NAME"}'
```

```json theme={null}
{
  "status": true,
  "tool": "search_youtube",
  "credits_deducted": 2,
  "data": {
    "success": true,
    "videos": [
      {
        "type": "example",
        "id": "example_id",
        "url": "https://example.com/sample",
        "title": "Example creator content",
        "thumbnail": "https://media.example.com/sample.jpg",
        "channel": {
          "id": "example_id",
          "title": "Example creator content",
          "handle": "examplecreator",
          "thumbnail": "https://media.example.com/sample.jpg"
        },
        "view_count_text": "Example creator content",
        "view_count_int": 120,
        "published_time_text": "Example creator content",
        "published_time": "example",
        "length_text": "Example creator content",
        "length_seconds": 1,
        "badges": []
      }
    ],
    "channels": [],
    "playlists": [],
    "shorts": [
      {
        "type": "example",
        "id": "example_id",
        "url": "https://example.com/sample",
        "title": "Example creator content",
        "thumbnail": "https://media.example.com/sample.jpg",
        "channel": {
          "id": "example_id",
          "title": "Example creator content",
          "handle": "examplecreator",
          "thumbnail": "https://media.example.com/sample.jpg"
        },
        "view_count_text": "Example creator content",
        "view_count_int": 120,
        "published_time_text": "Example creator content",
        "published_time": "example",
        "length_text": "Example creator content",
        "length_seconds": 1,
        "badges": []
      }
    ],
    "shelves": [
      {
        "type": "example",
        "title": "Example creator content",
        "items": [
          {
            "type": "example",
            "id": "example_id",
            "url": "https://example.com/sample",
            "title": "Example creator content",
            "thumbnail": "https://media.example.com/sample.jpg",
            "view_count_text": "Example creator content",
            "view_count_int": 120
          }
        ]
      }
    ],
    "lives": [],
    "continuation_token": "EXAMPLE_CURSOR"
  }
}
```

## Errors

Handle non-2xx responses before mapping data. Error codes vary with the cause; these are representative examples. A 429 response may be plain text. Never treat a queued post as published or blindly retry a partial publication.

```json theme={null}
{
  "success": false,
  "error": "UNAUTHORIZED",
  "message": "Missing or invalid API key"
}
```

| HTTP status | Meaning |
| - | - |
| 400 | Invalid arguments |
| 401 | Missing or invalid API key |
| 402 | Insufficient Creator Insights plan credits |
| 403 | Subscription or permission required |
| 404 | Resource not found |
| 409 | Conflicting request, idempotency key, or unfinished upload |
| 410 | Managed media expired; upload the file again |
| 413 | Media too large |
| 415 | Unsupported media type |
| 422 | Account selection, connection, or platform payload needs attention |
| 500 | Authentication or server error |
| 503 | Service temporarily unavailable or operation failed; inspect saved status before retrying |
| 429 | Rate limit; inspect response headers and retry later. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.