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

# createEnginexClient()

> **createEnginexClient**(`options?`): [`EnginexClient`](../interfaces/EnginexClient.md)

Creates the SDK client. It never throws for missing configuration: `baseUrl`/`tenantHost`/`fetch` are only
resolved (and memoized) on the first request, so it is safe to create a client in a
top-level module and import it during SSR (Next.js, Nuxt), even before `location` exists. If the
configuration is incomplete, the first request rejects with an `EnginexError`
`CONFIGURATION_ERROR` without calling `fetch` — see [Next.js / SSR](/guide/getting-started) and
[Tenant and domains](/concepts/tenant). It only throws for invalid or contradictory options (see
`@throws`).

## Parameters

### options?

[`EnginexClientOptions`](../interfaces/EnginexClientOptions.md) = `{}`

## Returns

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

## Example

```ts
import { createEnginexClient, localStorageTokenStore } from '@getenginex/sdk'

export const enginex = createEnginexClient({
  locale: 'pt-BR',
  tokenStore: localStorageTokenStore(),
})
```

## Throws

`CONFIGURATION_ERROR` with a `baseUrl` that is not just the origin (path, query,
fragment or credentials), with `sessionOwner: 'app'` and `autoRefresh: true`, or with
`onAccessTokenRejected` without `sessionOwner: 'app'`.
