# Core API flow

## Core communication flow between Supplier and Operator APIs&#x20;

The entire data exchange flow goes through Hub88, because of this it's essential that an integration to either Operator API or Supplier API is built dependent on the use-case.&#x20;

The data flow starts from **player** side, who chooses a **game** on online casino site (brand). This triggers calls from Operator side through Operator API to Hub88, which calls Suppliers through Supplier API, to get the necessary game contents (game\_url).

Once the gameplay has started, **Supplier** **needs** to call **Hub88** and **update** user **balance** based on the results and in-game activities. Hub88 then makes this data available for the Operator, which they are **expected** to **display** to the **user**.  &#x20;

{% hint style="info" %}
If you are building the integration with Hub88 as an **Operator**, you can make the first requests in **DEMO** mode.&#x20;

For **DEMO** mode, when calling the [`POST /operator/generic/v2/game/url`](/developer-docs/operator-api-reference/games-api.md#get-a-game-url)  endpoint, the Operator has to pass `"currency":"XXX"`. Parameters `token`, `user` can be omitted. See more in [Demo Gameplay](/developer-docs/operator-api-reference/operator-api-overview/demo-and-real-gameplay.md).
{% endhint %}

<div data-full-width="true"><figure><img src="/files/cAWo1nEnmFF3zGpoJEF1" alt=""><figcaption><p>Core API flow</p></figcaption></figure></div>

{% hint style="info" %}
&#x20;**Session timing for Supplier Integration**

The player session is created only after [`/game/url`](/developer-docs/supplier-api-reference/games-api.md#get-a-game-url) returns a successful response. The session token passed in the [`/game/url`](/developer-docs/supplier-api-reference/games-api.md#post-game-url) request is **not active** until Hub88 receives a valid game URL back from the Supplier.

This means:

* **Suppliers must not make any Wallet API calls** (`/user/balance`, `/transaction/bet`, `/transaction/win`, `/transaction/rollback`) **before returning a successful** [**`/game/url`**](/developer-docs/supplier-api-reference/games-api.md#post-game-url) **response to Hub88.** Doing so will result in `RS_ERROR_INVALID_TOKEN`.
* Wallet API calls should only be made **after** the game URL has been returned and loaded in the player's browser.

See the [Supplier API Overview — Real gameplay](https://docs.hub88.io/developer-docs/supplier-api-reference/supplier-api-overview#real-gameplay) section for the expected step-by-step flow.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hub88.io/developer-docs/hub88-apis/core-api-flow.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
