Authentication
All requests to the Ledig API (except for the open /health endpoint) require authentication using API keys with HMAC signing. This ensures every request is verifiable and secure.
๐ API Keys
You can generate API keys in the Settings section of your Ledig dashboard.
Each key pair consists of:
API Key โ Public identifier (
x-ledig-key)Secret Key โ Used to generate HMAC signatures (โ ๏ธ never share or hardcode into frontend code)
๐ Generating a new key revokes the previous one and issues a new secret. Always update your integration accordingly.
๐ Required Headers
Every authenticated request must include the following headers:
x-ledig-key
Your API key (public identifier)
x-ledig-timestamp
Current UNIX timestamp (in seconds)
x-ledig-signature
HMAC-SHA256 signature generated using your secret key and request payload
๐งฎ Signature Calculation
The signature is built as follows:
timestamp โ The value sent in
x-ledig-timestampHTTP_METHOD โ
GET,POST, etc.PATH_WITH_QUERY โ The path including any query string (e.g.
/v1/rates?pair=USDT-NGN)BODY โ For
POST/PUTrequests, the raw request body. ForGET, use an empty string.
๐ Sample Payload Debug
When debugging your integration, it helps to log the signed payload string. This is the exact string your system will HMAC-sign.
Example GET request:
Example POST request:
If your signature doesnโt match, first confirm your payload string looks exactly like this.
๐ Example (cURL)
๐ป Example Code
Node.js
Python
โ ๏ธ Best Practices
Always use the server side to sign requests (never expose your secret).
Ensure your system clock is accurate (we allow a few seconds of drift).
Rotate keys periodically and delete unused ones.