> For the complete documentation index, see [llms.txt](https://docs.metahumansdk.io/service-apis-for-creating-virtual-avatars/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.metahumansdk.io/service-apis-for-creating-virtual-avatars/getting-started/getting-a-token.md).

# Getting a token

In order to access our API, you must obtain an access token when authenticating a user. Once the token is generated, copy its value and save it in a secure place, since you will not be able to retrieve it again.&#x20;

To generate an access token, you must send a POST request using the [token URL](https://api.metahumansdk.io/auth).&#x20;

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

```bash
name="ENTER_YOUR_NAME"
email="ENTER_YOUR_EMAIL"
comment="ENTER_YOUR_COMMENT"

curl -X 'POST' \
  'https://api.metahumansdk.io/auth/token' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'name=${name}&mail=${email}&comment=${comment}'
```

{% endtab %}

{% tab title="python" %}

<pre class="language-python"><code class="lang-python">import requests

name = "ENTER_YOUR_NAME"
email = "ENTER_YOUR_EMAIL"
comment = "ENTER_YOUR_COMMENT"

def print_token():
<strong>    service_url = "http://api.metahumansdk.io/auth"
</strong>    service_headers = {"accept": "application/json"}
    data = {
        "name": name,
        "mail": email,
        "comment": comment
    }
    response = requests.post(service_url + "/token", headers=service_headers, data=data)
    assert (response.status_code == 200)
    
    print(response.json())

if __name__ == "__main__":
    print_token()

</code></pre>

{% endtab %}
{% endtabs %}

Expected output:

```json
{'result': {'token': '5775d7ad-d1d3-4aea-83cf-1c14512f70cc'}}
```

{% hint style="warning" %}
Note: Do not forget to replace the details in the request with your own.
{% endhint %}

{% hint style="info" %}
We promise not to spam you and keep your email private, you will only receive important updates from us.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.metahumansdk.io/service-apis-for-creating-virtual-avatars/getting-started/getting-a-token.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.
