Connect your ERP, CRM, accounting system, website or mobile back end to ExilTrade. Enquiries customers send to your business arrive in your system automatically, you can reply from your system, and you can send enquiries to other ExilTrade businesses.
Base URL
https://api.exiltrade.com/api/v1/integration
Authentication
Header X-Api-Key: <your API key>
Format
JSON (UTF-8). All times are UTC, ISO 8601 (2026-11-21T09:30:00Z)
Polling limit
Each list (received / sent) once every 5 minutes per API key
Prefix · 16 characters, safe to show (the panel displays exb_3f9a1c2b7d4e_••••••••)Secret · 40 characters, shown once, keep private57 characters in totalExample only. Not a working key.
One API key belongs to one ExilTrade account and covers every business that account owns.
2How syncing works
The list endpoints return enquiries that changed since your last call: new enquiries, new replies in the conversation and status changes. Each response contains a nextCursor. Save it and send it back on the next call.
text
first run: GET /enquiries/received -> enquiries + nextCursor "A"
5 min later: GET /enquiries/received?cursor=A -> only what changed since A + nextCursor "B"
5 min later: GET /enquiries/received?cursor=B -> ...
Rules for a correct sync:
Upsert by enquiryId. The same enquiry is returned again every time it changes (new reply, status change). Insert it if new, otherwise replace your copy, including the full conversation list.
Save nextCursor only after you have stored the enquiries from that response. If your process crashes before that, the next call with the old cursor returns the same changes again.
hasMore: true means more changes are waiting (for example on the first run). Call again immediately with the new nextCursor; continuation calls are not limited by the 5-minute rule. Keep going until hasMore is false, then wait until nextPollAfter.
Keep one cursor per list (received and sent) and the same status filter for the whole sync. To download everything again, call without a cursor.
When nothing changed, enquiries is empty and nextCursor is the cursor you sent.
3Limits
What
Limit
When exceeded
GET /enquiries/received
1 call per 5 minutes per API key. Continuation pages (using nextCursor after hasMore: true) are exempt.
429POLL_TOO_SOON with a Retry-After header and nextPollAfter
GET /enquiries/sent
1 call per 5 minutes per API key, counted separately from received
Same
All other endpoints
60 per minute per API key
429TOO_MANY_REQUESTS
Page size (limit)
1–100, default 50
400
A rejected call does not reset the 5-minute window, and a call with invalid parameters (400) does not use it up. Always honour the Retry-After header (seconds) instead of retrying in a loop.
4Endpoints
All requests need the header X-Api-Key. Request bodies are JSON (Content-Type: application/json). Every response has success and code; errors also have message.
{
"success": false,
"code": "POLL_TOO_SOON",
"message": "This list can be fetched once every 5 minutes. Try again after nextPollAfter.",
"retryAfterSeconds": 212,
"nextPollAfter": "2026-11-21T09:35:00Z"
}
GET/enquiries/{enquiryId}One enquiry
Any enquiry you sent or received. Use it to refresh a single enquiry, for example after a reply. Not limited by the 5-minute rule. Response: { "success": true, "code": "ENQUIRY_FOUND", "enquiry": { … } }.
POST/enquiriesSend an enquiry to a business
JSON
{
"businessId": 2,
"subject": "Bulk order: Dell Latitude 5420",
"message": "Please quote for 20 units, delivery to Pune.",
"products": [ { "productId": 30066, "quantity": 20 } ]
}
Field
Rules
businessId
Required. A published ExilTrade business.
subject
Optional, up to 300 characters.
message
Required, up to 10,000 characters.
products
Optional list. Each productId must be a published product of that business, with no duplicates; quantity must be greater than 0 if given.
Optional header Idempotency-Key (1–100 visible ASCII characters, for example a UUID or your own order number). If the same key is sent again within 24 hours, no second enquiry is created: the first one is returned with code ENQUIRY_ALREADY_CREATED. Use it whenever you might retry after a timeout.
Response 201 (200 for a repeated Idempotency-Key):
POST/enquiries/{enquiryId}/repliesReply in the conversation
JSON
{ "message": "Thank you. 20 units are in stock; price ₹28,500 each, delivery in 5 days." }
Works for enquiries you received (you reply as the vendor and the customer is emailed) and enquiries you sent (you reply as the customer). Not possible on closed or cancelled enquiries (409 ENQUIRY_CLOSED). Response 200 with the updated enquiry.
POST/enquiries/{enquiryId}/cancelCancel a received enquiry
JSON
{ "message": "Sorry, this model is discontinued." }
Only for enquiries your business received. message is optional; the customer is emailed. Response 200 with the updated enquiry.
The same Idempotency-Key is still being processed. Retry after a few seconds.
429
POLL_TOO_SOON
List called within 5 minutes. Wait Retry-After seconds.
429
TOO_MANY_REQUESTS
More than 60 calls per minute. Wait and retry.
500
SERVER_ERROR
Temporary problem. Retry with a delay; for creates, reuse the same Idempotency-Key.
7Security checklist
Call the API only from your server. Never put the API key in a browser app, a mobile app or any code users can download. Anyone who has the key can read your enquiries and your customers' contact details. Front ends (React, Angular, mobile) must go through your own back end.
Store the key in a secret store or environment variable, never in source control.
Always use https://.
If the key may have leaked, generate a new one at once (the old one stops working) and check the call log on the Integrations page.
Customer names, emails and phone numbers you receive are personal data: use them only to handle the enquiry and protect them in your system.
8Code samples
Every sample does the same thing: load the saved cursor, fetch received enquiries, store them, follow hasMore, save the cursor, wait until nextPollAfter, repeat. Replace the storage parts with your own database code.
.NET 6 or later, no extra packages. Register with builder.Services.AddHostedService<ExilTradeSyncWorker>() and set ExilTrade:ApiKey in user-secrets or environment variables.
C#
using System.Net;
using System.Net.Http.Json;
using System.Text.Json;
public sealed class ExilTradeClient
{
public static readonly JsonSerializerOptions Json = new(JsonSerializerDefaults.Web);
private readonly HttpClient _http;
public ExilTradeClient(HttpClient http, string apiKey)
{
_http = http;
_http.BaseAddress = new Uri("https://api.exiltrade.com/api/v1/integration/");
_http.DefaultRequestHeaders.Add("X-Api-Key", apiKey);
_http.Timeout = TimeSpan.FromSeconds(60);
}
/// <summary>Returns the page, or the time to wait when the API answers 429.</summary>
public async Task<(EnquiryPage? Page, TimeSpan? RetryAfter)> GetReceivedAsync(
string? cursor, CancellationToken ct)
{
var url = "enquiries/received?limit=100" +
(cursor is null ? "" : "&cursor=" + Uri.EscapeDataString(cursor));
using var response = await _http.GetAsync(url, ct);
if (response.StatusCode == HttpStatusCode.TooManyRequests)
return (null, response.Headers.RetryAfter?.Delta ?? TimeSpan.FromMinutes(5));
response.EnsureSuccessStatusCode();
return (await response.Content.ReadFromJsonAsync<EnquiryPage>(Json, ct), null);
}
public async Task ReplyAsync(long enquiryId, string message, CancellationToken ct)
{
using var response = await _http.PostAsJsonAsync(
$"enquiries/{enquiryId}/replies", new { message }, Json, ct);
response.EnsureSuccessStatusCode();
}
public async Task<long> CreateEnquiryAsync(
object request, string idempotencyKey, CancellationToken ct)
{
using var message = new HttpRequestMessage(HttpMethod.Post, "enquiries")
{
Content = JsonContent.Create(request, options: Json)
};
message.Headers.Add("Idempotency-Key", idempotencyKey);
using var response = await _http.SendAsync(message, ct);
response.EnsureSuccessStatusCode();
var created = await response.Content.ReadFromJsonAsync<JsonElement>(Json, ct);
return created.GetProperty("enquiryId").GetInt64();
}
}
public sealed class ExilTradeSyncWorker : BackgroundService
{
private readonly ExilTradeClient _client;
private readonly ILogger<ExilTradeSyncWorker> _logger;
public ExilTradeSyncWorker(IConfiguration config, ILogger<ExilTradeSyncWorker> logger)
{
_client = new ExilTradeClient(new HttpClient(), config["ExilTrade:ApiKey"]!);
_logger = logger;
}
protected override async Task ExecuteAsync(CancellationToken ct)
{
string? cursor = await LoadCursorAsync(); // your storage
while (!ct.IsCancellationRequested)
{
TimeSpan wait;
try
{
var (page, retryAfter) = await _client.GetReceivedAsync(cursor, ct);
if (page is null)
{
wait = retryAfter!.Value; // 429: obey Retry-After
}
else
{
foreach (var enquiry in page.Enquiries)
await UpsertEnquiryAsync(enquiry); // insert or replace by EnquiryId
cursor = page.NextCursor;
await SaveCursorAsync(cursor); // only after storing
wait = page.HasMore
? TimeSpan.Zero // continuation: fetch now
: page.NextPollAfter - DateTimeOffset.UtcNow;
}
}
catch (Exception ex) when (ex is HttpRequestException or TaskCanceledException && !ct.IsCancellationRequested)
{
_logger.LogWarning(ex, "ExilTrade sync failed; retrying in 5 minutes.");
wait = TimeSpan.FromMinutes(5);
}
if (wait > TimeSpan.Zero)
await Task.Delay(wait + TimeSpan.FromSeconds(2), ct);
}
}
// Replace with your database code.
private Task<string?> LoadCursorAsync() => Task.FromResult<string?>(null);
private Task SaveCursorAsync(string? cursor) => Task.CompletedTask;
private Task UpsertEnquiryAsync(Enquiry enquiry)
{
_logger.LogInformation("Enquiry {Id} ({Status}) from {Customer}",
enquiry.EnquiryId, enquiry.StatusName, enquiry.Customer?.Name);
return Task.CompletedTask;
}
}
public record EnquiryPage(bool Success, string Code, int Count, bool HasMore, string? NextCursor,
DateTimeOffset NextPollAfter, int PollIntervalSeconds, List<Enquiry> Enquiries);
public record Enquiry(long EnquiryId, string Direction, int Status, string StatusName, string? Subject,
string Message, DateTimeOffset CreatedAt, DateTimeOffset? UpdatedAt, DateTimeOffset LastActivityAt,
Business Business, Customer? Customer, List<EnquiryProduct> Products, List<Reply> Conversation);
public record Business(long BusinessId, string Name, string? Slug);
public record Customer(long? UserId, string? Name, string? Email, string? Mobile);
public record EnquiryProduct(long ProductId, string Name, string? Sku, string? Slug, decimal? Quantity);
public record Reply(long ResponseId, string From, string? SenderName, string Message, DateTimeOffset CreatedAt);
Java 11+ (java.net.http) with Jackson (com.fasterxml.jackson.core:jackson-databind).
Java
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.net.URI;
import java.net.URLEncoder;
import java.net.http.*;
import java.nio.charset.StandardCharsets;
import java.time.*;
public class ExilTradeSync {
private static final String BASE = "https://api.exiltrade.com/api/v1/integration";
private final HttpClient http = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(20)).build();
private final ObjectMapper json = new ObjectMapper();
private final String apiKey = System.getenv("EXILTRADE_API_KEY");
public static void main(String[] args) throws Exception {
new ExilTradeSync().run();
}
void run() throws Exception {
String cursor = loadCursor(); // your storage
while (true) {
Duration wait;
try {
String url = BASE + "/enquiries/received?limit=100"
+ (cursor == null ? "" : "&cursor=" + URLEncoder.encode(cursor, StandardCharsets.UTF_8));
HttpRequest request = HttpRequest.newBuilder(URI.create(url))
.header("X-Api-Key", apiKey)
.timeout(Duration.ofSeconds(60))
.GET().build();
HttpResponse<String> response = http.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() == 429) {
long seconds = response.headers().firstValueAsLong("Retry-After").orElse(300);
wait = Duration.ofSeconds(seconds);
} else if (response.statusCode() == 200) {
JsonNode page = json.readTree(response.body());
for (JsonNode enquiry : page.get("enquiries")) {
upsertEnquiry(enquiry); // insert or replace by enquiryId
}
cursor = page.path("nextCursor").isNull() ? cursor : page.get("nextCursor").asText();
saveCursor(cursor); // only after storing
wait = page.get("hasMore").asBoolean()
? Duration.ZERO
: Duration.between(Instant.now(), Instant.parse(page.get("nextPollAfter").asText()));
} else {
System.err.println("ExilTrade error " + response.statusCode() + ": " + response.body());
wait = Duration.ofMinutes(5);
}
} catch (java.io.IOException e) {
System.err.println("Network error: " + e.getMessage());
wait = Duration.ofMinutes(5);
}
if (!wait.isNegative() && !wait.isZero()) Thread.sleep(wait.plusSeconds(2).toMillis());
}
}
public void reply(long enquiryId, String message) throws Exception {
String body = json.writeValueAsString(java.util.Map.of("message", message));
HttpRequest request = HttpRequest.newBuilder(URI.create(BASE + "/enquiries/" + enquiryId + "/replies"))
.header("X-Api-Key", apiKey)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body)).build();
HttpResponse<String> response = http.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() != 200) throw new IllegalStateException(response.body());
}
// Replace with your database code.
String loadCursor() { return null; }
void saveCursor(String cursor) { }
void upsertEnquiry(JsonNode e) {
System.out.printf("Enquiry %d (%s) from %s%n", e.get("enquiryId").asLong(),
e.get("statusName").asText(), e.path("customer").path("name").asText());
}
}
Node 18+ (built-in fetch), no packages needed.
JavaScript
// exiltrade-sync.mjs run: EXILTRADE_API_KEY=exb_... node exiltrade-sync.mjs
const BASE = 'https://api.exiltrade.com/api/v1/integration';
const headers = { 'X-Api-Key': process.env.EXILTRADE_API_KEY };
const sleep = (ms) => new Promise((r) => setTimeout(r, Math.max(0, ms)));
async function getReceived(cursor) {
const url = new URL(`${BASE}/enquiries/received`);
url.searchParams.set('limit', '100');
if (cursor) url.searchParams.set('cursor', cursor);
const res = await fetch(url, { headers, signal: AbortSignal.timeout(60_000) });
if (res.status === 429) {
return { retryAfterMs: Number(res.headers.get('retry-after') ?? 300) * 1000 };
}
if (!res.ok) throw new Error(`ExilTrade ${res.status}: ${await res.text()}`);
return { page: await res.json() };
}
export async function reply(enquiryId, message) {
const res = await fetch(`${BASE}/enquiries/${enquiryId}/replies`, {
method: 'POST',
headers: { ...headers, 'Content-Type': 'application/json' },
body: JSON.stringify({ message }),
});
if (!res.ok) throw new Error(`ExilTrade ${res.status}: ${await res.text()}`);
return (await res.json()).enquiry;
}
export async function createEnquiry(body, idempotencyKey) {
const res = await fetch(`${BASE}/enquiries`, {
method: 'POST',
headers: { ...headers, 'Content-Type': 'application/json', 'Idempotency-Key': idempotencyKey },
body: JSON.stringify(body),
});
if (!res.ok) throw new Error(`ExilTrade ${res.status}: ${await res.text()}`);
return (await res.json()).enquiryId;
}
// Replace with your database code.
async function loadCursor() { return null; }
async function saveCursor(cursor) {}
async function upsertEnquiry(e) {
console.log(`Enquiry ${e.enquiryId} (${e.statusName}) from ${e.customer?.name}`);
}
let cursor = await loadCursor();
for (;;) {
let waitMs;
try {
const { page, retryAfterMs } = await getReceived(cursor);
if (!page) {
waitMs = retryAfterMs; // 429: obey Retry-After
} else {
for (const e of page.enquiries) await upsertEnquiry(e);
cursor = page.nextCursor;
await saveCursor(cursor); // only after storing
waitMs = page.hasMore ? 0 : new Date(page.nextPollAfter).getTime() - Date.now();
}
} catch (err) {
console.error('ExilTrade sync failed:', err.message);
waitMs = 5 * 60_000;
}
await sleep(waitMs + 2000);
}
The API key must never reach the browser. React talks to your back end; your back end talks to ExilTrade. Usually the Node.js (or .NET / Java) worker saves enquiries into your database and your React screens read your own API. For a quick Next.js start without a database, this server-side route handler keeps the key in an environment variable and caches the list so the 5-minute limit is respected.
TypeScript
// app/api/exiltrade/enquiries/route.ts (server only; set EXILTRADE_API_KEY in .env.local)
import { NextResponse } from 'next/server';
const BASE = 'https://api.exiltrade.com/api/v1/integration';
type Enquiry = { enquiryId: number; lastActivityAt: string; [k: string]: unknown };
const g = globalThis as unknown as { exiltrade?: { cursor?: string; nextPollAt: number; byId: Map<number, Enquiry> } };
const state = (g.exiltrade ??= { nextPollAt: 0, byId: new Map() });
async function sync() {
while (Date.now() >= state.nextPollAt) {
const url = new URL(`${BASE}/enquiries/received`);
url.searchParams.set('limit', '100');
if (state.cursor) url.searchParams.set('cursor', state.cursor);
const res = await fetch(url, { headers: { 'X-Api-Key': process.env.EXILTRADE_API_KEY! }, cache: 'no-store' });
if (res.status === 429) {
state.nextPollAt = Date.now() + Number(res.headers.get('retry-after') ?? 300) * 1000;
return;
}
if (!res.ok) throw new Error(`ExilTrade ${res.status}`);
const page = await res.json();
for (const e of page.enquiries as Enquiry[]) state.byId.set(e.enquiryId, e);
state.cursor = page.nextCursor ?? state.cursor;
state.nextPollAt = page.hasMore ? 0 : new Date(page.nextPollAfter).getTime();
if (!page.hasMore) return;
}
}
export async function GET() {
await sync();
const enquiries = [...state.byId.values()].sort((a, b) => b.lastActivityAt.localeCompare(a.lastActivityAt));
return NextResponse.json({ enquiries });
}
Client component reading your route, not ExilTrade: