Swap API quickstart
This walks through the whole flow against the sandbox
(https://public-api.demo.alphax.asia). Set your key once:
1. Onboard a company onto swap
products defaults to ["Card"] when omitted — send ["Swap"] explicitly.
Requesting a product you are not entitled to returns 403 PRODUCT_NOT_ENABLED.
The response carries the company id and a swap block:
Export the company id — it is the X-Company-Id header on every call below.
2. Get the company verified
Send the director to kycUrl, or embed it in your own site — see the
Verification page. You can re-read it any time:
Show tosUrl too — the company must accept the terms before it can be endorsed,
and tosAccepted tells you whether that is still outstanding.
Wait for kycStatus to reach approved — company.kyc_status_changed tells you
the moment it does, so you do not need to poll.
3. Open a payment route
On-ramp (fiat in, stablecoin out)
Off-ramp (stablecoin in, fiat out)
Destination bank fields for off-ramp
Which fields are required depends on the currency and rail you pick. A rail that
does not belong to the currency is rejected with a destinationPaymentRail
validation error.
accountOwnerName, bankName, addressLine1, city and postalCode are
always required.
4. Tell the payer where to send funds
depositAddress is the short answer to “where does the payer send money” — the
deposit account number for an on-ramp, the chain address for an off-ramp. The
source and destination blocks carry the full detail; each is either
type: "bank" or type: "crypto", so branch on that rather than on currency.
Two PDFs are available for the customer’s bank or counterparty:
Both return { "url": "…" }. The link is short-lived — fetch it when the
customer asks rather than storing it.
5. Follow the money
Every item is a discriminated union — switch on type, then read data:
transaction is identical for every product; data is specific to type. On
GET /v1/transactions you may also see Card, PaymentAcceptance and
Account.
All three listings accept page, limit (5–50), type (Credit / Debit),
orderBy (createdAt / amount) and orderDirection (ASC / DESC), and
default to newest first.

