# Access Token

{% hint style="info" %}
This access token will remain operational for a 24-hour period.
{% endhint %}

## Access Token

## Token Creation

<mark style="color:green;">`POST`</mark> `https://<<platform-server>>/ds-api/user-token`

Authentication is mandatory, requiring a valid username and password.

**Response**

{% tabs %}
{% tab title="201: Created " %}

```json
{
  "user-token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1ODAyMTYyMjQsImlhdCI6MTU4MDEyOTgxOSwiZGF0YWJhc2UiOiJNYWluIE9yZy4iLCJlbWFpbCI6InRlc3RAZGF0YXNlbnRpbmVsLmlvIiwidXNlciI6InRlc3QifQ.JMDvq2JPcqz9M0_it_0UtP9y79dClVwx9pDEzCl9HTk"
}
```

{% endtab %}

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

{% endtab %}

{% tab title="500: Internal Server Error " %}

{% endtab %}
{% endtabs %}

{% code title="Example" %}

```bash
curl -u myUser:myPassword -k -X POST https://<<platform-server>>/ds-api/user-token
```

{% endcode %}

{% code title="output " %}

```json
{
  "user-token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1ODAyMTYyMjQsImlhdCI6MTU4MDEyOTgxOSwiZGF0YWJhc2UiOiJNYWluIE9yZy4iLCJlbWFpbCI6InRlc3RAZGF0YXNlbnRpbmVsLmlvIiwidXNlciI6InRlc3QifQ.JMDvq2JPcqz9M0_it_0UtP9y79dClVwx9pDEzCl9HTk"
}
```

{% endcode %}

## Token Infos

<mark style="color:blue;">`GET`</mark> `https://<<platform-server>>/ds-api/user-token?token={user-token}`

Authentication is mandatory, requiring a valid username and password.

#### Query Parameters

| Name                                         | Type   | Description  |
| -------------------------------------------- | ------ | ------------ |
| user-token<mark style="color:red;">\*</mark> | String | Access Token |

**Response**

{% tabs %}
{% tab title="200: OK " %}
{% code title="Output example" %}

```json
{
    "email": "contact@datasentinel.io",
    "expire_time": "2020-04-28 13:58:53",
    "organization_name": "ds-data",
    "user": "datasentinel"
}
```

{% endcode %}
{% endtab %}

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

{% endtab %}

{% tab title="500: Internal Server Error " %}

{% endtab %}
{% endtabs %}

{% code title="Example" %}

```bash
export TOKEN=<<user_token>>
curl -u myUser:myPassword -k -X GET https://<<platform-server>>/ds-api/user-token?token=$TOKEN
```

{% endcode %}

{% code title="output " %}

```json
{
    "email": "contact@datasentinel.io",
    "expire_time": "2023-04-28 13:58:53",
    "organization_name": "ds-data",
    "user": "datasentinel"
}
```

{% endcode %}
