---
title: "About Gateway"
url: https://docs.truemarkets.co/gateway
description: "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."
---

Docs index: https://docs.truemarkets.co/llms.txt

# 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](https://docs.truemarkets.co/trading-api).

[Open the developer console](https://console.truemarkets.co/)[Getting started · about 15 min](https://docs.truemarkets.co/gateway/quickstart)

> **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.

[GET /assets](https://docs.truemarkets.co/gateway/what-you-can-trade)

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.

-   TypeScript
-   Python
-   curl

Place an order for a user, sign the payloads, execute

```typescript
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,
);
```

Place an order for a user, sign the payloads, execute

```python
for_user = {"TM-On-Behalf-Of": user_id}

order = post(
    "/v1/gateway/orders",
    {
        "asset_id": asset_id,
        "qty": "2",
        "qty_unit": "quote",
        "side": "buy",
        "type": "market",
    },
    for_user,
)

signatures = [stamp(p["payload"]) for p in order["payloads"]]

post(
    f"/v1/gateway/orders/{order_id}/execute",
    {
        "signatures": signatures,
        "auth_type": "api_key",
    },
    for_user,
)
```

Place an order for a user, sign the payloads, execute

```bash
curl -s -X POST https://api.truemarkets.co/v1/gateway/orders \
  -H "Authorization: Bearer $ORG_TOKEN" \
  -H "TM-On-Behalf-Of: $USER_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "asset_id": "'"$ASSET_ID"'",
    "qty": "2",
    "qty_unit": "quote",
    "side": "buy",
    "type": "market"
  }'

# $SIGNATURES is the JSON array your code signed

curl -s -X POST https://api.truemarkets.co/v1/gateway/orders/$ORDER_ID/execute \
  -H "Authorization: Bearer $ORG_TOKEN" \
  -H "TM-On-Behalf-Of: $USER_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "signatures": '"$SIGNATURES"',
    "auth_type": "api_key"
  }'
```

`post()` sends your organization token. `stamp()` signs a payload with your signer key. [Getting started](https://docs.truemarkets.co/gateway/quickstart) 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

- [Trading in your app](https://docs.truemarkets.co/gateway/place-orders): Your customers buy and sell without leaving your app.
- [Automated strategies](https://docs.truemarkets.co/gateway/signing-keys): Your servers place orders for each customer and sign them with one signer key you hold.
- [Stablecoin transfers](https://docs.truemarkets.co/gateway/send-funds): Send funds from a user's wallet to any address on the same chain.

## Start building

- [Getting started](https://docs.truemarkets.co/gateway/quickstart): Create a user, fund their wallet and place a trade for them.
- [How requests and signing work](https://docs.truemarkets.co/gateway/requests-and-signing): The two keys, and what each one signs.
- [Gateway FAQs](https://docs.truemarkets.co/gateway/faq): Short answers to the questions teams ask first.

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