> For the complete documentation index, see [llms.txt](https://cleyrop.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cleyrop.gitbook.io/docs/documentation-fr-en/data-and-ai-project/studio-ai/utiliser-un-assistant-dans-un-systeme-metier.md).

# Use an Assistant in a business system

{% hint style="warning" %}
The creation of new AI Assistants is blocked: they will soon be decommissioned in favor of **Agents**. Use the Tools **Cleyrop Corpus** and **Cleyrop Dataset** in your Agents to find the same uses (querying document corpora and datasets).
{% endhint %}

The feature **Expose an AI Assistant** makes it possible to make an assistant accessible via a **secure REST API**, so that it can be used directly from another system:

* an internal business tool
* an application dashboard,
* or an automated workflow.

Each API call is authenticated using a **access token** project token, ensuring the security and traceability of requests.

Complete documentation of the API endpoints is available at: `https://api.cleyrop./api/docs`

***

## Create an access token

To expose an assistant, you must generate a token from the relevant project.

**Creation steps**

1. Go to the Tokens tab from the project's home page. Or click directly on Share via API from an assistant's details page.
2. Click Create a token.
3. Enter a name and an expiration date.
4. Select the assistants to expose: you can also view the datasets or corpora they have access to.
5. Confirm token creation.

You can **edit** or **revoke a token** created

#### View existing tokens

All tokens are listed in the project's Tokens tab.

For each token, you can view:

* the name and creator,
* the creation, expiration, last use, and modification dates,
* the list of shared resources (assistants and associated knowledge scopes).

From an assistant's details page, the Tokens tab also displays the list of tokens granting it access.

## Use the API

The API is accessible via the following URL: `https://cleyrop./api/v1/assistants/<assistant_id>`

| domain        | The domain of your platform (e.g. maplateforme.net).   |
| ------------- | ------------------------------------------------------ |
| assistant\_id | Your assistant's ID (visible in its information page). |

The token must be passed in the HTTP header under the apiKey key.

{% hint style="warning" %}
Warning: exposing an assistant via API is restricted to whitelisted IPs.
{% endhint %}

**CURL request example**

{% code title="assistant api call" %}

```bash
curl -X 'GET' \
  'https://api.cleyrop.maplateforme.net/api/v1/assistants/76a3cbdb-b391-4742-b95a-382b7e5d08f2' \
  -H 'accept: application/json' \
  -H 'apiKey: T79oLnbhjE8VPaGI2CElieEkeAA4ueuDznwM_w14qEE'
```

{% endcode %}
