Skip to main content
This guide walks you through everything you need to make your first API calls with the SW Combine SDK: installing the package, choosing a client mode, calling a public endpoint that needs no credentials, making an authenticated request, and iterating through paginated results.
1

Install the package

Add swcombine-sdk to your project using your preferred package manager:
The SDK requires Node.js 18+ and TypeScript 5.5+ for TypeScript projects. Its only production dependency is axios.
2

Initialize the client

The SWCombine class supports three initialization modes depending on what you need:
If you provide clientId, you must also provide clientSecret — and vice versa. The SDK throws immediately if only one is set.
3

Call a public endpoint

Some endpoints are available without authentication. character.getByHandle is a good first call — it resolves a character handle to a UID and requires no access token:
The returned uid uses the format "type:id" (for example, "1:12345" for a character). You’ll use this UID to fetch full profile details from authenticated endpoints.
character.getByHandle is useful for resolving a known handle to a UID before making authenticated calls that require one.
4

Make an authenticated request

Most endpoints require an access token. Initialize a client with a token and call character.get to retrieve a full character profile:
Authenticated calls will throw a 401 Unauthorized error if your token is missing, expired, or lacks the required OAuth scope. See the authentication guide to get a token.
You can also call client.character.me() to fetch the profile of the character who owns the current access token — no UID needed:
5

Paginate through results

Every list() method returns a Page<T> object with pagination built in. You can check hasMore, call getNextPage() manually, or use for await...of to iterate across all pages automatically:
Auto-pagination with for await...of makes sequential API requests until all items are returned. Keep the rate limit of 600 requests per hour in mind when iterating large datasets.

Next steps

Authentication

Set up OAuth 2.0 and get an access token for authenticated endpoints.

Installation

Full installation details including environment variables and import styles.

Pagination

Learn how Page<T> works, how to control page size, and how auto-pagination behaves.

Error handling

Catch typed SWCError exceptions and handle retryable vs non-retryable failures.