Skip to main content

Clients and SDKs

True Markets publishes first-party SDKs that wrap signing, token refresh, and every Retail API operation as typed methods. They auto-load TM_KEY_FILE from your environment, so there's no manual JWT step.

LanguagePackage
TypeScript@truemarkets/sdk
Pythontruemarkets

Installation

npm install @truemarkets/sdk

TypeScript SDK requires Node 18+ or Bun. Python SDK requires Python 3.10+.

Authentication

Both SDKs auto-load TM_KEY_FILE from your environment or a .env file in the working directory. See Onboarding for how to download an API key bundle.

# .env
TM_ENV=prod
TM_KEY_FILE=/path/to/truemarkets-api-key-XXXXXXXX.json

Quick example

Fetch a quote for $25 of BTC:

import { Client } from "@truemarkets/sdk";

const client = new Client();

const { data: quote } = await client.gateway.computeQuote({
body: {
base_asset: "BTC",
quote_asset: "USDC",
qty: "25",
qty_unit: "quote",
side: "buy",
},
});

Methods are generated from the OpenAPI spec and named after operationIds (listAssets/list_assets, createOrder/create_order, getOrderStatus/get_order_status, etc.). Autocomplete shows the full surface; see each SDK's README for the DeFi flow and Turnkey signing helpers.

CLI and MCP

Prefer to drive the API from your terminal — or from an AI agent? The True Markets CLI covers both. It installs via Homebrew or GitHub CLI, and ships an MCP server you can wire into Claude Desktop, Claude Code, or Cursor so an agent can fetch quotes and place trades for you. Auth is email-code, no stored keys.

Next steps

  • Quick Start — buy your first BTC end-to-end.
  • Retail API reference — every endpoint, schema, and error code.
  • Discord — SDK questions, MCP setup help, and integration chat happen here.