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

# Twitch Clips API

> Twitch clips with title, URL, channel, views, duration and game. Pass the channels.

`POST /v1/data/twitch/clips/run`

**Pricing:** $0.0025 per clip ($2.50 per 1,000).

## Request

Send the inputs under `params`. Only the keys below are accepted; any other key returns `422 invalid_params`.

**channels** `string[]` *required*

One or more channels. One request reads them all.

**period** `string` (default: week)

Period to use. Last 7 days by default.

Allowed values: `day` (Last 24 hours), `week` (Last 7 days), `month` (Last 30 days), `all` (All time).

**maxResults** `integer` (default: 100)

How many clips to return in total. Defaults to 100; use 0 for all.

## Example

```bash cURL theme={null}
curl -X POST "https://api.mindcase.co/v1/data/twitch/clips/run?wait=true" \
  -H "Authorization: Bearer $MINDCASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "params": {
    "channels": [
      "xqc",
      "shroud",
      "ibai"
    ],
    "period": "all",
    "maxResults": 10
  }
}'
```

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

r = requests.post(
    "https://api.mindcase.co/v1/data/twitch/clips/run",
    params={"wait": "true"},
    headers={"Authorization": f"Bearer {os.environ['MINDCASE_API_KEY']}"},
    json={"params": {
    "channels": [
        "xqc",
        "shroud",
        "ibai"
    ],
    "period": "all",
    "maxResults": 10
}},
)
job = r.json()
rows = job.get("data", [])  # if job["status"] == "running", poll /v1/jobs/{job_id}/results
```

```javascript Node.js theme={null}
const r = await fetch("https://api.mindcase.co/v1/data/twitch/clips/run?wait=true", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MINDCASE_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ params: {
  "channels": [
    "xqc",
    "shroud",
    "ibai"
  ],
  "period": "all",
  "maxResults": 10
} }),
});
const job = await r.json();
const rows = job.data ?? []; // if job.status === "running", poll /v1/jobs/{job_id}/results
```

## Response fields

Each row in `data` is one clip, keyed by these fields.

| Field | Name | Type |
| - | - | - |
| `clipId` | Clip ID | text |
| `title` | Title | text |
| `clipUrl` | Clip URL | url |
| `channel` | Channel | text |
| `views` | Views | number |
| `durationS` | Duration S | number |
| `game` | Game | object |
| `createdDate` | Created Date | date |
| `language` | Language | text |
| `isFeatured` | Is Featured | boolean |
| `thumbnail` | Thumbnail | image |
| `sourceVideo` | Source Video | object |

## Example response

Abridged: long text and lists are shortened.

```json theme={null}
{
  "job_id": "7f3a1c2e-0b9d-4c55-9a51-3f2e8d1b6a40",
  "agent": "twitch/clips",
  "status": "completed",
  "row_count": 1,
  "truncated": false,
  "data": [
    {
      "clipUrl": "https://www.twitch.tv/shroud/clip/TangentialBillowingJalapenoYee-ccA2oB1pEYh4CHWJ",
      "language": "en",
      "createdDate": "2023-06-02T11:41:50Z",
      "sourceVideo": {
        "id": "1835200464",
        "link": "https://www.twitch.tv/videos/1835200464",
        "offset_seconds": 48930
      },
      "views": 563472,
      "game": {
        "id": "515024",
        "name": "Diablo IV",
        "slug": "diablo-iv",
        "link": "https://www.twitch.tv/directory/category/diablo-iv",
        "box_art": "https://static-cdn.jtvnw.net/ttv-boxart/515024-285x380.jpg"
      },
      "channel": "shroud",
      "clipId": "2358589597",
      "title": "F Shroud",
      "thumbnail": "https://static-cdn.jtvnw.net/twitch-video-assets/twitch-vap-video-assets-prod-us-west-2/5696a6a8-e053-4c2e-a54c-5ca62c48102e/landscape/thumb/thumb-0000000000...",
      "isFeatured": false,
      "durationS": 28
    }
  ]
}
```

## Related APIs

For channel profiles use [`twitch/profiles`](https://docs.mindcase.co/apis/twitch/profiles).


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