# Authentication

All endpoints require authentication via a Bearer token. A Bearer token is a security token that grants access to protected resources. It must be included in the HTTP Authorization header of each API request. The server validates the token to authenticate the client making the request.

Clients must include the following HTTP header with each API request:

```http
Authorization: Bearer <your_token_here>
```

#### How to obtain a token

* API tokens are issued manually by Apentis during client onboarding.
* Each token is associated with an organization and specific access permissions.
* Tokens are long-lived but can be revoked at any time for security purposes.

#### Security best practices

* Store the token securely and do not expose it in public repositories or client-side code.
* Rotate the token periodically if instructed by Apentis.
* In case of token compromise, contact Apentis support immediately to revoke and regenerate a new token.

#### Example of using the token in a request

```bash
curl -X GET "https://www.rq-test.com/api/business-relations" \
     -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
```

If the token is missing or invalid, the API will return a `401 Unauthorized` response.


---

# 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://apentis.gitbook.io/apentis-api/api-reference/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.
