# 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`](https://docs.hub88.io/developer-docs/operator-api-reference/games-api#get-a-game-url)  endpoint, the Operator has to pass `"currency":"XXX"`. Parameters `token`, `user` can be omitted. See more in [Demo Gameplay](https://docs.hub88.io/developer-docs/operator-api-reference/operator-api-overview/demo-and-real-gameplay).
{% endhint %}

<div data-full-width="true"><figure><img src="https://1089485291-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FF8iFPgdqAwxIxP5oQMvU%2Fuploads%2FtleE2R5sxIx8j35MnUYg%2F%5BHub88%5D%20Documentation%20working%20board%20(10).jpg?alt=media&#x26;token=ba07288e-46f0-4a33-a660-55fc402618e0" 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`](https://docs.hub88.io/developer-docs/supplier-api-reference/games-api#get-a-game-url) returns a successful response. The session token passed in the [`/game/url`](https://docs.hub88.io/developer-docs/supplier-api-reference/games-api#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`**](https://docs.hub88.io/developer-docs/supplier-api-reference/games-api#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 %}
