# Основы работы с API

API [Сам.Бизнес ](https://xn--80aapgyievp4gwb.xn--p1ai/business)— универсальное решение для работы бизнеса с онлайн-платежами. API сервиса построено на REST-принципах, работает с реальными объектами и обладает предсказуемым поведением. С помощью нашего API вы можете отправлять запросы на выплаты, создавать реестры,добавлять самозанятых, выгружать отчеты и многое другое. API в качестве основного протокола использует HTTP, и подходит для разработки на любом языке программирования, который умеет работать с HTTP-библиотеками (cURL и другими).

{% hint style="info" %}
API endpoint: <https://business.selfwork.ru/selfemployed/business/v1/>
{% endhint %}

API поддерживает POST, PUT, GET-запросы. POST-запросы используют JSON-аргументы, GET-запросы работают со строками запросов. API всегда возвращает ответ в формате JSON, независимо от типа запроса.

{% hint style="info" %}
Для использования API сервиса, администратору необходимо создать пользователя с соответсвующими правами [(см.здесь)](https://sergey-bedihin.gitbook.io/rabota-s-api/sozdanie-polzovatelya).
{% endhint %}

**Пример запроса на проверку доступности API:**

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

```bash
curl --location --request GET 'https://business.selfwork.ru/selfemployed/business/v1/check' \
--header 'X-Login: example' \
--header 'X-Password: 591c0bcd4a41137fe9fce94dfba74e24'
```

{% endtab %}

{% tab title="JS" %}

```javascript
var axios = require('axios');

var config = {
  method: 'get',
  url: 'https://business.selfwork.ru/selfemployed/business/v1/check',
  headers: { 
    'X-Login': 'example', 
    'X-Password': '591c0bcd4a41137fe9fce94dfba74e24'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

```

{% 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://sergey-bedihin.gitbook.io/rabota-s-api/osnovy-raboty-s-api.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.
