# Generate Token

### Base URL

```
sdk.faceki.com
```

### Token Generation End Point

```
https://sdk.faceki.com/auth/api/access-token
```

## Token Authentication Postman

**Get a** Bearer Token **access token.**

Authentication for the Faceki API is achieved through token-based authentication. To authenticate requests made to the API, you must include an API token in the **Authorization** of your requests.

For the GET method, the "Authorization" header should include "Bearer Token" followed by your parameters. which are "clientId" and "clientSecret". These parameters help to ensure that the request is valid and authorized.

By including the necessary authentication details in your requests, you can ensure that your requests are processed correctly and securely.

This API is used to generate tokens, this token is client-specific and used to authenticate client identity before performing operations in the system.

{% hint style="info" %}
Method: GET

Authorization: Bearer Token

**Parameter:**

&#x20;clientId  \*(mandatary)

&#x20;clientSecret   \*(mandatory)
{% endhint %}

{% hint style="info" %}

```
Each token will have a token refresh expiry of 5 minutes/ 3600 seconds. 
```

{% endhint %}

{% hint style="info" %}
\*All Params are mandatary required
{% endhint %}

<figure><img src="/files/61j79SPFudAzXB8BuDi0" alt=""><figcaption><p>Choose GET, add End point api, then select Params, add ClientID &#x26; clientSecert</p></figcaption></figure>

<figure><img src="/files/TaZ31NmO2FrVeVPLt9iy" alt=""><figcaption><p>ClientID and CleintSecert should be selected in Parms</p></figcaption></figure>

<mark style="color:blue;">`GET`</mark> `https://sdk.faceki.com/auth/api/access-token`

#### Headers

| Name                                           | Type   | Description                                                                                                                                                                    |
| ---------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| clientSecret<mark style="color:red;">\*</mark> | String | <p>clientSecret will be found in the integration section.</p><p> <em>Example: <code>"clientSecret":"00nl0cuq780ur007spqspa94kq6rkn1fap1e0kdre7gdl97lvspk".</code></em><br></p> |
| clientid<mark style="color:red;">\*</mark>     | String | <p>(string, required) Client Id from integration settings.</p><p> <em>Example: <code>"client\_id":"0NTS4CBV8MVII02VGVSPICB00"</code>.</em><br></p>                             |
| Content-Type                                   | String | application/json                                                                                                                                                               |

{% tabs %}
{% tab title="200: OK " %}

```json
    "responseCode": 0,
    "data": {
        "access_token": "eyYkdDhiJuMVdFVFwvYWRPWFBCWTgxaCtTdEpcLytxUFVzSzFGSVlubXhSdUV4UWdJSkU9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI3YnN2YW5jcGw0dGlvNjA2MDBwbjZobnI1OCIsInRva2VuX3VzZSI6ImFjY2VzcyIsInNjb3BlIjoia3ljXC9hbGwiLCJhdXRoX3RpbWUiOjE2ODI1MTM5NDksImlzcyI6Imh0dHBzOlwvXC9jb2duaXRvLWlkcC5tZS1zb3V0aC0xLmFtYXpvbmF3cy5jb21cL21lLXNvdXRoLTFfNHRvVUVCem9mIiwiZXhwIjoxNjgyNTE3NTQ5LCJpYXQiOjE2ODI1MTM5NDksInZlcnNpb24iOjIsImp0aSI6Ijg2NjY3N2FkLTcyMDctNDFkOC1hZjI5LTk3OWU3MDA3YWViNiIsImNsaWVudF9pZCI6Ijdic3ZhbmNwbDR0aW82MDYwMHBuNmhucjU4In0.NTs5EgFlTlfslPIFZpqK5ABAj7oZMPlGMEvH4YeUHOSB0m7jo_TkzNTHm1GCp32Mz3qCBOHZPiic0PPPCFJ1p1A2o7WSmV4x6GQ9vS55kvOUcgaY0_wS37_2TQ7ObVUeMKAeuSqdE9QBWIiMDdZyslDb-pGlXjC4WE0g30TGbKuu2twungoUztyDS1HqBQUNnZ1T3HV0fOTYXwKmXjGCoP-gZHW3TRG8woF4QnPqoAYItV-aRT01fv2H62NdlL_VZ7A1cCHEClDIs5U5nagGjVWeIxJUTLQT0tFVvYVh6ViCaRCv2hlFcSrSwym0hvtGgPNV0H_eZ2yytoFjq0danQ",
        "expires_in": 3600,
        "token_type": "Bearer"
    }
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

```javascript
{
  "status": false,
  "message": "",
  "statusCode": 422,
  "data": {}
}
```

{% endtab %}

{% tab title="402 " %}

```javascript
{
  "clientSecret": ""
}
```

{% endtab %}

{% tab title="403 " %}

```javascript
{
  "status": false,
  "message": "client id is required",
  "statusCode": 422,
  "data": {}
}
```

{% endtab %}
{% endtabs %}

### Response JSON format

<figure><img src="/files/uJMguyO2CbC828pBlofI" alt=""><figcaption></figcaption></figure>

Requests return a JSON object with the header:

```
// Content-Type: application/json
```

Responses return JSON with a consistent structure, except downloads.

You must make all your requests to the API over HTTPS and TLS 1.2, with Server Name Indication enabled. Any requests made over HTTP will fail.<br>

## Token authentication Codes <a href="#token-authentication" id="token-authentication"></a>

{% tabs %}
{% tab title="HTTP" %}

```html
Authorization: Token token=<YOUR_API_TOKEN>
```

{% endtab %}

{% tab title="Bash" %}

```
api_url='https://sdk.faceki.com/auth/api/access-token?clientId=7bsvancpl4tio60600pn6hnr58&clientSecret=1d5bssl48phc3vjfh5ljntkl9b2u6a0r80kit6vg08f9kpf70ch9'
curl -X GET $api_url
```

{% endtab %}

{% tab title="PHP" %}

```
$api_url='https://sdk.faceki.com/auth/api/access-token?clientId=00svancpl4tio60600pn6hnr58&clientSecret=0000sl48phc3vjfh5ljntkl9b2u6a0r80kit6vg08f9kpf70ch9';

