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

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

# Function: createMrtClient()

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

Defined in: [packages/b2c-tooling-sdk/src/clients/mrt.ts:154](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/clients/mrt.ts#L154)

Creates a typed Managed Runtime 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.

## Parameters

### config

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

MRT client configuration

### auth

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

Authentication strategy (typically ApiKeyStrategy)

## Returns

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

Typed openapi-fetch client

## Examples

```ts
// Create MRT client with API key auth
const apiKeyStrategy = new ApiKeyStrategy(apiKey, 'Authorization');

const client = createMrtClient({}, apiKeyStrategy);

// Push a bundle to a project
const { data, error } = await client.POST('/api/projects/{projectSlug}/builds/', {
  params: {
    path: { projectSlug: 'my-project' }
  },
  body: {
    message: 'My bundle',
    encoding: 'base64',
    data: bundleData,
    ssr_parameters: {},
    ssr_only: ['ssr.js'],
    ssr_shared: ['shared.js']
  }
});
```

```ts
// List all projects
const { data, error } = await client.GET('/api/projects/', {});
```

```ts
// Get a specific target/environment
const { data, error } = await client.GET('/api/projects/{projectSlug}/target/{targetId}/', {
  params: { path: { projectSlug: 'my-project', targetId: 'staging' } }
});
```
