> For the complete documentation index, see [llms.txt](https://docs.pptxbuilder.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pptxbuilder.com/api-reference/authentication.md).

# Authentication

This page describes the authentication flow and endpoint specs.

The PPTX Builder API uses tokens in order to authenticate requests. In order to get an API Token you will need to be registered in <https://api.pptxbuilder.com>.&#x20;

Authentication to the API is performed via [HTTP Basic Auth](http://en.wikipedia.org/wiki/Basic_access_authentication). Provide `"username:password"` in base64 encoding as basic auth. You will have to provide your company `key` in the body of the request (you can find it in the company section).

The Token is valid for 7 days. After 7 days of inactivity token will be marked as `expired`.

## Get API Token

<mark style="color:green;">`POST`</mark> `https://api.pptxbuilder.com/api/auth/token`

This endpoint allows you to get a API Token.

#### Headers

| Name          | Type   | Description                |
| ------------- | ------ | -------------------------- |
| Content-Type  | string | application/json           |
| Authorization | string | Basic \<username:password> |

#### Request Body

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| key  | string | \<company-key> |

{% tabs %}
{% tab title="200 API Token successfully created" %}

```
body : {
    "success": "New Token has been created",
    "token_expires": "Wed, 02 Oct 2019 14:51:42 GMT"
}

headers : {
    "Content-Type": "application/json",
    "Content-Length": "98",
    "Content-Language": "en-UK",
    "Authentication-Token": "<your-api-token-here>",
    "Date": "Thu, 26 Sep 2019 05:56:58 GMT"
}
```

{% endtab %}

{% tab title="404 Company doesn't exists or Key is incorrect." %}

```
{"error": "Company doesn't exists or Key is incorrect"}
```

{% endtab %}
{% endtabs %}

## Update API Token

<mark style="color:green;">`POST`</mark> `https://api.pptxbuilder.com/api/auth/update_token`

This endpoint allows you to renew your API Token even if it's expired.

#### Headers

| Name          | Type   | Description                |
| ------------- | ------ | -------------------------- |
| Content-Type  | string | application/json           |
| Authorization | string | Basic \<username:password> |

#### Request Body

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| key  | string | \<company-key> |

{% tabs %}
{% tab title="200 API Token successfully renewed" %}

```
body : {
    "success": "Token has been updated successfully!",
    "token_expires": "Thu, 03 Oct 2019 06:52:44 GMT"
}

headers : {
    "Content-Type": "application/json",
    "Content-Length": "98",
    "Content-Language": "en-UK",
    "Authentication-Token": "<your-api-token-here>",
    "erver": "Werkzeug/0.15.5 Python/3.6.8",
    "Date": "Thu, 26 Sep 2019 05:56:58 GMT"
}
```

{% endtab %}

{% tab title="404 Company doesn't exists or Key is incorrect." %}

```
{
    "error": "Company doesn't exists or Key is incorrect"
}
```

{% endtab %}
{% endtabs %}
