> 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/eng/api/authentication.md).

# Authentication

Get CF-ACCESS-SIGN before calling POST methods.

Generating a signature for signed requests.

## Get CF-ACCESS-SIGN signature

> \
> Generates an HMAC-SHA256 signature for the request body. Use this before calling signed POST/GET methods via GitBook's \*\*Test it\*\*.\
> \
> \*\*Algorithm:\*\*\
> 1\. \`body\` = JSON built from \`payload\` (keys sorted, no spaces, UTF-8)\
> 2\. \`signature\` = Base64(HMAC-SHA256(apiSecret, body))<br>

```json
{"openapi":"3.1.1","info":{"title":"API","version":"v1"},"tags":[{"name":"Authentication","description":"Generating a signature for signed requests."}],"servers":[{"url":"https://api.esimpay.net/api/v1"}],"paths":{"/customer/sign":{"post":{"operationId":"get_access_sign","summary":"Get CF-ACCESS-SIGN signature","description":"\nGenerates an HMAC-SHA256 signature for the request body. Use this before calling signed POST/GET methods via GitBook's **Test it**.\n\n**Algorithm:**\n1. `body` = JSON built from `payload` (keys sorted, no spaces, UTF-8)\n2. `signature` = Base64(HMAC-SHA256(apiSecret, body))\n","responses":{"200":{"description":"Signature generated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"body":{"type":"string","description":"Canonical JSON body for signing"},"signature":{"type":"string","description":"Base64 HMAC-SHA256"},"header":{"type":"object","properties":{"CF-ACCESS-SIGN":{"type":"string"}}}}}}}},"400":{"description":"Invalid payload","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"}}}}}},"401":{"description":"Invalid 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":"Merchant API secret"},"payload":{"type":"object","description":"Target request body (JSON object)"}}}}},"required":true}}}}}
```
