Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.hyperx.dev/llms.txt

Use this file to discover all available pages before exploring further.

Initialize the HyperX SDK once during startup. After initialization succeeds, user, data, LiveOps, and social APIs are ready to call.

Basic Initialization

await HyperX.Core.Init("PROJECT_CODE");
PROJECT_CODE is the unique code for your Console project. Initialization fails if the code is missing, wrong, or unavailable.
using System;
using UnityEngine;
using HyperX;

public class HyperXBootstrap : MonoBehaviour
{
    async void Start()
    {
        try
        {
            await Core.Init(new HyperXInitOptions
            {
                ProjectCode = "PROJECT_CODE",
                Environment = HyperXEnvironment.Production,
                Timeout = TimeSpan.FromSeconds(10)
            });

            Debug.Log("HyperX ready");
        }
        catch (HyperXInitializationException ex)
        {
            Debug.LogError($"HyperX init failed: {ex.ErrorCode}");
        }
    }
}
Production games should use HyperXEnvironment.Production only.

Initialization Errors

Initialization errors are thrown as HyperXInitializationException.
ErrorCodeMeaningCheck
PROJECT_CODE_REQUIREDThe project code is empty.Build settings or constants.
PROJECT_NOT_FOUNDHyperX could not find the project.The project code copied from Console.
INITIALIZATION_TIMEOUTThe project check timed out.Network state and retry behavior.
INITIALIZATION_REQUEST_FAILEDThe network request failed.Internet access, firewall, platform network permission.
API errors after initialization are handled as HyperXServerException. See Error Handling.

Create a Player Session After Init

For gameplay code that calls authenticated APIs often, prefer the PlayerSession flow.
await HyperX.Core.Init("PROJECT_CODE");

var player = await HyperX.Core.Users.StartGuestSession(
    authenticationToken: SystemInfo.deviceUniqueIdentifier,
    country: "US",
    language: "en"
);

var me = await player.Me();
await player.PutUserPreferenceJson("slot_1", "{\"chapter\":3}");
await player.RefreshIfNeeded();
The existing Core.Users.StartGuest, Core.Users.LoginCustom, and Core.Users.LoginSocial APIs remain supported. PlayerSession removes repeated access-token plumbing and gives you one place to refresh tokens with RefreshIfNeeded.

Request IDs

The SDK sends SDK version, runtime, trace ID, and request ID with requests. Use these values when checking logs or contacting support.
await HyperX.Core.Init(new HyperXInitOptions
{
    ProjectCode = "PROJECT_CODE",
    TraceId = "game-boot",
    RequestId = Guid.NewGuid().ToString("N")
});
If you do not provide them, the SDK generates request IDs automatically.