---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../modules.md) / [clients](../index.md) / createHttpClient

# Function: createHttpClient()

> **createHttpClient**\<`P`\>(`options`, `transport`, `__namedParameters`): `Client`\<`P`\>

Defined in: [packages/b2c-tooling-sdk/src/clients/http-transport.ts:152](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/8fc17d8708d025c83fb0c44ca73198a200605153/packages/b2c-tooling-sdk/src/clients/http-transport.ts#L152)

Creates an openapi-fetch client that uses the API transport for `transport`
(normally the client's auth strategy).

All SDK API clients must be created through this function (or
`buildScapiClient`) rather than openapi-fetch's `createClient`.
A caller-supplied `fetch` replaces the transport entirely; wrap
[getApiFetch](getApiFetch.md) inside it to keep the transport options. Either way,
network failures are reported as a `NetworkError`.

## Type Parameters

### P

`P` *extends* `Record`\<`string`, `any`\>

## Parameters

### options

`ClientOptions`

### transport

[`HttpTransportOptions`](../interfaces/HttpTransportOptions.md) | `undefined`

### \_\_namedParameters

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

## Returns

`Client`\<`P`\>
