LibatiFX merchant API
The merchant API lets your own server do what you do in the app: reprice and pause ads, follow orders, chat, mark paid and release escrow. Webhooks tell your server about order changes as they happen.
Trading stays free. Every rule of the app still applies through the API: limits, risk checks, purchase holds, the pause after a security change and the dispute process.
1. Keys
Create keys in Settings › Merchant API (/settings/api). You need a verified identity (Tier 1)
and two-factor authentication (an authenticator app or a passkey). You confirm each new key with it.
Each key has:
- Key ID:
lfx_followed by 16 hex characters. It is not secret. - Secret: shown once when the key is created. Keep it only on your server. If you lose it, revoke the key and create a new one.
- Scopes: what the key may do.
| Scope | Allows |
|---|---|
read |
Your account, balances, ads, orders and order chat |
ads |
Post ads; change price, limits, terms; pause, resume, close |
orders |
Send chat messages, mark paid and cancel (as the buyer) |
release |
Release escrow on paid orders |
- IP addresses: optional, but strongly recommended. When set, requests from any other address are refused.
- Expiry: 30, 90 or 365 days, or never.
A key with the release scope:
- must list your server's IP addresses;
- must have a daily release limit in US dollars (up to $50,000), counted over any 24 hours;
- must expire within 90 days;
- stops releasing if two-factor authentication is switched off on the account.
You can have 5 active keys. Locking your account or resetting your password revokes every key. A key never carries staff powers, even on a staff account.
2. Signing requests
Base URL: https://libatifx.com/api/v1/merchant-api
Every request carries three headers:
| Header | Value |
|---|---|
x-lfx-key |
Your key ID |
x-lfx-timestamp |
The current time in milliseconds since 1970 (13 digits) |
x-lfx-signature |
Hex HMAC-SHA256 of the string below, keyed with your secret |
The signed string is four lines joined by \n:
<timestamp>
<METHOD>
<path with query string, e.g. /api/v1/merchant-api/orders?status=PAID>
<exact request body, or nothing for GET>
Rules:
- The timestamp must be within 30 seconds of our clock. Keep your server's clock synced (NTP).
- Each signed request is accepted once. Retry with a new timestamp and signature.
- Send JSON bodies with
content-type: application/json, and sign the exact bytes you send.
Node.js
import { createHmac } from 'node:crypto';
const BASE = 'https://libatifx.com';
const KEY_ID = process.env.LFX_KEY_ID;
const SECRET = process.env.LFX_SECRET;
async function lfx(method, path, body) {
const url = `/api/v1/merchant-api${path}`;
const payload = body === undefined ? '' : JSON.stringify(body);
const ts = String(Date.now());
const sig = createHmac('sha256', SECRET).update(`${ts}\n${method}\n${url}\n${payload}`).digest('hex');
const res = await fetch(BASE + url, {
method,
headers: { 'x-lfx-key': KEY_ID, 'x-lfx-timestamp': ts, 'x-lfx-signature': sig, ...(payload ? { 'content-type': 'application/json' } : {}) },
body: payload || undefined,
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.error.code}: ${data.error.message}`);
return data;
}
const paid = await lfx('GET', '/orders?status=PAID&role=SELLER');
Python
import hashlib, hmac, json, os, time, requests
BASE = "https://libatifx.com"
KEY_ID, SECRET = os.environ["LFX_KEY_ID"], os.environ["LFX_SECRET"].encode()
def lfx(method, path, body=None):
url = f"/api/v1/merchant-api{path}"
payload = "" if body is None else json.dumps(body, separators=(",", ":"))
ts = str(int(time.time() * 1000))
sig = hmac.new(SECRET, f"{ts}\n{method}\n{url}\n{payload}".encode(), hashlib.sha256).hexdigest()
headers = {"x-lfx-key": KEY_ID, "x-lfx-timestamp": ts, "x-lfx-signature": sig}
if payload:
headers["content-type"] = "application/json"
r = requests.request(method, BASE + url, data=payload or None, headers=headers, timeout=15)
r.raise_for_status()
return r.json()
3. Endpoints
| Method and path | Scope | What it does |
|---|---|---|
GET /account |
read | Your account, advertiser level, and this key (with releasedTodayUsd) |
GET /balances |
read | Wallet balances (available, in escrow, on hold) |
GET /ads |
read | Your ads |
POST /ads |
ads | Post an ad (same fields as the app) |
PATCH /ads/:id |
ads | Change an ad: price, marginBps, minQuoteAmount, maxQuoteAmount, availableBaseAmount, status (ACTIVE, PAUSED, CLOSED), terms and taker conditions |
GET /orders |
read | Your orders. Query: status (OPEN, ESCROWED, PAID, RELEASED, …), role (BUYER, SELLER), limit (up to 200) |
GET /orders/:id |
read | One order (ID or short code), with the buyer's payment details and timeline |
GET /orders/:id/messages |
read | The order chat |
POST /orders/:id/messages |
orders | Send a chat message: { "body": "..." } |
POST /orders/:id/paid |
orders | As the buyer: { "payerName": "...", "paymentReference": "..." } |
POST /orders/:id/cancel |
orders | As the buyer: { "reasonCode": "...", "reason": "..." } |
POST /orders/:id/release |
release | As the seller, on a paid order: releases the escrow |
Only release after you have confirmed the money is in your own account, from the name on the order. Never release because of a screenshot, a chat message or a webhook alone.
Limits and errors
- 10 reads and 5 writes per second per key.
- Errors use the app's format:
{ "error": { "code": "SCOPE_REQUIRED", "message": "...", "details": ... } }.
| Code | Meaning |
|---|---|
API_KEY_REQUIRED |
A signing header is missing |
STALE_TIMESTAMP |
The timestamp is more than 30 s away from our clock |
BAD_API_KEY |
Unknown, revoked or expired key |
BAD_SIGNATURE |
The signature does not match the request |
REPLAYED |
This exact signed request was already used |
IP_NOT_ALLOWED |
The request came from an address that is not on the key's list |
SCOPE_REQUIRED |
The key lacks the scope |
API_RELEASE_LIMIT |
The release would pass the key's daily limit; release it in the app |
RATE_LIMITED |
Too many requests this second |
4. Webhooks
Add up to 3 webhook addresses in Settings › Merchant API. They must be public https://
addresses on port 443. The signing secret (whsec_…) is shown once.
Events
| Event | When |
|---|---|
order.created |
An order was opened on your ad, or you opened one |
order.paid |
The buyer marked the order paid |
order.released |
Escrow was released, in full or in part |
order.cancelled |
The order was cancelled |
order.expired |
The buyer did not pay in time |
order.disputed |
A dispute was opened |
order.dispute_closed |
A dispute was settled, withdrawn or decided |
order.message |
A chat message from the other trader or from support |
order.updated |
Anything else: cancel requests, extra time, wrong amounts, reopened orders |
We send a POST with a JSON body:
{
"id": "evt_6c1d7c1e-…",
"type": "order.paid",
"createdAt": "2026-10-14T12:00:00.000Z",
"data": {
"orderId": "…", "shortCode": "K7Q2M9XP", "status": "PAID", "kind": "BUYER_MARKED_PAID",
"role": "SELLER", "actor": "COUNTERPARTY", "offerId": "…",
"baseAsset": "USDT", "quoteAsset": "NGN", "baseAmount": "100", "quoteAmount": "154000", "price": "1540",
"paymentMethodCode": "NG_BANK", "settlementMode": "OFF_PLATFORM",
"expiresAt": "…", "paidAt": "…", "releaseDueAt": "…",
"details": { "payerName": "…", "paymentReference": "…" }
}
}
role is your side of the order. actor says who acted: YOU, COUNTERPARTY, STAFF or SYSTEM.
order.message adds message (id, kind, body, attachment, createdAt). Payment details
are not in webhooks: fetch the order with the API.
Headers:
| Header | Value |
|---|---|
x-lfx-webhook-signature |
t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<raw body>" with your webhook secret> |
x-lfx-webhook-id |
The event ID (the same on every retry: use it to ignore duplicates) |
x-lfx-webhook-event |
The event type |
Checking the signature (Node.js)
import { createHmac, timingSafeEqual } from 'node:crypto';
function verify(rawBody, header, secret) {
const m = /^t=(\d+),v1=([0-9a-f]{64})$/.exec(header ?? '');
if (!m) return false;
if (Math.abs(Date.now() / 1000 - Number(m[1])) > 300) return false; // older than 5 minutes
const expected = createHmac('sha256', secret).update(`${m[1]}.${rawBody}`).digest();
return timingSafeEqual(expected, Buffer.from(m[2], 'hex'));
}
Delivery
- Answer with any
2xxstatus within 10 seconds. Do slow work after answering. - Failed deliveries are retried after 1, 5 and 30 minutes, then 2, 6, 12 and 24 hours (8 tries).
- Events for one address are sent oldest first, but treat a webhook as a hint: fetch the order before acting on it.
- After 10 events in a row fail every retry, the webhook is switched off and you are alerted. Switch it back on in Settings once your server is fixed.
- The last 50 deliveries, with errors, are listed in Settings, where you can resend failed ones
and send a test (
ping) event.
5. Keeping it safe
- Give each key only the scopes it needs. Use a separate key without
releasefor pricing bots. - Keep secrets in environment variables or a secrets manager, never in code or chat.
- If a secret may have leaked, revoke the key at once in Settings, then create a new one.
- Every new key and webhook is announced by email and in the app. If you did not create it, lock your account from the link in that message.