Skip to main content
Everything below talks to the public gateway at https://api.trymithril.com. The only thing you configure is an API key — venue auth, guardrails, and risk accounting happen server-side.

Get your API key

Everything runs off one mk_live_ key. Here’s the path from signup to key, in the dashboard:
1

Create your account

Sign up at app.trymithril.com — or book 20 minutes and we’ll onboard you personally. Your workspace is created for you on first sign-in.
2

Start your beta plan

Beta is free. Starting your plan is what unlocks key creation, so complete this step in onboarding before heading to the keys page.
3

Add a subaccount and venue credentials

Create a subaccount, then attach your Kalshi API key or Polymarket wallet key to it. Credentials are envelope-encrypted and used only to sign your orders — never returned, never logged.
4

Generate the API key

On the API keys page, create an mk_live_ key. It’s shown once — copy it into a secret manager or env var right away. (Use mk_test_ while you wire things up.)
Keep the key in MITHRIL_API_KEY; every example and the SDK read it from there automatically.

Two ways to call the gateway

The fastest path is the Python SDK — it handles auth, venue signing, idempotency, pagination, and typed errors. Or call the REST API directly with any HTTP client. Both talk to the same gateway; the tabs below show each.

Your first call

Confirm you can reach the gateway by listing your subaccounts.
A successful response is Mithril’s standard list envelope:

Place a risk-checked order

The canonical trade is POST /v1/orders. Grab a token_id from a market’s orderbook, then submit. The idempotency-key header makes a blind retry safe (see Idempotency) — the SDK attaches it for you.
Prices are probabilities in (0, 1] and quantities are decimals — both passed as strings to avoid float precision loss. See Conventions.

Make it useful for you

You have a key and a working call. Here’s the path from “hello world” to Mithril running your execution and risk:
1

Set your guardrails

Before you trade, tell Mithril your limits — max order size, daily-loss circuit breaker, kill switch. Every order is checked against them server-side. See Guardrails.
2

Find markets and read depth

Search across both venues and pull the book before you quote or take. See Market data.
3

Place and manage orders

Vanilla limit/market orders, or hand Mithril size to work into thin books with iceberg / peg / adaptive and get a TCA receipt on every fill.
4

Watch your risk

Read exposure, P&L, and per-market concentration in one call — per subaccount or across the workspace. See Risk & P&L.
5

Isolate strategies

Give each bot or strategy its own subaccount — separate credentials, positions, and limits — so one can’t touch another’s capital.

Run the full walkthrough

The examples/ folder is a runnable tour of the whole stack — one script per layer, all built on the SDK, the only config an API key:

Python SDK

Typed models, auto-idempotency, pagination, and errors.

Guardrails

Set the limits every order is checked against.