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.