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

# Twitch

> Fetch Twitch channel profiles including live status, viewer count, and stream info.

# Twitch

**Base URL:** `https://drain.lat/api/v1/twitch`

<AccordionGroup>
  <Accordion title="GET /profile/:username" icon="circle-play">
    Fetch a Twitch channel profile including live status.

    ```
    GET /api/v1/twitch/profile/:username
    ```

    <ParamField path="username" type="string" required>
      The Twitch channel username.
    </ParamField>

    <CodeGroup>
      ```bash cURL theme={null}
      curl "https://drain.lat/api/v1/twitch/profile/twitch" \
        -H "x-api-key: YOUR_API_KEY"
      ```

      ```javascript JavaScript theme={null}
      const res = await fetch("https://drain.lat/api/v1/twitch/profile/twitch", {
        headers: { "x-api-key": "YOUR_API_KEY" }
      });
      const data = await res.json();
      ```

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

      res = requests.get(
          "https://drain.lat/api/v1/twitch/profile/twitch",
          headers={"x-api-key": "YOUR_API_KEY"}
      )
      print(res.json())
      ```
    </CodeGroup>

    <ResponseField name="id" type="string">Twitch user ID.</ResponseField>
    <ResponseField name="username" type="string">Twitch username.</ResponseField>
    <ResponseField name="displayName" type="string">Display name.</ResponseField>
    <ResponseField name="description" type="string">Channel description.</ResponseField>
    <ResponseField name="avatarUrl" type="string">Avatar image URL.</ResponseField>
    <ResponseField name="offlineBannerUrl" type="string">Offline banner image URL.</ResponseField>
    <ResponseField name="broadcasterType" type="string">Account type: `partner`, `affiliate`, or empty string.</ResponseField>
    <ResponseField name="viewCount" type="number">Total all-time view count.</ResponseField>
    <ResponseField name="created" type="string">Account creation date (ISO 8601).</ResponseField>
    <ResponseField name="isLive" type="boolean">Whether the channel is currently live.</ResponseField>
    <ResponseField name="streamTitle" type="string">Current stream title. Empty string when offline.</ResponseField>
    <ResponseField name="category" type="string">Game or category being streamed. Empty string when offline.</ResponseField>
    <ResponseField name="viewerCount" type="number">Current viewer count. `null` when offline.</ResponseField>
    <ResponseField name="language" type="string">Stream language code.</ResponseField>
    <ResponseField name="tags" type="string[]">Stream tags.</ResponseField>
    <ResponseField name="profileUrl" type="string">Link to the Twitch channel.</ResponseField>

    ```json Response theme={null}
    {
      "id": "12345678",
      "username": "twitch",
      "displayName": "Twitch",
      "description": "Twitch is where thousands of communities come together.",
      "avatarUrl": "https://...",
      "offlineBannerUrl": "https://...",
      "broadcasterType": "partner",
      "viewCount": 420000000,
      "created": "2011-06-22T00:00:00Z",
      "isLive": false,
      "streamTitle": "",
      "category": "",
      "viewerCount": null,
      "language": "en",
      "tags": ["English"],
      "profileUrl": "https://www.twitch.tv/twitch",
      "scrapedAt": "2026-05-08T10:00:00.000Z"
    }
    ```
  </Accordion>

  <Accordion title="GET /profile/:username/clips" icon="scissors">
    Get top clips for a Twitch channel.

    ```
    GET /api/v1/twitch/profile/:username/clips
    ```

    <ParamField path="username" type="string" required>
      The Twitch channel username.
    </ParamField>

    <ParamField query="limit" type="number">
      Number of clips to return. Max `20`. Default `10`.
    </ParamField>

    <CodeGroup>
      ```bash cURL theme={null}
      curl "https://drain.lat/api/v1/twitch/profile/xqc/clips?limit=10" \
        -H "x-api-key: YOUR_API_KEY"
      ```

      ```javascript JavaScript theme={null}
      const res = await fetch("https://drain.lat/api/v1/twitch/profile/xqc/clips?limit=10", {
        headers: { "x-api-key": "YOUR_API_KEY" }
      });
      const data = await res.json();
      ```

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

      res = requests.get(
          "https://drain.lat/api/v1/twitch/profile/xqc/clips",
          params={"limit": 10},
          headers={"x-api-key": "YOUR_API_KEY"}
      )
      print(res.json())
      ```
    </CodeGroup>

    <ResponseField name="username" type="string">Twitch username.</ResponseField>

    <ResponseField name="clips" type="array">
      <Expandable title="clip object">
        <ResponseField name="id" type="string">Clip ID.</ResponseField>
        <ResponseField name="title" type="string">Clip title.</ResponseField>
        <ResponseField name="url" type="string">Link to the clip.</ResponseField>
        <ResponseField name="embedUrl" type="string">Embed URL.</ResponseField>
        <ResponseField name="thumbnailUrl" type="string">Thumbnail image URL.</ResponseField>
        <ResponseField name="viewCount" type="number">View count.</ResponseField>
        <ResponseField name="duration" type="number">Duration in seconds.</ResponseField>
        <ResponseField name="createdAt" type="string">Creation date (ISO 8601).</ResponseField>
        <ResponseField name="creatorName" type="string">Username of who clipped it.</ResponseField>
        <ResponseField name="gameName" type="string">Game or category at time of clip.</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="total" type="number">Number of clips returned.</ResponseField>

    ```json Response theme={null}
    {
      "username": "xqc",
      "clips": [
        {
          "id": "AbcDef123",
          "title": "insane play",
          "url": "https://clips.twitch.tv/AbcDef123",
          "embedUrl": "https://clips.twitch.tv/embed?clip=AbcDef123",
          "thumbnailUrl": "https://...",
          "viewCount": 420000,
          "duration": 30.0,
          "createdAt": "2026-04-01T12:00:00Z",
          "creatorName": "xqc",
          "gameName": "Just Chatting"
        }
      ],
      "total": 10,
      "scrapedAt": "2026-05-08T10:00:00.000Z"
    }
    ```
  </Accordion>

  <Accordion title="GET /profile/:username/videos" icon="film">
    Get past broadcasts and VODs for a Twitch channel.

    ```
    GET /api/v1/twitch/profile/:username/videos
    ```

    <ParamField path="username" type="string" required>
      The Twitch channel username.
    </ParamField>

    <ParamField query="limit" type="number">
      Number of videos to return. Max `20`. Default `10`.
    </ParamField>

    <CodeGroup>
      ```bash cURL theme={null}
      curl "https://drain.lat/api/v1/twitch/profile/xqc/videos?limit=10" \
        -H "x-api-key: YOUR_API_KEY"
      ```

      ```javascript JavaScript theme={null}
      const res = await fetch("https://drain.lat/api/v1/twitch/profile/xqc/videos?limit=10", {
        headers: { "x-api-key": "YOUR_API_KEY" }
      });
      const data = await res.json();
      ```

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

      res = requests.get(
          "https://drain.lat/api/v1/twitch/profile/xqc/videos",
          params={"limit": 10},
          headers={"x-api-key": "YOUR_API_KEY"}
      )
      print(res.json())
      ```
    </CodeGroup>

    <ResponseField name="username" type="string">Twitch username.</ResponseField>

    <ResponseField name="videos" type="array">
      <Expandable title="video object">
        <ResponseField name="id" type="string">Video ID.</ResponseField>
        <ResponseField name="title" type="string">Video title.</ResponseField>
        <ResponseField name="description" type="string">Video description.</ResponseField>
        <ResponseField name="url" type="string">Link to the video.</ResponseField>
        <ResponseField name="thumbnailUrl" type="string">Thumbnail image URL.</ResponseField>
        <ResponseField name="viewCount" type="number">View count.</ResponseField>
        <ResponseField name="duration" type="string">Duration (e.g. `8h30m0s`).</ResponseField>
        <ResponseField name="publishedAt" type="string">Publish date (ISO 8601).</ResponseField>
        <ResponseField name="type" type="string">Video type: `archive`, `highlight`, or `upload`.</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="total" type="number">Number of videos returned.</ResponseField>

    ```json Response theme={null}
    {
      "username": "xqc",
      "videos": [
        {
          "id": "1234567890",
          "title": "!prime | xQcOW",
          "description": "",
          "url": "https://www.twitch.tv/videos/1234567890",
          "thumbnailUrl": "https://...",
          "viewCount": 85000,
          "duration": "8h30m0s",
          "publishedAt": "2026-05-07T18:00:00Z",
          "type": "archive"
        }
      ],
      "total": 10,
      "scrapedAt": "2026-05-08T10:00:00.000Z"
    }
    ```
  </Accordion>
</AccordionGroup>
