# How to get E-Invoicing KSA Auth Token?

### Step 1 - Login to your ClearTax account

Sandbox -  [https://app-sandbox.cleartax.com/middle-east/ksa/einvoicing](https://app-sandbox.cleartax.com/middle-east/ksa/einvoicing)&#x20;

Production account -[ https://app.cleartax.com/middle-east/ksa/einvoicing](https://app.cleartax.com/middle-east/ksa/einvoicing/)

<figure><img src="https://2888774781-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZ9fXxeBEm3pJiVldcu%2Fuploads%2Fnzyr5QMFm6rmTpCPcEqt%2FA.png?alt=media&#x26;token=be849035-72c2-40de-b570-33f5c693d6c0" alt=""><figcaption></figcaption></figure>

### Step 2 - Go to “Settings” page

After logging into your account, click on the ‘Settings’ option at the bottom of the left-sided menu to view all the settings available.

<figure><img src="https://2888774781-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZ9fXxeBEm3pJiVldcu%2Fuploads%2F0GMVHw2f7AhJsTkbo8vQ%2FB.png?alt=media&#x26;token=33c594fe-8e5a-4166-b79e-06d2478a1dc2" alt=""><figcaption></figcaption></figure>

### Step 3 - Go to “Integrations- API Clients” page

Among the options available in the left-sided menu ‘Settings’, click on ‘Integrations’ and select the ‘API Clients’ option in that to open the page with API clients and auth token information.

<figure><img src="https://2888774781-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZ9fXxeBEm3pJiVldcu%2Fuploads%2FZRSd3iWWxOOevKAFd6Oi%2FC.png?alt=media&#x26;token=16b642a0-101e-4566-b32e-762b9d3cae19" alt=""><figcaption></figcaption></figure>

### Step 4 - Creation of new API Client

Click on ‘Create API Client’ at the top to create a new one.

a. Enter a name in the API Client Label text field which must be unique to this workspace.

b. Click on product i.e. EInvoice for which you want to create an API Client.

c. Set the expiration time as per your need (Suggested -  set to Never Expires).

<figure><img src="https://2888774781-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZ9fXxeBEm3pJiVldcu%2Fuploads%2FeL3RRVpPwrt97JfJF2MB%2FC.png?alt=media&#x26;token=3b6199a8-4a7e-4460-b448-0c90d26bf9b6" alt=""><figcaption></figcaption></figure>

d. Click on create.

<figure><img src="https://2888774781-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZ9fXxeBEm3pJiVldcu%2Fuploads%2FadPHwKIL83ybOqwi59RC%2FD.jpg?alt=media&#x26;token=1f697f54-2b5a-4505-b3b9-cf4d48430aed" alt=""><figcaption></figcaption></figure>

### Step 5 - Save the generated client secret key

After clicking on ‘Create’ a new API client will be created. Save the API client generated for future use in a text file or somewhere where it can be accessed easily as this will not be available later.

### Step 6 - Generate a new access token

After generating the API client click on ‘Generate Access Token’ to generate a new access token. Please remember to copy and save this. Once you move to another page it won’t be available and you will have to generate a new one.&#x20;

Copy the Auth Token generated in the “Access Token” field and save it securely in your system. You can use this token for the request header “x-cleartax-auth-token” later in your API requests.

<figure><img src="https://2888774781-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LZ9fXxeBEm3pJiVldcu%2Fuploads%2FQ4E0la0AY6p8guoVc6T4%2FE.jpg?alt=media&#x26;token=e7f54842-8fb2-4a64-9af5-0809f5ba012f" alt=""><figcaption></figcaption></figure>

Please note, you can generate as many tokens as you want (may be for each ERP). To help you identify the tokens in the future, you can name the access tokens with labels. So make sure to keep the labels unique and identifiable.

{% hint style="warning" %}
### Keep it safe!

Access token is a confidential information. After creating an access token, it's important to persist it in a secure location.
{% endhint %}
