---
url: >-
  https://game-engine-io.github.io/enginex-frontend-sdk/reference/api/@getenginex/sdk-igaming/query/functions/createIgamingQueries.md
---
[Reference](../../../../index.md) / [@getenginex/sdk-igaming/query](../index.md) / createIgamingQueries

# createIgamingQueries()

> **createIgamingQueries**(`igaming`): [`IgamingQueries`](../interfaces/IgamingQueries.md)

Creates the iGaming query factories: one per read method, with the same name and the same input
as the method (`q.casino.listGames({ page })`). Each call returns `{ queryKey, queryFn }`, compatible
with TanStack Query v5's `useQuery`/`prefetchQuery`/`fetchQuery`. It makes no request.

* Reads without a session (`casino.listGames/listCategories/listProviders/getGame`,
  `bonus.listPublicOffers`): key `['enginex', 'public', namespace, method, input?]`.
* Player reads (the others): key `['enginex', 'user', userId, namespace, method, input?]`,
  with the session's `userId` when the factory is called; without a session, `'anonymous'` and the `queryFn`
  rejects with `UNAUTHENTICATED` without a request (the same if the session switches user before the `fetch`).
* `queryFn` forwards the context's `signal`: canceling the query aborts the `fetch`.
* None carries `staleTime`.

## Parameters

### igaming

[`IgamingClient`](../../interfaces/IgamingClient.md)

The object returned by `createIgaming(enginex)` (the object itself, not a copy).

## Returns

[`IgamingQueries`](../interfaces/IgamingQueries.md)

## Example

```ts
import { useQuery } from '@tanstack/react-query'
import { createIgamingQueries } from '@getenginex/sdk-igaming/query'

const q = createIgamingQueries(igaming)
const games = useQuery(q.casino.listGames({ category: 'slots' }))
```

## Throws

`CONFIGURATION_ERROR` if `igaming` did not come from `createIgaming` (e.g. a
`{ ...igaming }` copy). Identify with `isEnginexError(error, 'CONFIGURATION_ERROR')`.
