Reference / API groups
twitch.games
Games and categories: look them up, list the most watched.
Every method of twitch.games, with its parameters, what it returns and the token it needs.
twitch.games.top(params?, options?): Paginator<Game>Lists the categories with the most viewers right now, most watched first.
Token: app or user.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
first | number | Items per page, 1 to 100. Twitch defaults to 20. |
after | string | Cursor of the next page. |
before | string | Cursor of the previous page. |
options: Request options for this call: as, token, signal, timeout, retries.
Returns
Section titled “Returns”Paginator<Game>
Fields of Game
| Name | Type | Description |
|---|---|---|
id | string | ID of the category. |
name | string | Name of the category. |
box_art_url | string | URL of the box art. Replace {width} and {height} with the size you want, in pixels. |
igdb_id | string | ID of the game on IGDB. An empty string when Twitch does not know it. |
Example
Section titled “Example”const top = await twitch.games.top().take(10);twitch.games.get(params, options?): Promise<Game[]>Gets categories by ID, by exact name, by IGDB ID, or any mix of them. Categories that do not exist are left out of the result.
Token: app or user.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
id | string | readonly string[] | IDs of the categories to get. Any number: long lists are split for you. |
name | string | readonly string[] | Exact names of the categories to get. Any number: long lists are split for you. |
igdb_id | string | readonly string[] | IGDB IDs of the games to get. Any number: long lists are split for you. |
options: Request options for this call: as, token, signal, timeout, retries.
Returns
Section titled “Returns”Promise<Game[]>
Fields of Game
| Name | Type | Description |
|---|---|---|
id | string | ID of the category. |
name | string | Name of the category. |
box_art_url | string | URL of the box art. Replace {width} and {height} with the size you want, in pixels. |
igdb_id | string | ID of the game on IGDB. An empty string when Twitch does not know it. |
Example
Section titled “Example”const [game] = await twitch.games.get({ name: "Fortnite" });const games = await twitch.games.get({ id: ["33214", "509658"] });