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

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

# Function: createCustomApisClient()

> **createCustomApisClient**(`config`, `auth`): [`CustomApisClient`](../type-aliases/CustomApisClient.md)

Defined in: [packages/b2c-tooling-sdk/src/clients/custom-apis.ts:141](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/clients/custom-apis.ts#L141)

Creates a typed Custom APIs DX API client.

Returns the openapi-fetch client directly, with authentication
handled via middleware. This gives full access to all openapi-fetch
features with type-safe paths, parameters, and responses.

The client automatically handles OAuth scope requirements:
- Domain scope: `sfcc.custom-apis` (or custom via config.scopes)
- Tenant scope: `SALESFORCE_COMMERCE_API:{tenantId}`

## Parameters

### config

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

Custom APIs client configuration including shortCode and tenantId

### auth

[`AuthStrategy`](../../auth/interfaces/AuthStrategy.md)

Authentication strategy (typically OAuth)

## Returns

[`CustomApisClient`](../type-aliases/CustomApisClient.md)

Typed openapi-fetch client

## Example

```ts
// Create Custom APIs client - scopes are handled automatically
const oauthStrategy = new OAuthStrategy({
  clientId: 'your-client-id',
  clientSecret: 'your-client-secret',
});

const client = createCustomApisClient(
  { shortCode: 'kv7kzm78', tenantId: 'zzxy_prd' },
  oauthStrategy
);

// Get all Custom API endpoints
const { data, error } = await client.GET('/organizations/{organizationId}/endpoints', {
  params: {
    path: { organizationId: toOrganizationId('zzxy_prd') }
  }
});
```
