# Авторизація: методи API Bimp

URL: https://bimpsoft.com/help/developers/api-reference/auth/

Методи API Bimp для ресурсу «Авторизація» (`/org2/auth/…`): 4 методи. Базова адреса: `https://app.bimpsoft.com`. Усі запити, крім входу, передають токен компанії в заголовку `access-token` — див. [Початок роботи з API](/help/developers/api-getting-started/).

| Метод | Що робить |
|---|---|
| [`POST /org2/auth/api-login`](#api-login) | Allows you to obtain a basic user token for further requests that do not depend on a specific company |
| [`POST /org2/auth/api-refresh`](#api-refresh) | Allows you to extend the user session by refreshing the token without the need for re-authorization |
| [`POST /org2/auth/api-selectCompany`](#api-select-company) | Allows you to generate a new access token containing information about the selected company. This token can be used to access the company's data (e.g., user list or product balances). |
| [`POST /org2/auth/api-verifyCompanyAccess`](#api-verify-company-access) | Validates a company access token and returns the associated auth payload for use by microservices. |

## api-login

`POST /org2/auth/api-login`

Allows you to obtain a basic user token for further requests that do not depend on a specific company

**Тіло запиту (JSON)**

| Поле | Тип | Обов'язкове | Опис |
|---|---|---|---|
| `email` | string (email) | так | The email address of the user, must be a valid email format |
| `password` | string | так | The password for the user |

**Відповідь: поле `data`**

| Поле | Тип | Опис |
|---|---|---|
| `accessToken` | string | The access token used to authenticate the user for subsequent requests |
| `refreshToken` | string | The refresh token used to obtain a new access token when the current one expires |

```bash
curl -X POST 'https://app.bimpsoft.com/org2/auth/api-login' \
  -H 'Content-Type: application/json' \
  -d '{"email":"api-user@example.com","password":"string"}'
```

## api-refresh

`POST /org2/auth/api-refresh`

Allows you to extend the user session by refreshing the token without the need for re-authorization

**Тіло запиту (JSON)**

| Поле | Тип | Обов'язкове | Опис |
|---|---|---|---|
| `refreshToken` | string | так | The refresh token used to obtain a new access token |

**Відповідь: поле `data`**

| Поле | Тип | Опис |
|---|---|---|
| `accessToken` | string | The access token used to authenticate the user for subsequent requests |
| `refreshToken` | string | The refresh token used to obtain a new access token when the current one expires |

```bash
curl -X POST 'https://app.bimpsoft.com/org2/auth/api-refresh' \
  -H 'access-token: <токен компанії>' \
  -H 'Content-Type: application/json' \
  -d '{"refreshToken":"string"}'
```

## api-selectCompany

`POST /org2/auth/api-selectCompany`

Allows you to generate a new access token containing information about the selected company. This token can be used to access the company's data (e.g., user list or product balances).

**Відповідь: поле `data`**

| Поле | Тип | Опис |
|---|---|---|
| `companyAccessToken` | string | The access token for the company, used for authentication |

```bash
curl -X POST 'https://app.bimpsoft.com/org2/auth/api-selectCompany' \
  -H 'access-token: <токен компанії>' \
  -H 'Content-Type: application/json' \
  -d '"string"'
```

## api-verifyCompanyAccess

`POST /org2/auth/api-verifyCompanyAccess`

Validates a company access token and returns the associated auth payload for use by microservices.

```bash
curl -X POST 'https://app.bimpsoft.com/org2/auth/api-verifyCompanyAccess' \
  -H 'access-token: <токен компанії>'
```

Інтерактивна документація з можливістю надіслати тестовий запит: [https://app.bimpsoft.com/docs](https://app.bimpsoft.com/docs). Специфікація OpenAPI оновлюється разом із Bimp; ця сторінка згенерована з неї автоматично.
