Authentication Overview
All Bitnob API requests must include an HMAC-SHA256 signature. This ensures that each request is:
Authentic: sent by you and not forged
Integrity-protected: payload cannot be altered in transit
Replay-resistant: each request can only be used once
Even if you’ve never integrated an API before, following these steps will get you signing requests in under 10 minutes.
1. Get your credentials
Before you begin, log in to the Bitnob Dashboard. Under API Settings, you will see:
Client ID
Secret (keep this private—never commit it to source control)
These two values uniquely identify your application and allow you to sign requests.
2. How it works
Every time you send an HTTP request:
You assemble a signing string from request details.
You compute an HMAC-SHA256 digest of that string using your secret.
You Base64-encode the digest and send it along with metadata in HTTP headers.
Bitnob validates the signature before processing your request.
3. Required HTTP headers
Include all four headers on every signed request:
Header | Value |
---|---|
x-auth-client | Your Client ID |
x-auth-timestamp | Unix epoch time in milliseconds (e.g. 1700000000000 ) |
x-auth-nonce | A new UUID v4 per request (e.g. 550e8400-… ) |
x-auth-signature | Base64-encoded HMAC-SHA256 signature |
4. Building the signing string
Concatenate, in this exact order and with no separators:
clientId + HTTP_METHOD + request_path + timestamp + request_body
clientId: your Client ID string.
HTTP_METHOD: uppercase method, for example POST or GET.
request_path: the path and query (for example /v1/utilities/airtime)
timestamp: the same value sent in x-auth-timestamp
request_body: the raw JSON payload, or empty string ('') for no body
5. Computing the signature
Create an HMAC-SHA256 instance using your secret.
Feed the signing string into the HMAC.
Compute the digest (binary).
Base64-encode the digest.
This final Base64 string is your x-auth-signature.
6. Example: Node.js
const signature = generateSignature(clientId, secret, method, path, timestamp, body);
console.log('x-auth-signature:', signature);
7. Full Example Request
Content-Type must be application/json.
Ensure your clock is accurate within ±5 minutes of UTC.
8. Error responses
HTTP Status | Error Code | Meaning |
---|---|---|
401 | AUTH_INVALID_SIGNATURE | Signature missing or does not match expected |
403 | AUTH_EXPIRED | x-auth-timestamp is too old or too far in the future |
403 | AUTH_REPLAYED_NONCE | x-auth-nonce was already used |
429 | RATE_LIMIT_EXCEEDED | Too many requests for this client |
Each error returns a JSON body:
9. Troubleshooting
Invalid signature
Confirm your secret matches the one in the Dashboard
Verify you included the raw JSON body—no added whitespace or line breaks
Ensure your timestamp and nonce headers match exactly the values used to compute the signature
Expired timestamp
Check your system clock
Sync via NTP or use a time-service library in your language
Replayed nonce
Generate a new UUID for every request
Do not reuse or hard-code the nonce value