Skip to main content

About Gateway

Add trading to your app through the API. You create a user for each of your customers, and your servers place orders on their behalf from that user's own wallets. If you want to trade your own account from code, use the Trading API.

Real funds

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​

Your app
Your organization
API key from the developer console
You keep your own login and customer records. Your customers never sign in to True Markets.
Your users
cust_7781SOLEVM
cust_7782SOLEVM
cust_7783SOLEVM
Your own ids. Each user gets a Solana and an EVM wallet when you create it.
True Markets
Gateway
orders · transfers
balances · transactions
You call it. We run the wallets and the trades.
What they can trade
Crypto, stablecoins and tokenized stocks
The catalog lists every asset.

Every wallet transaction needs two signatures: yours, made with 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.

Place an order for a user, sign the payloads, execute
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.

Your serverTrue Markets
Sign inwith organization API key
Sign {key_id}.{timestamp}POST /v1/auth/api-key/token
Organization tokenlasts one hour, no refresh token
Place the orderwith token + TM-On-Behalf-Of
Create the order for a userPOST /v1/gateway/orders
Unsigned payloadsone wallet transaction each
Sign and executewith signer key
Stamp each payloadstays on your server
Execute with the signaturesPOST /v1/gateway/orders/{id}/execute
Order statuscomplete, or pending until final

What you can build​

Start building​

You can also create a test user on the console's Users page and look at its wallets before you write any code.