For AI agents: the documentation index is at /llms.txt, and this page is available as Markdown at /gateway.md.
About Gateway
Gateway lets you offer crypto, stablecoin and tokenized stock trading to your users inside your product. You create a user for each of your customers, and your servers place orders on their behalf from that user's own wallets. To trade your own account from code, use the Trading API.
Every trade moves real funds on-chain. A first trade costs a few dollars of USDC, and we pay the network fees.
Where Gateway fits
Every wallet transaction needs two approvals: one from the signer key on that user, and ours. Neither of us can move a user's funds alone.
How a trade works
Your servers mint an organization token from your API key and send it on every call, with TM-On-Behalf-Of naming the user. Placing an order or transfer returns unsigned wallet transactions, called payloads. You sign each one with your signer key and post the signatures to execute. Nothing moves until you do.
const forUser = { "TM-On-Behalf-Of": userId };
const order = await post(
"/v1/gateway/orders",
{
asset_id: assetId,
qty: "2",
qty_unit: "quote",
side: "buy",
type: "market",
},
forUser,
);
const signatures = await Promise.all(
order.payloads.map((p) => stamp(p.payload)),
);
await post(
`/v1/gateway/orders/${orderId}/execute`,
{
signatures,
auth_type: "api_key",
},
forUser,
);post() sends your organization token. stamp() signs a payload with your signer key. Getting started defines both.
Use cases
- Neobanks: let customers buy crypto and tokenized stocks next to their cash balance.
- Fintech and payment apps: add a crypto product without building custody or exchange connections.
- Wallet apps: offer trading inside the wallet, across chains.
- Brokerages and investing apps: add crypto and tokenized stocks to an existing portfolio.
- Global apps: give users outside the US and UK access to tokenized stocks.
- AI agent platforms: let an agent trade for each of your users, from that user's own wallet.
Tokenized stocks are not offered in the US or UK.
Start building
You can also create a test user on the dashboard's Users page and look at its wallets before you write any code.
Reference
- Need help? Ask us on Discord, or email [email protected].
- See what changed in the changelog