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

# POST /token/create

Obtain an authentication token

All API calls require authentication. To obtain an authentication token you will require a `username`, `password` and your `security key` (this was emailed to you & accessible in the ).

## token/create

<mark style="color:green;">`POST`</mark> `https://auth.powerpointgeneratorapi.com/v1.0/token/create`

#### Headers

| Name                                           | Type   | Description         |
| ---------------------------------------------- | ------ | ------------------- |
| Content-Type<mark style="color:red;">\*</mark> | string | multipart/form-data |

#### Request Body

| Name                                       | Type   | Description                         |
| ------------------------------------------ | ------ | ----------------------------------- |
| username<mark style="color:red;">\*</mark> | string | Your account username/email address |
| password<mark style="color:red;">\*</mark> | string | Your account password               |
| key<mark style="color:red;">\*</mark>      | string | Your security key                   |

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

```json
{
  "isSuccess": true,
  "Message": null,
  "Result": {
    "Access_Token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "Username": "example@domain.com",
    "hasSubscription": true
  }
}
```

{% endtab %}

{% tab title="400: Bad Request" %}

```json
{
  "isSuccess": false,
  "Message": "Missing required form fields: username or password.",
  "Result": {}
}
```

{% endtab %}

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

```json
{
  "isSuccess": false,
  "Message": "Invalid email / password combination.",
  "Result": {}
}
```

{% endtab %}

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

```json
{
  "isSuccess": false,
  "Message": "Internal Server Error",
  "Result": {}
}
```

{% endtab %}
{% endtabs %}

### Example request

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

```bash
curl -d "username=<your_username>&password=<your_password>&key=<your_security_key>" \
     -X POST https://auth.powerpointgeneratorapi.com/v1.0/token/create
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://auth.powerpointgeneratorapi.com/v1.0/token/create"
payload={'username': '<your_username>', 'password': '<your_password>', 'key': '<your_security_key>'}
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
var formdata = new FormData();
formdata.append("username", "<your_username>");
formdata.append("password", "<your_password>");
formdata.append("key", "<your_security_key>");

var requestOptions = {
  method: 'POST',
  body: formdata,
  redirect: 'follow'
};

fetch("https://auth.powerpointgeneratorapi.com/v1.0/token/create", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="Postman" %}

1. Post: <https://auth.powerpointgeneratorapi.com/v1.0/token/create>
2. Select `form-data` in the `Body` tab
3. Populate the `KEY` and `VALUE` with your username, password and key
4. Hit `Send` to get your Bearer Token&#x20;

<figure><img src="https://1155212587-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mgoqdluo05I2RXHZpTr-887967055%2Fuploads%2Fi0H1a99Z1xHFsYe28GIe%2FPowerPointGeneratorAPI%20create%20token.png?alt=media&amp;token=2609bc36-e5ad-4979-adfe-318cf92f0632" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}
