---
title: "About Trading API"
url: https://docs.truemarkets.co/trading-api
description: "The Trading API lets you trade your own True Markets account from code, with one key that signs your requests and your orders."
---

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

# About Trading API

The Trading API lets you trade your own True Markets account from code. You create a key at [app.truemarkets.co](https://app.truemarkets.co/), and that key signs your requests and your orders. If you're building an app for your customers, read the [Gateway documentation](https://docs.truemarkets.co/gateway).

[Create an API key](https://app.truemarkets.co/settings/api-keys)[Getting started · about 10 min](https://docs.truemarkets.co/trading-api/quickstart)

> **Real funds**
> 
> Every trade moves real funds. A first trade costs a few dollars of USDC, and we pay the network fees.

## How a trade works

Your code mints a token from your key file and sends it on every call. Placing an order or transfer returns unsigned wallet transactions, called payloads. You sign each one with the same key and post the signatures to execute. Nothing moves until you do.

-   TypeScript
-   Python
-   curl

Place an order, sign the payloads, execute

```typescript
const order = await post("/v1/gateway/orders", {
  asset_id: assetId,
  qty: "2",
  qty_unit: "quote",
  side: "buy",
  type: "market",
});

const signatures = await Promise.all(
  order.payloads.map((p) => stamp(p.payload)),
);

await post(`/v1/gateway/orders/${orderId}/execute`, {
  signatures,
  auth_type: "api_key",
});
```

Place an order, sign the payloads, execute

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

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

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

Place an order, sign the payloads, execute

```bash
curl -s -X POST https://api.truemarkets.co/v1/gateway/orders \
  -H "Authorization: Bearer $TOKEN" \
  -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 $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "signatures": '"$SIGNATURES"',
    "auth_type": "api_key"
  }'
```

`post()` sends your token. `stamp()` signs a payload with your key. [Getting started](https://docs.truemarkets.co/trading-api/quickstart) defines both.

Your codeTrue Markets

Sign inwith your API key

Sign {key\_id}.{timestamp}POST /v1/auth/api-key/token

Access and refresh tokensrefresh without signing again

Place the orderwith your token

Create the orderPOST /v1/gateway/orders

Unsigned payloadsone wallet transaction each

Sign and executewith the same API key

Stamp each payloadstays on your machine

Execute with the signaturesPOST /v1/gateway/orders/{id}/execute

Order statuscomplete, or pending until final

## Trading API use cases

-   A script or bot that trades your account on a schedule or on a signal.
-   A service that reads your balances and rebalances your holdings.

## How it differs from Gateway

The Trading API and Gateway share the same endpoints, documented in the [Trading REST reference](https://docs.truemarkets.co/api/gateway/true-markets-gateway-api). What changes is whose account a request acts on.

-   **Your token acts as you.** A Gateway client adds a header to name which of its users a request is for. You never send it.
-   **Your account already exists.** You sign up at app.truemarkets.co, and the app creates your wallet when you set up a passkey, so there are no users to create.
-   **One key does both jobs.** The same key mints your tokens and signs your orders. A Gateway client holds two keys for those two jobs.
-   **You can refresh tokens.** Minting a token also returns a refresh token, so you can get a new access token without signing again.

## Get started

- [Getting started](https://docs.truemarkets.co/trading-api/quickstart): Mint a token, buy a small amount of SOL and find the fill.
- [Create your API key](https://docs.truemarkets.co/trading-api/api-key): Create your key at app.truemarkets.co and mint your first token.

## Trade

- [Funding](https://docs.truemarkets.co/trading-api/fund): Send stablecoins to your wallet, or buy with a card.
- [Place orders](https://docs.truemarkets.co/trading-api/place-orders): Market and limit orders, listing, canceling and the order lifecycle.
- [Send funds](https://docs.truemarkets.co/trading-api/send-funds): Move tokens from your wallet to another address.
- [Transactions](https://docs.truemarkets.co/trading-api/transactions): Your orders and transfers in one list, newest first.

Before you raise your amounts, work through the [Go live checklist](https://docs.truemarkets.co/trading-api/go-live).