Skip to content
SteamSets
Esc
↑↓navigate↵open⌘Jpreview
On this page

TypeScript SDK

Call the SteamSets API from TypeScript or JavaScript with typed requests, typed responses, and built-in pagination.

@steamsets/client-ts is the official TypeScript SDK. We generate it from the same OpenAPI spec as this reference, so each endpoint in the API reference has a method with the same name.

Install

npm install @steamsets/client-ts
pnpm add @steamsets/client-ts
yarn add @steamsets/client-ts
bun add @steamsets/client-ts
nub add @steamsets/client-ts
aube add @steamsets/client-ts

Create a client

import { SteamSets } from '@steamsets/client-ts';

const steamsets = new SteamSets({ token: process.env.STEAMSETS_API_KEY });

The endpoint name tells you the method: account.getInfo is steamsets.account.getInfo(), and leaderboard.getAccountLeaderboard is steamsets.leaderboard.getAccountLeaderboard().

Handle errors

The SDK throws a SteamSetsError for each non-2xx response. The error has the HTTP response and the raw problem details body.

import { SteamSetsError } from '@steamsets/client-ts/models/errors';

try {
  await steamsets.account.getInfo({ id: { steamId64: '76561199176433616' } });
} catch (error) {
  if (error instanceof SteamSetsError) {
    console.error(error.httpMeta.response.status, error.httpMeta.body);
  }
  throw error;
}

Other languages

There is no official SDK for other languages yet. The API is plain JSON over HTTPS, so any HTTP client works. Each page in the API reference has cURL and Python samples that you can copy.