> For the complete documentation index, see [llms.txt](https://clik-ai.gitbook.io/smart-extract-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://clik-ai.gitbook.io/smart-extract-documentation/api-reference/data-extraction-api/authentication.md).

# 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

#### For Production environment:

## 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 %}

#### For Staging Environment:

## token

<mark style="color:green;">`POST`</mark> `https://api.clik.ai/smart-extract-stg-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 %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://clik-ai.gitbook.io/smart-extract-documentation/api-reference/data-extraction-api/authentication.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
