> For the complete documentation index, see [llms.txt](https://docs.esimpay.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.esimpay.net/api/autentifikaciya.md).

# Аутентификация

Получите CF-ACCESS-SIGN перед вызовом POST-методов.

Формирование подписи для подписанных запросов.

## Получить подпись CF-ACCESS-SIGN

> \
> Формирует подпись HMAC-SHA256 для тела запроса. Используйте перед вызовом подписанных POST/GET в GitBook \*\*Test it\*\*.\
> \
> \*\*Алгоритм:\*\*\
> 1\. \`body\` = JSON из \`payload\` (ключи отсортированы, без пробелов, UTF-8)\
> 2\. \`signature\` = Base64(HMAC-SHA256(apiSecret, body))<br>

```json
{"openapi":"3.1.1","info":{"title":"API","version":"v1"},"tags":[{"name":"Authentication","description":"Формирование подписи для подписанных запросов."}],"servers":[{"url":"https://api.esimpay.net/api/v1"}],"paths":{"/customer/sign":{"post":{"operationId":"get_access_sign","summary":"Получить подпись CF-ACCESS-SIGN","description":"\nФормирует подпись HMAC-SHA256 для тела запроса. Используйте перед вызовом подписанных POST/GET в GitBook **Test it**.\n\n**Алгоритм:**\n1. `body` = JSON из `payload` (ключи отсортированы, без пробелов, UTF-8)\n2. `signature` = Base64(HMAC-SHA256(apiSecret, body))\n","responses":{"200":{"description":"Подпись успешно сформирована","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"body":{"type":"string","description":"Каноническое JSON-тело для подписи"},"signature":{"type":"string","description":"Base64 HMAC-SHA256"},"header":{"type":"object","properties":{"CF-ACCESS-SIGN":{"type":"string"}}}}}}}},"400":{"description":"Некорректный payload","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"}}}}}},"401":{"description":"Неверный apiSecret","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"}}}}}}},"tags":["Authentication"],"requestBody":{"content":{"application/json":{"schema":{"required":["apiSecret","payload"],"type":"object","properties":{"apiSecret":{"type":"string","description":"Секрет API мерчанта"},"payload":{"type":"object","description":"Тело целевого запроса (объект JSON)"}}}}},"required":true}}}}}
```
