Before you start
- API root:
https://staging.app.aile.tech/api/base/v1 - Network: Base mainnet, chain ID
8453. Staging trades real assets under small limits. - Authentication:
Authorization: Bearer <AILE_API_KEY>. Aile issues the key; keep it on your backend.GET /quoteneeds it, the other routes do not. Get an API key. - Amounts are strings in base units. USDC has 6 decimals, IDRX 2.
- A quote is valid for about 30 seconds and pinned to one taker address: the address that will send the fill and receive the bought token. Decide that address before you ask.
1
Read the deployment
config is public and cacheable for 60 s. tokens are the deployment’s tokens, bookTokens the ones
added since; both carry address and decimals. Which pairs are actually quoted is a question for
/levels, or simply ask for a quote.2
Read indicative prices (optional)
GET /levels answers every quoted direction in one call, with no key, cacheable for a few seconds. Use
it to decide whether to route through Aile and at what size; it never signs or reserves anything.firmQuoted: false will not give a quote right now; treat it as absent.3
Get a quote
The full schema is in the reference. Problems come back as RFC 7807 JSON
with a machine-readable
reason; the catalogue is in the API overview.4
Approve and fill
buyAmount or reverts. It uses about 120k gas. If it
reverts with OrderExpired, the 30 s passed: request a new quote. BitInvalidatedOrder means this quote
was already filled; a quote fills once.5
Verify what arrived
Read the receipt’s Optionally,
Transfer logs of the bought token to the taker and compare with buyAmount:GET /orders/{orderHash} reports the gateway’s view of the same fill once indexed
(orderHash is the EIP-712 hash of quote.order).