# Authentication

The SamoChat API uses a bearer token to authenticate requests but first, you have to get it by using your `client_id` and `client_secret`. In order to get them you'll need to contact us at <info@samochat.net>, and write the following:

* Why you need access to the API?
* The link to your SamoChat profile

You'll only get access if you're already a SamoChat user.

{% hint style="info" %}
The access token will expire after 24 hours
{% endhint %}

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

```
curl --location --request POST 'https://samochat.eu.auth0.com/oauth/token' \
--header 'Content-Type: application/json' \
--data-raw '{
    "client_id": "{client_id}",
    "client_secret": "{client_secret}",
    "audience": "https://api.samochat.net",
    "grant_type": "client_credentials"
}
```

{% endtab %}

{% tab title=".NET library" %}

```csharp
using SamoChatNet;
 
 SamoChatConfig.ClientID = "ClientID";
 SamoChatConfig.ClientSecret = "ClientSecret";
```

{% endtab %}

{% tab title="Python library" %}

```python
import samochat

samochat.client_id = "client_id"
samochat.client_secret = "client_secret"
```

{% endtab %}
{% endtabs %}


---

# 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://developers.samochat.net/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.
