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

# Steam

> Fetch Steam community profiles and game libraries using vanity URLs.

# Steam

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

<AccordionGroup>
  <Accordion title="GET /profile/:vanityUrl" icon="user">
    Fetch a Steam community profile using the vanity URL - the custom part of their profile URL (e.g. `steamcommunity.com/id/gaben` → vanity is `gaben`).

    ```
    GET /api/v1/steam/profile/:vanityUrl
    ```

    <ParamField path="vanityUrl" type="string" required>
      The Steam vanity URL (not the Steam64 ID).
    </ParamField>

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

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

    <ResponseField name="steamId" type="string">Steam64 ID.</ResponseField>
    <ResponseField name="username" type="string">Steam vanity URL username.</ResponseField>
    <ResponseField name="displayName" type="string">Display name.</ResponseField>
    <ResponseField name="realName" type="string">Real name if set publicly.</ResponseField>
    <ResponseField name="summary" type="string">Profile summary/bio.</ResponseField>
    <ResponseField name="avatarUrl" type="string">Avatar image URL.</ResponseField>
    <ResponseField name="level" type="number">Steam level.</ResponseField>
    <ResponseField name="status" type="string">Online status (e.g. `Online`, `Offline`).</ResponseField>
    <ResponseField name="currentGame" type="string">Game currently being played. `null` if not in a game.</ResponseField>
    <ResponseField name="currentGameId" type="number">App ID of the current game. `null` if not playing.</ResponseField>
    <ResponseField name="location" type="string">Location if set publicly.</ResponseField>
    <ResponseField name="created" type="string">Account creation date (ISO 8601).</ResponseField>
    <ResponseField name="isPrivate" type="boolean">Whether the profile is private.</ResponseField>

    <ResponseField name="bans" type="object">
      <Expandable title="bans object">
        <ResponseField name="vacBanned" type="boolean">Whether the account has a VAC ban.</ResponseField>
        <ResponseField name="numberOfVacBans" type="number">Number of VAC bans.</ResponseField>
        <ResponseField name="numberOfGameBans" type="number">Number of game bans.</ResponseField>
        <ResponseField name="daysSinceLastBan" type="number">Days since the last ban.</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="badges" type="array">List of badge names.</ResponseField>

    <ResponseField name="recentGames" type="array">
      <Expandable title="recent game object">
        <ResponseField name="name" type="string">Game name.</ResponseField>
        <ResponseField name="hoursPlayed" type="string">Hours played (formatted).</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="profileUrl" type="string">Link to the Steam profile.</ResponseField>

    ```json Response theme={null}
    {
      "steamId": "76561197960287930",
      "username": "gaben",
      "displayName": "Gabe Newell",
      "realName": "",
      "summary": "Valve co-founder",
      "avatarUrl": "https://avatars.steamstatic.com/...",
      "level": 98,
      "status": "Online",
      "currentGame": null,
      "currentGameId": null,
      "location": "Seattle, WA",
      "created": "2003-08-23T00:00:00.000Z",
      "isPrivate": false,
      "bans": {
        "vacBanned": false,
        "numberOfVacBans": 0,
        "numberOfGameBans": 0,
        "daysSinceLastBan": 0
      },
      "badges": ["Pillar of Community", "Years of Service"],
      "recentGames": [
        { "name": "Counter-Strike 2", "hoursPlayed": "1,234 hrs on record" }
      ],
      "profileUrl": "https://steamcommunity.com/id/gaben",
      "scrapedAt": "2026-05-05T12:00:00.000Z"
    }
    ```

    <Note>Private profiles return `"isPrivate": true` with limited data.</Note>
  </Accordion>

  <Accordion title="GET /profile/:vanityUrl/games" icon="gamepad">
    Get a user's Steam game library.

    ```
    GET /api/v1/steam/profile/:vanityUrl/games
    ```

    <ParamField path="vanityUrl" type="string" required>
      The Steam vanity URL.
    </ParamField>

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

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

    <ResponseField name="games" type="array">
      <Expandable title="game object">
        <ResponseField name="name" type="string">Game name.</ResponseField>
        <ResponseField name="hoursPlayed" type="string">Hours played (formatted).</ResponseField>
        <ResponseField name="logoUrl" type="string">Game logo image URL.</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="total" type="number">Total games returned.</ResponseField>

    ```json Response theme={null}
    {
      "games": [
        {
          "name": "Counter-Strike 2",
          "hoursPlayed": "1,234 hrs on record",
          "logoUrl": "https://cdn.cloudflare.steamstatic.com/..."
        },
        {
          "name": "Dota 2",
          "hoursPlayed": "892 hrs on record",
          "logoUrl": "https://cdn.cloudflare.steamstatic.com/..."
        }
      ],
      "total": 20,
      "scrapedAt": "2026-05-05T12:00:00.000Z"
    }
    ```

    <Note>Returns up to 20 games. Private game libraries return `{ "error": "Games list is private" }`.</Note>
  </Accordion>

  <Accordion title="GET /profile/:vanityUrl/recent" icon="clock">
    Get the last 10 recently played games for a Steam user.

    ```
    GET /api/v1/steam/profile/:vanityUrl/recent
    ```

    <ParamField path="vanityUrl" type="string" required>
      The Steam vanity URL.
    </ParamField>

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

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

    <ResponseField name="steamId" type="string">Steam64 ID.</ResponseField>
    <ResponseField name="vanityUrl" type="string">Steam vanity URL.</ResponseField>

    <ResponseField name="games" type="array">
      <Expandable title="game object">
        <ResponseField name="appId" type="number">Steam app ID.</ResponseField>
        <ResponseField name="name" type="string">Game name.</ResponseField>
        <ResponseField name="playtime2Weeks" type="number">Minutes played in the last 2 weeks.</ResponseField>
        <ResponseField name="playtimeForever" type="number">Total minutes played.</ResponseField>
        <ResponseField name="iconUrl" type="string">Game icon URL.</ResponseField>
        <ResponseField name="storeUrl" type="string">Link to the Steam store page.</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="total" type="number">Number of recently played games returned.</ResponseField>

    ```json Response theme={null}
    {
      "steamId": "76561197960287930",
      "vanityUrl": "gaben",
      "games": [
        {
          "appId": 730,
          "name": "Counter-Strike 2",
          "playtime2Weeks": 120,
          "playtimeForever": 8400,
          "iconUrl": "https://media.steampowered.com/...",
          "storeUrl": "https://store.steampowered.com/app/730"
        }
      ],
      "total": 5,
      "scrapedAt": "2026-05-08T10:00:00.000Z"
    }
    ```
  </Accordion>

  <Accordion title="GET /profile/:vanityUrl/friends" icon="users">
    Get a user's Steam friend list with summaries.

    ```
    GET /api/v1/steam/profile/:vanityUrl/friends
    ```

    <ParamField path="vanityUrl" type="string" required>
      The Steam vanity URL.
    </ParamField>

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

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

    <ResponseField name="steamId" type="string">Steam64 ID.</ResponseField>
    <ResponseField name="vanityUrl" type="string">Steam vanity URL.</ResponseField>

    <ResponseField name="friends" type="array">
      <Expandable title="friend object">
        <ResponseField name="steamId" type="string">Friend's Steam64 ID.</ResponseField>
        <ResponseField name="username" type="string">Friend's username.</ResponseField>
        <ResponseField name="avatarUrl" type="string">Friend's avatar URL.</ResponseField>
        <ResponseField name="profileUrl" type="string">Link to friend's Steam profile.</ResponseField>
        <ResponseField name="friendSince" type="string">Date the friendship was made (ISO 8601).</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="total" type="number">Total number of friends.</ResponseField>

    ```json Response theme={null}
    {
      "steamId": "76561197960287930",
      "vanityUrl": "gaben",
      "friends": [
        {
          "steamId": "76561198000000000",
          "username": "friend123",
          "avatarUrl": "https://...",
          "profileUrl": "https://steamcommunity.com/profiles/76561198000000000",
          "friendSince": "2015-03-01T00:00:00.000Z"
        }
      ],
      "total": 42,
      "scrapedAt": "2026-05-08T10:00:00.000Z"
    }
    ```

    <Note>Returns an error if the friend list is set to private.</Note>
  </Accordion>
</AccordionGroup>
