# Authentication

The SmartExtract API uses API Keys to provide a session token. You can view and manage your API Keys through your [dashboard](https://app.clik.ai/smart-extract/account/admin/account/apiKeys). Make sure to note down the secret key when you create a new API key. If you fail to copy or lose your secret key, there is no way to retrieve it back. The only option would be to create a new API key.\
\
The session-auth-token returned as part of the response needs to be used as part of the iframe url while loading the SmartExtract component

## token

<mark style="color:green;">`POST`</mark> `https://api.clik.ai /smart-extract-api/api/account/v1/auth/token`

Create an authentication token to be used to load the SmartExtract iframe.

#### Headers

| Name         | Type   | Description      |
| ------------ | ------ | ---------------- |
| Content-Type | string | application/json |

#### Request Body

| Name   | Type   | Description     |
| ------ | ------ | --------------- |
| key    | string | Your API key    |
| secret | string | Your secret key |

{% tabs %}
{% tab title="200 Session token successfully generated" %}

```
{
  "data": {
    "token": "<session-auth-token>"
  }
}
```

{% endtab %}

{% tab title="401 The API credentials are not valid or the key used is not enabled" %}

```javascript
// Invalid credentials response
{
  "status": "error",
  "error": "Invalid credentials provided"
}

// Disabled key response
{
  "status": "error",
  "error": "This API key is disabled"
}
```

{% endtab %}
{% endtabs %}

####
