# Authentication

The Upright API supports only Access Token -based authentication. The authentication token must be included in the `Authorization` HTTP header.

### Creating a personal access token

You can create an access token for API usage on your [administration page](https://model.uprightproject.com/user/me/functions).

You must be logged in, and have access to the API feature enabled in order to access the administration page. If you have trouble accessing the page, please contact your Upright contact person.

Tokens remain valid until you reset them, which you can also do on the administration page.

### Obtaining machine user access tokens

If you prefer to setup a machine user in favor of using personal access tokens, contact your Upright contact person. Include the desired email address for the machine user. Note that the email address may not be in use by another user.

### Sending authenticated requests

The access token must be included in the `Authorization` header. The following examples show how to make an authenticated request to the `/metrics/legend` endpoint.

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

```shell
curl -H 'Authorization: YOUR_ACCESS_TOKEN' <https://api.uprightproject/v1/metrics/legend>
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
url = ‘<https://api.uprightproject.com/v1/metrics/legend’>
headers = {‘Authorization’, ‘Bearer {token}’.format(token=YOUR_ACCESS_TOKEN)}
res = requests.post(url, data=data, headers=headers)
print(json.loads(res.text))
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
import fetch from ‘node-fetch’;
async function run_script() {
  const url = `/metrics/legend`;
  const options = { headers: {‘Authorization’, `Bearer YOUR_ACCESS_TOKEN`} };
  const response = await fetch(url, options); console.log(response.json());
}
await run_script();
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
For simplicity, the code examples below include the access token as part of the source code. This approach is not recommended in real applications.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.uprightplatform.com/api/authentication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
