> ## 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.

# Medal

> Browse Medal.tv game categories and fetch top or random clips.

# Medal

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

<AccordionGroup>
  <Accordion title="GET /categories" icon="list">
    Get all Medal.tv game categories.

    ```
    GET /api/v1/medal/categories
    ```

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

      ```javascript JavaScript theme={null}
      const res = await fetch("https://drain.lat/api/v1/medal/categories", {
        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/medal/categories",
          headers={"x-api-key": "YOUR_API_KEY"}
      )
      print(res.json())
      ```
    </CodeGroup>

    <ResponseField name="categories" type="array">
      <Expandable title="category object">
        <ResponseField name="id" type="number">Category ID. Use this in `/clips?categoryId=`.</ResponseField>
        <ResponseField name="name" type="string">Game name.</ResponseField>
        <ResponseField name="thumbnail" type="string">Category thumbnail URL.</ResponseField>
        <ResponseField name="followers" type="number">Number of followers.</ResponseField>
        <ResponseField name="isFeatured" type="boolean">Whether the category is featured.</ResponseField>
      </Expandable>
    </ResponseField>

    ```json Response theme={null}
    {
      "categories": [
        { "id": 41, "name": "PUBG", "thumbnail": "https://medal.tv/images/categories/...", "followers": 84200, "isFeatured": true },
        { "id": 1, "name": "Fortnite", "thumbnail": "https://medal.tv/images/categories/...", "followers": 412000, "isFeatured": true }
      ],
      "scrapedAt": "2026-05-05T12:00:00.000Z"
    }
    ```
  </Accordion>

  <Accordion title="GET /clips" icon="film">
    Get top or random clips from Medal.tv.

    ```
    GET /api/v1/medal/clips
    ```

    <ParamField query="categoryId" type="number">
      Filter by game category ID. Get IDs from `/categories`.
    </ParamField>

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

    <ParamField query="random" type="boolean">
      Return random clips instead of top clips. Default `false`.
    </ParamField>

    <CodeGroup>
      ```bash cURL theme={null}
      curl "https://drain.lat/api/v1/medal/clips?categoryId=41&limit=5" \
        -H "x-api-key: YOUR_API_KEY"
      ```

      ```javascript JavaScript theme={null}
      const res = await fetch(
        "https://drain.lat/api/v1/medal/clips?categoryId=41&limit=5",
        { 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/medal/clips",
          params={"categoryId": 41, "limit": 5},
          headers={"x-api-key": "YOUR_API_KEY"}
      )
      print(res.json())
      ```
    </CodeGroup>

    <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="thumbnail" type="string">Thumbnail image URL.</ResponseField>
        <ResponseField name="duration" type="number">Clip duration in seconds.</ResponseField>
        <ResponseField name="likes" type="number">Like count.</ResponseField>
        <ResponseField name="views" type="number">View count.</ResponseField>
        <ResponseField name="categoryId" type="number">Game category ID.</ResponseField>
      </Expandable>
    </ResponseField>

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

    ```json Response theme={null}
    {
      "clips": [
        {
          "id": "cl_abc123",
          "title": "insane 1v4 clutch",
          "url": "https://medal.tv/clips/abc123",
          "thumbnail": "https://cdn.medal.tv/thumbnails/...",
          "duration": 18,
          "likes": 4200,
          "views": 98400,
          "categoryId": 41
        }
      ],
      "total": 5,
      "scrapedAt": "2026-05-05T12:00:00.000Z"
    }
    ```

    <Note>Category ID `41` is PUBG. Use `/categories` to find IDs for other games.</Note>
  </Accordion>
</AccordionGroup>
