Skip to main content
The TypeScript SDK is published to npm as @teambattles/sdk. It is generated from the OpenAPI spec with Microsoft Kiota and regenerates on every API change.
TypeScript is a preview SDK - its Kiota runtime dependencies are still pre-release. See SDKs overview for maturity details.

Install

npm install @teambattles/sdk

Authenticated first call

import { createTeamBattlesClient } from "@teambattles/sdk";

const client = createTeamBattlesClient(process.env.TEAMBATTLES_API_KEY!);

// List the authenticated user's matches (requires matches.user_matches: read)
const result = await client.user.matches.post({ numItems: 25 });
for (const match of result?.page ?? []) {
	console.log(match.id, match.status);
}

Authentication

The factory wires an Authorization: Bearer tb_<your-key> header on every request. Create keys at Settings > Developer and review scopes in the authentication guide. Treat the error machine code in error responses - not the details message - as the stable programmatic contract.