Skip to main content
The PHP SDK is published to Packagist as teambattles/sdk. It is generated from the OpenAPI spec with Microsoft Kiota and regenerates on every API change.

Install

composer require teambattles/sdk

Authenticated first call

<?php
use TeamBattles\Sdk\TeamBattlesClientFactory;
use TeamBattles\Sdk\Models\MatchesRequestBody;

$client = TeamBattlesClientFactory::create(getenv('TEAMBATTLES_API_KEY'));

// List the authenticated user's matches (requires matches.user_matches: read)
$body = new MatchesRequestBody();
$body->setNumItems(25);
$result = $client->user()->matches()->post($body)->wait();
foreach ($result->getPage() as $match) {
    echo $match->getId() . ' ' . $match->getStatus()->value . PHP_EOL;
}

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.