### Example Game Settings Object for Create Game Session Source: https://www.challengermode.com/developers/docs/game-integration-api/game-handling An example JSON object representing game settings for a specific game session. This object conforms to the previously defined JSON schema and would be sent when calling the 'create-game-session' event. ```json { "gameMode": 1, "victoryMode": 0 } ``` -------------------------------- ### Example of a Challengermode API ID Source: https://www.challengermode.com/developers/docs/auth-api/using-the-api Illustrates the standard format for IDs used within the Challengermode API, which are 32-digit string GUIDs separated by hyphens. ```text "8e1ae7b7-683a-44c7-290e-08d89c6e5cd2" ``` -------------------------------- ### Example Game Account JSON for Webhook Source: https://www.challengermode.com/developers/docs/game-integration-api/game-account-verification This JSON object represents an example of the GameAccount model that a webhook should return when handling the 'get-game-account' event. It includes essential references and optional display information. ```json { "gameAccountReference": { "accountId": "" }, "displayName": "SpinToWin", "profileImageUrl": "https://gamecdn/path-to-profile-img" } ``` -------------------------------- ### Mutation: startCup Source: https://www.challengermode.com/developers/docs/challengermode-api/reference/mutation Allows you to start a cup directly. Requires BOT or PAT authorization. ```APIDOC ## POST /api/client/mutation/startCup ### Description Allows you to start a cup directly. ### Method POST ### Endpoint /api/client/mutation/startCup ### Parameters #### Request Body - **input** (StartCupInput!) - Input object for starting a cup. ### Response #### Success Response (200) - **StartCupResponse** - Response object indicating the result of starting the cup. ### Response Example ```json { "data": { "startCup": { "message": "Cup started successfully" } } } ``` ``` -------------------------------- ### Example Refresh Key Source: https://www.challengermode.com/developers/docs/auth-api/server-authentication This is an example of a Refresh Key format. Refresh Keys are long-lived credentials used to obtain short-lived Bot Access Tokens. Store this key securely as it's only shown once upon generation. ```Text "NzU0MjkxYzE1ODQ5NDk5YzM0ZjYwOGQ4YTczYjg4OTNZcVBZQ09vYmx4aGJEekxxSFpFUmN0TERaUVB2Tk5sTA==" ``` -------------------------------- ### Report Game Session Results (Go) Source: https://context7.com/context7/challengermode_developers/llms.txt This Go code provides an example of how to construct and send a POST request to the Challengermode API to report game session results. It includes necessary HTTP request setup, JSON marshaling, and error handling for the API response. ```go // Go example for reporting results type GameResult struct { State int `json:"state"` GameTag GameTag `json:"gameTag"` Result Result `json:"result"` DateStarted string `json:"dateStarted"` DateEnded string `json:"dateEnded"` } func (s *GameServer) ReportGameResult(gameSessionId string, result GameResult) error { url := fmt.Sprintf( "https://publicapi.challengermode.com/mk1/v1/game_integrations/%s/game_sessions/%s", s.gameIntegrationId, gameSessionId, ) body, _ := json.Marshal(result) req, _ := http.NewRequest("POST", url, bytes.NewBuffer(body)) req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", s.botAccessToken)) req.Header.Set("Content-Type", "application/json") resp, err := s.httpClient.Do(req) if err != nil { return fmt.Errorf("failed to report result: %w", err) } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { bodyBytes, _ := io.ReadAll(resp.Body) return fmt.Errorf("API error %d: %s", resp.StatusCode, string(bodyBytes)) } log.Printf("Successfully reported game result for session %s", gameSessionId) return nil } ``` -------------------------------- ### JavaScript Example for Joining a Matchmaking Queue Source: https://context7.com/context7/challengermode_developers/llms.txt This JavaScript function demonstrates a complete matchmaking flow. It utilizes a GraphQL client to join a queue, subscribes to queue updates, and accepts a match offer when one is found. It requires a `createGraphQLClient` function and a `subscribeToQueue` function to be defined elsewhere. ```javascript // Complete matchmaking flow async function joinMatchmaking(queueId, userToken) { const client = createGraphQLClient(userToken); // Join queue const joinResult = await client.request(` mutation JoinQueue($queueId: UUID!) { joinMatchmakingQueue(input: { queueId: $queueId }) { success errors { code message } } } `, { queueId }); if (!joinResult.joinMatchmakingQueue.success) { throw new Error('Failed to join queue'); } // Subscribe to queue updates subscribeToQueue(queueId, userToken, async (update) => { const offerings = update.matchmakingQueue.ownParticipation.offerings; if (offerings.length > 0) { const offering = offerings[0]; console.log(`Match found! Accept before: ${offering.expiresAt}`); // Accept match await client.request(` mutation AcceptOffer($offeringId: UUID!) { acceptMatchmakingOffer(input: { offeringId: $offeringId }) { success } } `, { offeringId: offering.id }); } }); } ``` -------------------------------- ### Authenticated API Call Example Source: https://www.challengermode.com/developers/docs/auth-api/server-authentication This example shows how to make an authenticated API call to the Challengermode API using the obtained Bot Access Token. The token is passed in the 'Authorization' header as a Bearer token. Replace `` with your actual token. ```Shell curl -H "Authorization: Bearer " https://publicapi.challengermode.com/mk1/v1/tournaments/8e1ae7b7-683a-44c7-290e-08d89c6e5cd2 ``` -------------------------------- ### Example of a URL Slug for Challengermode Source: https://www.challengermode.com/developers/docs/auth-api/using-the-api Demonstrates the format of slugs, which are human-readable string identifiers used in URLs to identify entities like game titles or spaces. ```text "https://www.challengermode.com/s/fnatic" ``` ```text "https://www.challengermode.com/dota2" ``` -------------------------------- ### Confirm Tournament/Match Participation (GraphQL & Bash) Source: https://context7.com/context7/challengermode_developers/llms.txt These examples show how to confirm a player's readiness for a tournament or match using GraphQL mutations. The first part shows the GraphQL schema for confirmation, and the second part provides a cURL command to execute the tournament confirmation mutation. This is useful for ensuring players are ready before a match starts. ```graphql mutation ConfirmTournamentParticipation($tournamentId: UUID!) { confirmTournamentParticipation(input: { tournamentId: $tournamentId }) { success errors { code message } } } mutation ConfirmMatchParticipation($matchId: UUID!) { confirmMatchParticipation(input: { matchId: $matchId }) { success errors { code message } } } ``` ```bash # Confirm tournament participation curl -X POST https://publicapi.challengermode.com/graphql \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "query": "mutation ConfirmTournamentParticipation($tournamentId: UUID!) { confirmTournamentParticipation(input: { tournamentId: $tournamentId }) { success errors { code message } } }", "variables": { "tournamentId": "8e1ae7b7-683a-44c7-290e-08d89c6e5cd2" } }' ``` -------------------------------- ### Basic Scoring Function Example Source: https://www.challengermode.com/developers/docs/game-integration-api/game-handling A simple example of a default scoring function used to determine match outcomes. This function references the 'score' field within the lineup results to determine the winning team. ```plaintext team.score ``` -------------------------------- ### Challengermode API Rate Limiting Headers Source: https://www.challengermode.com/developers/docs/game-integration-api/using-the-api Shows example response headers related to API rate limiting. These headers help manage request frequency and inform about when to retry requests. ```text Retry-After: 58 ``` ```text X-Rate-Limit-Limit: 1m ``` ```text X-Rate-Limit-Remaining: 50 ``` ```text X-Rate-Limit-Reset: 2023-10-27T10:00:00Z ``` -------------------------------- ### Example Lineup Results for Game Reporting Source: https://www.challengermode.com/developers/docs/game-integration-api/game-handling Illustrates the structure of raw game results for individual lineups. This format is used when reporting game sessions to Challengermode and is validated against a configured JsonSchema. ```json { "lineupResults": [ { "teamNumber": 1, "result": { "score": 1337 } }, { "teamNumber": 2, "result": { "score": 0 } } ] } ``` -------------------------------- ### Example of a Duration Format Source: https://www.challengermode.com/developers/docs/auth-api/using-the-api Presents the format for representing durations within the API, which can include days, hours, minutes, seconds, and fractional seconds. ```text "4:00:00" ``` -------------------------------- ### Real-time Updates with Subscription API Source: https://www.challengermode.com/developers/docs/challengermode-api Retrieve data in real-time using Subscription APIs, providing users with dynamically updated data as soon as it changes. 'tournamentParticipationUpdated' is a recommended subscription to start with. ```APIDOC ## Subscription API - Real-time Updates ### Description Retrieve data in real-time, giving your users the best possible experience by dynamically updating data as soon as it changes. ### Method WebSocket ### Endpoint `/graphql` (via WebSocket) ### Parameters #### Request Body (for subscription initiation) - **query** (string) - Required - The GraphQL subscription string. - **variables** (object) - Optional - Variables for the GraphQL subscription. ### Request Example ```json { "query": "subscription TournamentParticipationUpdated($userId: String!) { tournamentParticipationUpdated(userId: $userId) { tournament { id name } status } }", "variables": { "userId": "user_id_to_monitor" } } ``` ### Response #### Success Response (on update) - **data** (object) - The updated data from the subscription. #### Response Example ```json { "data": { "tournamentParticipationUpdated": { "tournament": { "id": "tournament_id_1", "name": "Live Tournament" }, "status": "CONFIRMED" } } } ``` ``` -------------------------------- ### Example Game Session Payload for Reporting Source: https://www.challengermode.com/developers/docs/game-integration-api/game-handling This JSON object demonstrates the structure of a finished game session payload that can be reported to Challengermode. It includes the session state, a game tag with the session ID, and the results for each team. ```json { "state": 5, // Finished "gameTag": { "GameSessionId": "unique-game-session-id" }, "result": { "lineupResults": [ { "teamNumber": 0, "resultJson": { "Score": 333 } }, { "teamNumber": 1, "resultJson": { "Score": 45 } } ] } } ``` -------------------------------- ### Device Flow Response (JSON) Source: https://www.challengermode.com/developers/docs/auth-api/user-authentication Example JSON response from the device endpoint, containing the device code, expiration time, user code, and verification URIs. ```JSON { "device_code": "NUOHyXgAoK1vdY_IhHzlZNCQlcrB1we0ZsMnw0ITI7Y", "expires_in": 599, "user_code": "1771-1157-4953", "verification_uri": "https://challengermode.com/device", "verification_uri_complete": "https://challengermode.com/device?user_code=1771-1157-4953" } ``` -------------------------------- ### Webhook Payload Example for Creating Game Sessions Source: https://context7.com/context7/challengermode_developers/llms.txt This JSON object represents the structure of the webhook payload received from Challengermode when a game session needs to be created. It contains essential information about the game, participating players, and settings. ```json // Webhook payload from Challengermode (POST to your configured endpoint) { "action": 3, "majorVersion": 1, "data": { "challengermodeGameId": "cm-game-8a3f92b1", "lineups": [ { "teamNumber": 0, "competitors": [ { "accountId": "player-123", "displayName": "PlayerOne" }, { "accountId": "player-456", "displayName": "PlayerTwo" } ] }, { "teamNumber": 1, "competitors": [ { "accountId": "player-789", "displayName": "PlayerThree" }, { "accountId": "player-012", "displayName": "PlayerFour" } ] } ], "gameSettings": { "gameMode": 1, "mapName": "de_dust2", "maxRounds": 16 }, "cmContext": { "challengermodeGameId": "cm-game-8a3f92b1", "tournamentId": "8e1ae7b7-683a-44c7-290e-08d89c6e5cd2", "tournamentName": "Summer Championship 2025", "matchId": "match-5f3a91c2" } } } ``` -------------------------------- ### Embed Tournament Widget (HTML) Source: https://context7.com/context7/challengermode_developers/llms.txt These HTML snippets demonstrate how to embed tournament information or marketplace listings from Challengermode into third-party websites using iframe elements. Examples include responsive embeds and specific card types. ```html
``` -------------------------------- ### Generate Verification Token - cURL Example Source: https://www.challengermode.com/developers/docs/game-integration-api/game-account-verification This cURL command demonstrates how to generate an account linking token (OTT) by calling the generate_verification_token endpoint. It requires a personal access token (PAT) for authorization. ```cURL curl --location --request POST \ 'https://publicapi.challengermode.com/mk1/v1/game_integrations//link_account/generate_verification_token' \ --header 'Authorization: Bearer ' ``` -------------------------------- ### Rate Limiting - Successful Call Headers Source: https://www.challengermode.com/developers/docs/auth-api/using-the-api Examples of rate limiting headers returned on successful API calls, indicating the limit, remaining requests, and when the limit resets. ```http X-Rate-Limit-Limit: the rate limit period (eg. 1m, 12h, 1d) ``` ```http X-Rate-Limit-Remaining: number of request remaining ``` ```http X-Rate-Limit-Reset: UTC date time (ISO-8601) when the limit resets ``` -------------------------------- ### Sample GraphQL Query Source: https://www.challengermode.com/developers/docs/challengermode-api/using-the-api Provides a sample GraphQL query to search for tournaments for a specific game, demonstrating the structure and syntax. ```APIDOC ## Sample GraphQL Query ### Description This is a sample GraphQL query that demonstrates how to search for tournaments associated with a specific game. ### Query ```graphql query SearchTournamentsForGame($gameSlug: String!) { tournamentsForGame(input: { gameSlug: $gameSlug, tournamentFilter: { openTournamentSelector: { } } } ) { state id name attendance { roster { lineups { name } } } } } ``` ### Variables (Example) ```json { "gameSlug": "your-game-slug" } ``` ``` -------------------------------- ### Challengermode API ID Formats (GUID and Slug) Source: https://www.challengermode.com/developers/docs/game-integration-api/using-the-api Demonstrates the formats for resource identifiers used within the Challengermode API. GUIDs are 32-digit strings, while slugs are human-readable strings for URLs. ```text "8e1ae7b7-683a-44c7-290e-08d89c6e5cd2" ``` ```text "https://www.challengermode.com/s/fnatic" ``` ```text "https://www.challengermode.com/dota2" ``` -------------------------------- ### Signup for Tournament (Python) Source: https://context7.com/context7/challengermode_developers/llms.txt This Python script demonstrates how to sign up a user for a tournament using a GraphQL mutation. It sends a POST request to the Challengermode public API with the necessary authentication and mutation details. It then parses the response to indicate success or failure. ```python import requests mutation = """ mutation SignupTournament($tournamentId: UUID!) { signupTournament(input: { tournamentId: $tournamentId }) { tournament { id name } lineup { id name } errors { __typename code message } } } """ response = requests.post( 'https://publicapi.challengermode.com/graphql', headers={ 'Authorization': f'Bearer {user_pat_token}', 'Content-Type': 'application/json' }, json={ 'query': mutation, 'variables': { 'tournamentId': '8e1ae7b7-683a-44c7-290e-08d89c6e5cd2' } } ) result = response.json() if result['data']['signupTournament']['errors']: error = result['data']['signupTournament']['errors'][0] print(f"Signup failed: {error['message']}") else: print(f"Successfully joined: {result['data']['signupTournament']['tournament']['name']}") ``` -------------------------------- ### GraphQL API Reference Source: https://www.challengermode.com/developers/docs/challengermode-api/using-the-api This section details how to interact with the GraphQL API, including its base URL, and the structure of queries, mutations, and subscriptions. It also mentions the availability of a downloadable schema. ```APIDOC ## GraphQL API Reference ### Description Provides information on interacting with the Challengermode Client API using GraphQL. This includes details on the base URL, available operations (Query, Mutation, Subscription), and how to download the schema. ### Base URL The base URL for the GraphQL API is not explicitly provided, but requests are made via HTTP. ### Operations - **Query**: Used to fetch data. - **Mutation**: Used to modify data. - **Subscription**: Used for real-time data updates. ### Schema A GraphQL Schema Definition Language (SDL) file is available for download, providing an overview of the API's structure and data models. ``` -------------------------------- ### Get Game Account Source: https://www.challengermode.com/developers/docs/game-integration-api/reference/definitions Retrieves a game account. ```APIDOC ## POST /api/game/account ### Description Retrieves a game account. ### Method POST ### Endpoint /api/game/account ### Parameters #### Request Body - **action** (ActionId) - Required - The action to perform. - **majorVersion** (integer) - Required - The major version of the game-integration API. - **data** (GetGameAccountPayload) - Required - The payload for retrieving a game account. ### Request Example ```json { "action": 1, "majorVersion": 1, "data": { "gameAccountReference": { "id": "game_account_id_123" } } } ``` ### Response #### Success Response (200) - **action** (ActionId) - The action performed. - **majorVersion** (integer) - The major version of the API. - **data** (GetGameAccountPayload) - The payload containing game account details. #### Response Example ```json { "action": 1, "majorVersion": 1, "data": { "gameAccountReference": { "id": "game_account_id_123" }, "accountId": "some_account_id", "domain": 2 } } ``` ``` -------------------------------- ### OAuth Server Configuration (.well-known) Source: https://www.challengermode.com/developers/docs/auth-api/reference/oauth Provides configuration details for the Challengermode OAuth server. ```APIDOC ## .well-known/openid-configuration ### Description This endpoint provides the full configuration details of the Challengermode OAuth server, including all available endpoints and features. ### Method GET ### Endpoint https://challengermode.com/.well-known/openid-configuration ### Parameters None ### Request Example ```http GET https://challengermode.com/.well-known/openid-configuration HTTP/1.1 Host: challengermode.com ``` ### Response #### Success Response (200 OK) - **issuer** (string) - The issuer identifier of the authorization server. - **authorization_endpoint** (string) - The URL of the authorization endpoint. - **token_endpoint** (string) - The URL of the token endpoint. - **jwks_uri** (string) - The URL of the JSON Web Key Set (JWKS) endpoint. - **userinfo_endpoint** (string) - The URL of the UserInfo endpoint. - **end_session_endpoint** (string) - The URL of the end session endpoint. - **scopes_supported** (array) - A list of supported scopes. - **response_types_supported** (array) - A list of supported response types. - **grant_types_supported** (array) - A list of supported grant types. #### Response Example ```json { "issuer": "https://challengermode.com/oauth", "authorization_endpoint": "https://challengermode.com/oauth/authorize", "token_endpoint": "https://challengermode.com/oauth/token", "jwks_uri": "https://challengermode.com/oauth/jwks", "userinfo_endpoint": "https://api.challengermode.com/v1/me/userinfo", "end_session_endpoint": "https://challengermode.com/oauth/logout", "scopes_supported": [ "openid", "profile", "email", "offline_access" ], "response_types_supported": [ "code", "token", "id_token", "code token", "code id_token", "id_token token", "code id_token token" ], "grant_types_supported": [ "authorization_code", "implicit", "refresh_token", "urn:ietf:params:oauth:grant-type:device_code" ] } ``` ``` -------------------------------- ### Match Series Arguments Source: https://www.challengermode.com/developers/docs/challengermode-api/reference/definitions Details the arguments available for match series, including game settings, tournament context, lineups, results, and more. ```APIDOC ## Match Series Arguments ### Description Arguments for configuring and retrieving match series data. ### Method N/A (Describes arguments for a query/mutation) ### Endpoint N/A (Describes arguments) ### Parameters #### Query Parameters - **includeFailed** (Boolean!) - Indicates whether to include failed matches. - **gameSettings** (GameSpecificSettings) - Specific game settings for the match series. Deprecated, use `gameSessionSettings`. - **gameSessionSettings** (JSON) - Specific game settings for the match series. Deprecated, use `game specific settings`. - **tournament** (Tournament!) - The tournament the match series belongs to. Deprecated, use `context`. - **context** (CompetitionContext!) - The competition context of the match series. - **lineups** ([TournamentLineup]!) - List of lineups in the match series. - **results** (MatchResults!) - The results of the match series. - **title** (String!) - The title of the match series. - **labels** ([TournamentNodeLabel!]!) - Labels associated with the match series. - **streams** ([Stream!]!) - The streams covering this series. - **id** (UUID!) - The unique identifier for the match series. - **ordinal** (Int!) - The ordinal number of the match series in the tournament. - **state** (MatchSeriesState!) - The current state of the match series. - **lineupCount** (Int!) - The number of lineups in each match of the match series. - **startedAt** (DateTime) - The time when the match series started. Null if not started. - **bestOf** (Int!) - The best-of setting for the match series. - **scheduledStartTimeAt** (DateTime) - The scheduled start time of the first match. May be null. ``` -------------------------------- ### Get Game Account API Source: https://www.challengermode.com/developers/docs/game-integration-api/reference/game-accounts Retrieves game account information based on provided identifiers. Supports HMAC authorization. ```APIDOC ## POST /api/game-integration/v1/gameaccount/get ### Description Returns a game account based on the provided payload. Supports HMAC authorization. ### Method POST ### Endpoint /api/game-integration/v1/gameaccount/get ### Parameters #### Request Body - **action** (integer) - Required - Action type. 1 = GetGameAccount. - **majorVersion** (integer) - Required - The major version of the game-integration API. - **data** (object) - Required - Payload containing game account retrieval details. - **accountId** (string) - Optional - The internal account ID to retrieve. - **externalAccountId** (string) - Optional - The external account ID to retrieve. - **domain** (string) - Optional - The domain associated with the external account ID. ### Request Example ```json { "action": 1, "majorVersion": 1, "data": { "accountId": "acc_abc123" } } ``` ### Response #### Success Response (200) - **gameAccountReference** (object) - Uniquely identifies a user's game account. - **displayName** (string) - The in-game name of the user. - **profileUrl** (string) - Optional link to more information about the game account. - **profileImageUrl** (string) - Optional link to an image for the game account profile. - **profileImageData** (string) - Optional base-64 encoded image data for the game account profile. - **platformHints** (array of integers) - Optional list of platforms the user is playing on. - **domainsHints** (array of objects) - Optional list of domains the user is authenticated through. - **zoningData** (object) - Optional game account zoning data. - **ratingData** (object) - A user's in-game rating data. #### Response Example ```json { "gameAccountReference": { "accountId": "acc_abc123" }, "displayName": "GamerTag", "profileUrl": "https://example.com/profile/user123", "profileImageUrl": "https://example.com/image/user123.png", "platformHints": [1, 2], "domainsHints": [{"domain": "example.com", "id": "123"}], "zoningData": {}, "ratingData": {} } ``` ``` -------------------------------- ### C# Webhook Handler for Creating Game Sessions Source: https://context7.com/context7/challengermode_developers/llms.txt This C# code demonstrates how to handle incoming webhooks from Challengermode to create game sessions. It includes verification of the HMAC signature, parsing game settings, creating game server instances, configuring teams, storing session data, and returning a response. ```csharp // C# webhook handler example [HttpPost("webhooks/create-game-session")] public async Task CreateGameSession([FromBody] WebhookPayload payload) { // Verify HMAC signature if (!VerifyHmacSignature(Request.Headers["X-Challengermode-Signature"], payload)) { return Unauthorized(); } var data = payload.Data; // Check for idempotency - don't create duplicate sessions var existingSession = await _gameSessionRepo.FindByCmGameId(data.ChallengermodeGameId); if (existingSession != null) { return Ok(MapToGameSessionResponse(existingSession)); } // Parse game settings var settings = JsonSerializer.Deserialize(data.GameSettings); // Create game server instance var gameServer = await _serverManager.CreateServer( mapName: settings.MapName, gameMode: settings.GameMode, maxRounds: settings.MaxRounds ); // Configure teams foreach (var lineup in data.Lineups) { var team = gameServer.AddTeam(lineup.TeamNumber); foreach (var competitor in lineup.Competitors) { team.AddPlayer(competitor.AccountId, competitor.DisplayName); } } // Store session var session = new GameSession { Id = Guid.NewGuid(), GameSessionId = gameServer.LobbyId, ChallengermodeGameId = data.ChallengermodeGameId, State = GameSessionState.Created, TournamentContext = data.CmContext }; await _gameSessionRepo.Save(session); // Return response return Ok(new GameSessionResponse { State = 2, // Created GameTag = new GameTag { GameSessionId = gameServer.LobbyId, ServerAddress = gameServer.IpAddress, ServerPort = gameServer.Port, Password = gameServer.Password } }); } ``` -------------------------------- ### Subscription to Space Updates Source: https://www.challengermode.com/developers/docs/challengermode-api/reference/subscription Subscribe to get real-time notifications about changes within a specific space. This allows for dynamic updates to space-related information. ```APIDOC ## Subscription: spaceUpdated ### Description Subscribe to updates in a specific space. This data can be used to render relevant information about the space dynamically. ### Method SUBSCRIBE ### Endpoint /subscriptions/spaceUpdated ### Arguments #### Query Parameters - **space** (SpaceIdentifierInput) - Required - Identifier for the Space. - **slug** (String) - Required - Case-insensitive slug for the Space, as shown on challengermode.com/s/{slug} ### Response #### Success Response (200) - **Space** - An object containing the updated space information. ### Response Example { "data": { "spaceUpdated": { "id": "space-id-abc", "name": "Example Space", "slug": "example-space" } } } ``` -------------------------------- ### Confirm Tournament Participation API Source: https://www.challengermode.com/developers/docs/challengermode-api/reference/mutation Allows a user to confirm their participation in a tournament before it starts. Players who do not confirm will not play. Requires PAT authorization. ```APIDOC ## POST /confirmTournamentParticipation ### Description Lets a user confirm their participation in a tournament before the tournament starts. Players that don't confirm their participation will not play in the tournament. ### Method POST ### Endpoint /confirmTournamentParticipation ### Parameters #### Request Body - **input** (ConfirmTournamentParticipationInput!) - Required - Input object for confirming tournament participation. ### Request Example ```json { "input": { "tournamentId": "tournament456", "userId": "user789" } } ``` ### Response #### Success Response (200) - **ConfirmTournamentParticipationResponse** - Description of the response object for confirmed participation. #### Response Example ```json { "confirmed": true, "message": "Participation confirmed." } ``` ``` -------------------------------- ### Identifiers Source: https://www.challengermode.com/developers/docs/auth-api/using-the-api Explanation of ID and Slug formats used in the Challengermode API. ```APIDOC ## Identifiers The following ID formats are used in the ChallengerMode API: ### ID Regular IDs are formatted as 32-digit string guids separated by hyphens: `00000000-0000-0000-0000-000000000000`. Example of an ID: ``` "8e1ae7b7-683a-44c7-290e-08d89c6e5cd2" ``` ### Slug Slugs are formatted as short, human-readable, string identifiers without spaces that are commonly used in URLs: `https://www.challengermode.com/s/{slug}` Example of slugs used in URLs: ``` "https://www.challengermode.com/s/fnatic" // slug identifying the FNATIC Space ``` ``` "https://www.challengermode.com/dota2" // slug identifying the game title Dota 2 ``` ``` -------------------------------- ### Get Tournament by ID Source: https://www.challengermode.com/developers/docs/challengermode-api/reference/query Retrieves a specific tournament using its unique identifier. This endpoint is authorized for BOT and PAT policies and has a cost weight of 10. ```APIDOC ## GET /tournaments/{tournamentId} ### Description Get tournament by ID. ### Method GET ### Endpoint /tournaments/{tournamentId} ### Parameters #### Path Parameters - **tournamentId** (UUID!) - Required - The ID of the tournament to retrieve. ### Response #### Success Response (200) - **tournament** (Tournament) - The requested tournament object. #### Response Example ```json { "tournament": { "id": "uuid-string", "name": "Tournament Name" } } ``` ``` -------------------------------- ### Subscription to Tournaments for a Game Source: https://www.challengermode.com/developers/docs/challengermode-api/reference/subscription Subscribe to get real-time updates for all tournaments associated with a specific game title. This is helpful for monitoring tournaments for a particular game. ```APIDOC ## Subscription: tournamentForGameUpdated ### Description Subscribe to all tournaments in a specific game title. This enables tracking of all active or upcoming tournaments for a given game. ### Method SUBSCRIBE ### Endpoint /subscriptions/tournamentForGameUpdated ### Arguments #### Query Parameters - **gameSlug** (String!) - Required - The slug of the game title. ### Response #### Success Response (200) - **Tournament** - An object containing the updated tournament information. ### Response Example { "data": { "tournamentForGameUpdated": { "id": "tournament-id-123", "name": "Game Title Tournament", "game": { "slug": "example-game" } } } } ``` -------------------------------- ### Account Creation (White-Label) Source: https://www.challengermode.com/developers/docs/auth-api/user-authentication Challengermode supports creating users in the background for white-label integrations using the Assertion Flow, allowing for a seamless user experience without an explicit OAuth consent screen. ```APIDOC ## Account Creation (White-Label) ### Description For white-label integrations, Challengermode supports creating users in the background, eliminating the need for users to go through a typical OAuth consent screen. This enables a user experience where users are unaware of Challengermode powering competitions behind the scenes. The **Assertion Flow**, a non-interactive OAuth flow, allows retrieval of a Personal Access Token (PAT) and performs User Authentication without user interaction. **Note**: This feature is available in specific pricing tiers. Contact developers@challengermode.com for access. ``` -------------------------------- ### Create Game Session Source: https://www.challengermode.com/developers/docs/game-integration-api Endpoint to create individual game sessions, used in automating tournaments, cups, matchmaking, and custom games. ```APIDOC ## POST /game-sessions ### Description Creates a new game session. This endpoint is crucial for automating various competitive formats like tournaments, cups, matchmaking, and custom games by initiating a new game instance on your server. ### Method POST ### Endpoint /game-sessions ### Parameters #### Request Body - **game_account_ids** (array[string]) - Required - List of game account IDs participating in the session. - **competition_id** (string) - Optional - The ID of the competition this session belongs to. - **metadata** (object) - Optional - Additional information about the game session. ``` -------------------------------- ### POST /graphql - Signup for a Tournament Source: https://context7.com/context7/challengermode_developers/llms.txt Allows a player to sign up for a specific tournament using their PAT token. It returns tournament and lineup details upon successful signup, or error information if it fails. ```APIDOC ## POST /graphql - Signup for a Tournament ### Description Allows a player to sign up for a specific tournament using their PAT token. It returns tournament and lineup details upon successful signup, or error information if it fails. ### Method POST ### Endpoint https://publicapi.challengermode.com/graphql ### Parameters #### Request Body - **query** (String) - Required - The GraphQL mutation string for signing up. - **variables** (Object) - Required - An object containing variables for the mutation. - **tournamentId** (UUID) - Required - The ID of the tournament to sign up for. ### Request Example ```json { "query": "mutation SignupTournament($tournamentId: UUID!) { signupTournament(input: { tournamentId: $tournamentId }) { tournament { id name } lineup { id name } errors { __typename code message } } }", "variables": { "tournamentId": "8e1ae7b7-683a-44c7-290e-08d89c6e5cd2" } } ``` ### Response #### Success Response (200) - **data.signupTournament.tournament** (Object) - Information about the joined tournament. - **id** (UUID) - The tournament ID. - **name** (String) - The tournament name. - **data.signupTournament.lineup** (Object) - Information about the created lineup. - **id** (UUID) - The lineup ID. - **name** (String) - The lineup name. #### Error Response (200) - **data.signupTournament.errors** (Array) - A list of errors encountered during signup. - **__typename** (String) - The type of error. - **code** (String) - The error code. - **message** (String) - A human-readable error message. #### Response Example ```json { "data": { "signupTournament": { "tournament": { "id": "8e1ae7b7-683a-44c7-290e-08d89c6e5cd2", "name": "Example Tournament" }, "lineup": { "id": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "name": "Player Lineup" }, "errors": [] } } } ``` ``` -------------------------------- ### User Interaction with Mutation API Source: https://www.challengermode.com/developers/docs/challengermode-api Enable users to perform actions such as joining or confirming participation in a competition using Mutation APIs. The 'signupTournament' mutation is an example. ```APIDOC ## Mutation API - User Interaction ### Description Allows users to perform actions such as joining or confirming their participation in a competition. ### Method POST (for mutations) ### Endpoint `/graphql` ### Parameters #### Request Body - **query** (string) - Required - The GraphQL mutation string. - **variables** (object) - Required - Variables for the GraphQL mutation. ### Request Example ```json { "query": "mutation SignupTournament($tournamentId: String!) { signupTournament(tournamentId: $tournamentId) { success message } }", "variables": { "tournamentId": "tournament_id_to_join" } } ``` ### Response #### Success Response (200) - **data** (object) - The result of the GraphQL mutation. #### Response Example ```json { "data": { "signupTournament": { "success": true, "message": "Successfully signed up for tournament." } } } ``` ``` -------------------------------- ### Get Match Series by ID Source: https://www.challengermode.com/developers/docs/challengermode-api/reference/query Retrieves a match series using its unique identifier. This endpoint is authorized for BOT and PAT policies and has a cost weight of 10. ```APIDOC ## GET /match_series/{matchSeriesId} ### Description Get a match series by ID. ### Method GET ### Endpoint /match_series/{matchSeriesId} ### Parameters #### Path Parameters - **matchSeriesId** (UUID!) - Required - The ID of the match series to retrieve. ### Response #### Success Response (200) - **matchSeries** (MatchSeries!) - The requested match series object. #### Response Example ```json { "matchSeries": { "id": "uuid-string", "name": "Match Series Name" } } ``` ``` -------------------------------- ### Challengermode User Authentication (C#) Source: https://context7.com/context7/challengermode_developers/llms.txt Handles user authentication via the Authorization Code Flow with PKCE, enabling access to personalized data. This C# code demonstrates generating PKCE proof keys, constructing the authorization URL, and exchanging the authorization code for tokens. ```csharp // Step 1: Generate PKCE proof keys on server var code_verifier = EncodeBase64(RandomBytes(32)) .TrimEnd('=') .Replace('+', '-') .Replace('/', '_'); // Result: "daV558BbhbH5GGsK0X8ukxXbBtI-NzpuvBhkmKxMXPw" var code_challenge = EncodeBase64(sha256.ComputeHash(UTF8.GetBytes(code_verifier))) .TrimEnd('=') .Replace('+', '-') .Replace('/', '_'); // Result: "BkUvwmR7GX1I0ag0RQXC2nosjt6EwIkmG8YF4-jhxU8" // Save code_verifier for later token exchange // Step 2: Redirect user to OAuth screen string authorizeUrl = "https://www.challengermode.com/oauth/authorize?" + $"client_id={applicationId}" + bahawa$"redirect_uri={redirectUri}" + "&response_type=code" + bahawa$"&code_challenge={code_challenge}" + "&code_challenge_method=S256" + "&scope=offline_access"; // Step 3: Handle redirect callback (e.g., gameprotocol://cm_oauth_callback?code=ABC123) // Parse authorization code from query parameter // Step 4: Exchange code for tokens on server var request = new HttpRequestMessage(HttpMethod.Post, "https://challengermode.com/oauth/token"); request.Content = new FormUrlEncodedContent(new Dictionary { { "grant_type", "authorization_code" }, { "code_verifier", code_verifier }, { "code", authorizationCode }, { "client_id", applicationId }, { "redirect_uri", redirectUri } }); var response = await httpClient.SendAsync(request); var tokens = await response.Content.ReadAsAsync(); // tokens.access_token, tokens.refresh_token, tokens.expires_in ``` -------------------------------- ### Get Tournament Lineup by ID Source: https://www.challengermode.com/developers/docs/challengermode-api/reference/query Retrieves a tournament lineup using its unique identifier. This endpoint is authorized for BOT and PAT policies and has a cost weight of 10. ```APIDOC ## GET /tournament_lineups/{id} ### Description Get tournament lineup by ID. ### Method GET ### Endpoint /tournament_lineups/{id} ### Parameters #### Path Parameters - **id** (UUID!) - Required - The ID of the tournament lineup to retrieve. ### Response #### Success Response (200) - **tournamentLineup** (TournamentLineup) - The requested tournament lineup object. #### Response Example ```json { "tournamentLineup": { "id": "uuid-string", "name": "Lineup Name" } } ``` ``` -------------------------------- ### Game Handling API Source: https://www.challengermode.com/developers/docs/game-integration-api APIs for managing game sessions, representing a single session or game in your game title, allowing automation of Challengermode's interaction with your game server. ```APIDOC ## Game Handling API ### Description APIs concerning game sessions, which represent a single session or game in your game title. These APIs allow you to automate how Challengermode interacts with your game server to handle individual game sessions. ### Method N/A (Conceptual grouping of endpoints) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ### Related Concepts - Game Sessions - Tournaments - Cups - Matchmaking - Custom Games ```