$curl = curl_init();

curl_setopt($curl, CURLOPT_URL, $api_url);

curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

$output = curl_exec($curl);

curl_close($curl);
```

{% endtab %}

{% tab title="Java" %}

```
import requests

api_url = 'https://sdk.faceki.com/auth/api/access-token?clientId=7bsvancpl4tio60600pn6hnr58&clientSecret=1d5bssl48phc3vjfh5ljntkl9b2u6a0r80kit6vg08f9kpf70ch9'

response = requests.get(api_url)

output = response.content

```

{% endtab %}

{% tab title="JavaScript" %}

```
let api_url = 'https://sdk.faceki.com/auth/api/access-token?clientId=7bsvancpl4tio60600pn6hnr58&clientSecret=1d5bssl48phc3vjfh5ljntkl9b2u6a0r80kit6vg08f9kpf70ch9';

fetch(api_url)
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error(error));

```

This code uses the `fetch` API to make a GET request to the API endpoint and returns a Promise that resolves to the response data. The `console.log` method is used to log the data to the console, and the `console.error` method is used to log any errors that may occur during the request.
{% endtab %}

{% tab title="Ruby" %}

```
require 'net/http'

api_url = URI('https://sdk.faceki.com/auth/api/access-token')
params = { clientId: '7bsvancpl4tio60600pn6hnr58', clientSecret: '1d5bssl48phc3vjfh5ljntkl9b2u6a0r80kit6vg08f9kpf70ch9' }
api_url.query = URI.encode_www_form(params)

response = Net::HTTP.get(api_url)

puts response

```

{% endtab %}

{% tab title="Python" %}

```
api_url = 'https://sdk.faceki.com/auth/api/access-token?clientId=00svancpl4tio60600pn6hnr58&clientSecret=0000sl48phc3vjfh5ljntkl9b2u6a0r80kit6vg08f9kpf70ch9'

import requests

response = requests.get(api_url)
output = response.json()

print(output)
```

{% endtab %}
{% endtabs %}

## Error Code

```
    INTERNAL_SYSTEM_ERROR = 1000,
    SUCCESS = 0,
    NO_RULES_FOR_COMPANY = 7001,
    NEED_REQUIRED_IMAGES = 8001,
    DOCUMENT_VERIFY_FAILED = 8002,
    PLEASE_TRY_AGAIN = 8003,
    FACE_CROPPED = 8004,
    FACE_TOO_CLOSED = 8005,
    FACE_NOT_FOUND = 8006,
    FACE_CLOSED_TO_BORDER = 8007,
    FACE_TOO_SMALL = 8008,
    POOR_LIGHT = 8009,
    ID_VERIFY_FAIL = 8010,
    DL_VERIFY_FAIL = 8011,
    PASSPORT_VERIFY_FAIL = 8012,
    DATA_NOT_FOUND = 8013,
    INVALID_VERIFICATION_LINK = 8014,
    VERIFICATION_LINK_EXPIRED = 8015,
    FAIL_TO_GENERATE_LINK = 8016,
    KYC_VERIFICATION_LIMIT_REACHED = 8017,
    SELFIE_MULTIPLE_FACES = 8018,
    FACE_BLURR = 8019
```

### /kyc-verification


---

# Agent Instructions: 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:

```
GET https://kycdocv2.faceki.com/api-integration/verification-apis/generate-token.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
