# Incode Web SDK

## Documentation

Check our full documentation here [https://docs.incode.com](https://docs.incode.com/)

## Getting Started

### 1. Basic Installation

Most modern frontend projects manage their dependencies using a package manager like npm or Yarn. To add our SDK to an existing project, the first thing you should do is install the necessary dependencies with the tool of your choice:

Using Yarn

```bash
yarn add @incodetech/welcome
```

Using npm

```bash
npm install @incodetech/welcome
```

If your project is not using React, you will need to install it; this is a dependency of the SDK.

```bash
yarn add react@^17.0.2 react-dom@^17.0.2
```

### 2. Initializing the SDK

To initialize the SDK, you need to provide your API Key and the API URL and run the following code:

```js
import { create } from '@incodetech/welcome';
// Get incode instance
const incode = create({
  apiKey: 'myApiKey',
  apiURL: 'myApiURL',
});
await incode.initialize();
```

This will return an instance of the SDK ready for use.

`await incode.initialize()` is still the recommended startup flow. WebClient-backed requests also wait for setup internally, so existing code that calls an API-backed SDK method immediately after `create()` remains compatible.

### 3. Use the instance

After you initialize the SDK, you can use any of the methods available (see API to learn more)

```js
// Start the camera component for the front ID
incode.renderCamera('front', container, {
  onSuccess: onSuccess,
  onError: onError,
});
```

## Next steps

Check our SDK API to learn more about it and how to use it. Click [here](https://docs.incode.com/docs/web/api/sdk-api) to learn more.

## Migration from the script tag

Check our guide [here](https://docs.incode.com/docs/web/migration-to-npm)