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

# Authentification

## Via un token de service (recommandé)

Des tokens de service peuvent être générés depuis la page de configuration de l'organisation (Paramètre - Généraux).

<figure><img src="/files/mk5km1c56JXjj3dHoMbX" alt=""><figcaption><p>Générer un token de service</p></figcaption></figure>

<pre class="language-python"><code class="lang-python"># Tester la connexion via le token API de service
import requests

URL_SERVER = "https://extract.api.recital.ai/extract/api/v1"
API_TOKEN = "....."

<strong>r = requests.get(
</strong>    url=f"{URL_SERVER}/config/", 
    headers={"Authorization": f"Bearer {API_TOKEN}"
)
</code></pre>

## Via ID / Mot de passe (token d'accès)

L'authentification via ID/mot de passe vous permet d'obtenir un token d'accès qui sera utilisé dans chaque appel ultérieur de l'API. Le token d'accès a une durée de vie d'une heure.

{% code fullWidth="false" %}

```python
# Tester la connexion via ID / MDP (token d'accès)
import requests

URL_SERVER = "https://extract.api.recital.ai/extract/api/v1"
URL_AUTH = "https://extract.auth.recital.ai/auth/api/v1/login/?noAuth=true"
USER = "...."
PWD = "...."

def get_headers():
    r = requests.post(url=URL_AUTH, data={"username":USER,"password":PWD})
    if r.status_code == 200:
        return {"Authorization":f"Bearer {r.json()['access_token']}"}
    else:
        raise Exception(f'Authentication Error - {r.status_code} - {r.reason} - {r.content}')
 
r = requests.get(
    url=f"{URL_SERVER}/config/", 
    headers=get_headers()
)
```

{% endcode %}


---

# 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.recital.ai/products/integration-api/authentification.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.
