> ## Documentation Index
> Fetch the complete documentation index at: https://docs-classic.cognigy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# createWebRTCClient

> Creates a new WebRTCClient instance for the SDK.

Creates and returns a new `WebRTCClient` instance. This is the main entry point of the SDK.

## Signature

```typescript theme={null}
import { createWebRTCClient } from '@cognigy/click-to-call-sdk';

const client = await createWebRTCClient(config: WebRTCClientConfig);
```

## Parameters

| Parameter | Type | Description | Required |
| - | - | - | - |
| `config` | [`WebRTCClientConfig`](https://docs-classic.cognigy.com/click-to-call/sdk/api-reference/types#webrtcclientconfig) | Configuration object for the client. | Yes |

## Returns

`Promise<WebRTCClient>` — a configured client instance ready to connect and make calls.

## Example

```typescript theme={null}
import { createWebRTCClient } from '@cognigy/click-to-call-sdk';

const client = await createWebRTCClient({
  endpointUrl: 'https://your-api.com/voice-connect-config',
  userId: 'user-123',
});
```

## Errors

The function rejects with one of the following errors:

| Error | Cause |
| - | - |
| `endpointUrl is required` | The configuration doesn't contain an `endpointUrl`. |
| `WebRTC is not supported in this environment` | The environment isn't a browser, or the browser doesn't support the required WebRTC APIs. |

The function doesn't connect to the SIP server and doesn't send any network request. The SDK fetches the configuration when you call [`connect()`](https://docs-classic.cognigy.com/click-to-call/sdk/api-reference/connect).

## More Information

* [WebRTCClientConfig](https://docs-classic.cognigy.com/click-to-call/sdk/api-reference/types.md#webrtcclientconfig)
* [checkWebRTCSupport](https://docs-classic.cognigy.com/click-to-call/sdk/api-reference/check-click-to-call-support.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.