> For the complete documentation index, see [llms.txt](https://developer.perculus.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.perculus.com/services/authorization.md).

# Authorization

{% hint style="danger" %}
**Important Note!**\
\
Constructor Groups’ XAPI V1 has been retired and is no longer available to new customers. Please use the Groups V2 API going forward.\
\
Link to V2 API documentation: <https://developer.perculus.com/v2-en>
{% endhint %}

{% hint style="info" %}
Bearer token must be added as Authentication key in the “HEADER” field for all requests to be sent to PerculusAPI.
{% endhint %}

Below are the parameters required to create ACCESS\_TOKEN. This is the token we will use as the Bearer:

* DOMAIN: The subdomain of Perculus that is used to access your Panel
* ACCESS\_KEY: The email address of the user we created for the API&#x20;
* SECRET\_KEY: The password of the user we created for the API&#x20;
* ACCOUNT\_ID: The GUID of your account

{% hint style="danger" %}
For **ACCOUNT\_ID** data, you can contact your customer success manager and get the **‘ACCOUNT\_ID**’  belonging to your account.
{% endhint %}

{% hint style="info" %}
All of these data can be collected from your environment variables as well. Just suffix each variable with `PERCULUS_` , and SDKs will try to collect those information.
{% endhint %}

Use the following example to access ACCESS\_TOKEN data.

{% tabs %}
{% tab title="CURL" %}
After sending the following CURL request, ACCESS\_TOKEN will be returned as the response.

```bash
curl --location --request POST 'https://<DOMAIN>/connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'username=<EMAIL>' \
--data-urlencode 'password=<PASSWORD>' \
--data-urlencode 'client_id=api' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'account_id=<ACCOUNT_ID>'
```

Below you can see a sample response model:

```json
{
    "access_token": "<ACCESS_TOKEN>",
    "expires_in": 36000,
    "token_type": "Bearer",
    "scope": "api"
}
```

{% endtab %}

{% tab title="Python" %}
The Python SDK must be installed first:

```bash
pip install perculus-sdk
```

The SDK should be imported into the appropriate code block after ensuring that the SDK is installed:

```python
from perculus_sdk.client import APIClient
```

Complete the authentication process using the **'set\_credentials'** method with your parameters.

```python
# API client
client = APIClient()

# Set your domain
client.set_domain("<DOMAIN>")

# Set your credentials
client.set_credentials(
    access_key="<EMAIL>",
    secret_key="<PASSWORD>",
    account_id="<ACCOUNT_ID>"
)
```

After this step, you can use the other methods as you wish without having to authorize each service in the SDK over and over again.
{% endtab %}

{% tab title="C#" %}

```
// ASAP :)
```

{% endtab %}

{% tab title="NodeJS" %}
The Node.js SDK must be installed first:

```bash
npm install perculus-sdk
```

The SDK should be imported into the appropriate code block after ensuring that the SDK is installed:

```javascript
import APIClient from "perculus-sdk"
```

Complete the authentication process using the **'setCredentials'** method with your parameters.

```javascript
// API client
const client = new APIClient()

// Set your domain
client.setDomain("<DOMAIN>")

// Set your credentials
client.setCredentials(
    access_key="<EMAIL>",
    secret_key="<PASSWORD>",
    account_id="<ACCOUNT_ID>"
)
```

After this step, you can use the other methods as you wish without having to authorize each service in the SDK over and over again.
{% endtab %}

{% tab title="Go" %}

```
// ASAP :)
```

{% endtab %}
{% endtabs %}

{% hint style="danger" %}
**The ACCESS\_TOKEN will be required for all future services. Therefore, remember to keep your ACCESS\_TOKEN in a safe place.**
{% endhint %}
