# Підпис

> Як підписувати запити до YellowChanger API: заголовок Signature — це HMAC SHA256 тіла запиту з вашим приватним ключем. Приклади на JavaScript і Python.

Source: https://docs.yellowchanger.com/uk/signature

Заголовок "Signature" — це тіло, перетворене з JSON в рядок і підписане HMAC SHA256 за допомогою Private API Key.

## Приклад

**JavaScript**

```javascript
const crypto = require("crypto");
function createHmacSha256(c, a) {
          let e = Object.keys(c)
                              .map((a) => a + "=" + c[a])
                              .join("&"),
                    t = crypto.createHmac("sha256", a).update(e).digest("hex");
          return t;
}
const body = { uniq_id: "0sv0c0c02da105aa6b7fbzf1zv05444d8a0ccd4c" };
console.log(createHmacSha256(body, "Your Private Key"));
```

**Python**

```python
import hmac
import hashlib
import json

def create_hmac_sha256(data: dict, secret_key: str):
    query_string = '&'.join([f"{key}={value}" for key, value in data.items()])
    signature = hmac.new(secret_key.encode('utf-8'), query_string.encode('utf-8'), hashlib.sha256).hexdigest()
    return signature

body = { "uniq_id": "0sv0c0c02da105aa6b7fbzf1zv05444d8a0ccd4c" }
print(create_hmac_sha256(body, "Your Private Key"))

						
```

## Пов'язані сторінки

- [createTrade](https://docs.yellowchanger.com/uk/createTrade.md): Створює нову угоду та повертає інформацію про угоду
- [getInfo](https://docs.yellowchanger.com/uk/getInfo.md): Повертає всю інформацію про транзакцію
- [allRates](https://docs.yellowchanger.com/uk/allRates.md): Повертає всі можливі курси обміну

---

All methods: https://docs.yellowchanger.com/uk/introduction.md · Index: https://docs.yellowchanger.com/uk/llms.txt · Whole documentation in one file: https://docs.yellowchanger.com/uk/llms-full.txt
