API integration & attribution

Any client can call the public swap API. To attribute a swap to your partner account (so it appears in your dashboard and can earn affiliate commission when completed), send your partner API key on order creation.

Mechanism

On POST {API_BASE}/swap/create, include header:

x-navoswap-api-key: <your_partner_api_key>

The backend resolves the key to a partner record. If the partner has affiliate enabled and a commission rate set, the order stores the partner ID and commission basis points; when the order reaches completed status, commission accrues to your ledger (see Affiliate docs).

Partner attribution (swap orders)
Your backend or SDK
POST /swap/create
Header:
x-navoswap-api-key: …
Order stored with partner ID; commission basis set if affiliate is enabled
On completed: commission accrues to affiliate ledger

Never expose API keys in a browser bundle. Create orders from your server; JWT is only for partner dashboard and /partners APIs.

Official JavaScript SDK

The @navoswap/sdk package exposes NavoSwapClient. Pass apiKey in the constructor; the client automatically adds x-navoswap-api-key only on createSwapOrder (other methods are unchanged).

import { NavoSwapClient } from "@navoswap/sdk";

const client = new NavoSwapClient({
  baseUrl: "https://api.navoswap.com/api/v1",
  apiKey: process.env.NAVOSWAP_PARTNER_API_KEY,
});

const quote = await client.getSwapPrice({
  currency_from: "BTC",
  currency_to: "ETH",
  amount_from: 0.1,
});

const order = await client.createSwapOrder({
  currency_from: "BTC",
  currency_to: "ETH",
  amount_from: 0.1,
  address_to: "0x…",
  fixed: false,
});

Partner authentication (dashboard & partner APIs)

Partner account endpoints (profile, analytics, affiliate, API key rotation) use JWT bearer tokens from POST /partners/signin and refresh via POST /partners/auth/refresh. This is separate from the public swap key header.

Full route list: HTTP API overview.