> ## Documentation Index
> Fetch the complete documentation index at: https://molelcule.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Molecule Overview: Prediction Market Execution API

> Molecule is a non-custodial prime brokerage and execution API for prediction markets. Access Polymarket, Kalshi, and Demo from one interface.

Molecule is a non-custodial prime brokerage and execution API for prediction markets. It gives institutional trading systems a single, consistent interface to search markets, manage orders, stream real-time data, and monitor portfolio risk across multiple venues — without surrendering custody of funds or venue credentials. Your keys stay in your process; Molecule handles request signing, order routing, and venue-level API translation.

## What You Can Do

* **Search and inspect markets** across Polymarket, Kalshi, and the Demo venue — retrieve order books, trade history, candles, and price ticks.
* **Submit and manage orders** — place limit and market orders, amend resting orders, cancel individually or in bulk, and query fills.
* **Route intelligently** — send orders directly to a specific venue instrument, find the best price across venues, or split size across venues automatically.
* **Use complex order types** — automate execution with iceberg, peg, stop, take-profit/stop-loss, and smart-route parent orders.
* **Monitor your portfolio** — query positions, balances, P\&L, and fee schedules per subaccount.
* **Enforce risk controls** — read and set per-subaccount risk limits, and trigger a kill switch that cancels all open orders.
* **Stream live data over WebSocket** — subscribe to order updates, fills, position changes, balance snapshots, order book depth, and trade prints with the same Ed25519 authentication used for REST.

## Architecture

Molecule sits between your trading system and the downstream venues. It acts as an execution proxy: it receives your signed API requests, translates them into venue-specific calls, and returns normalized responses. You retain direct ownership of your venue accounts — Molecule does not hold or move your funds.

```
Your System
    │
    │  HTTPS / WebSocket  (Ed25519-signed)
    ▼
Molecule API
    │
    ├──▶  Polymarket
    ├──▶  Kalshi
    └──▶  Demo  (paper-trading sandbox)
```

Each request you send must be signed with your Ed25519 trading key. The signature covers the HTTP method, path, sorted query string, timestamp, and SHA-256 hash of the request body. Molecule verifies the signature and rejects requests with timestamps outside a 30-second replay window. The private key never leaves your process.

## Session Modes

Molecule uses two distinct authentication modes. They are not interchangeable.

**Trading keys (Ed25519)** authenticate execution requests — placing orders, reading the book, querying fills, and managing risk. You provision a key pair with Molecule, store the 32-byte Ed25519 seed as a base64 string, and supply it to the SDK via `key_id` and `private_key`. Every request is signed locally before transmission.

**JWT tokens** authenticate account-management requests — creating subaccounts, managing key registrations, and other operations that require a human or service session. Pass a JWT via the `token` parameter. Sending a trading key to a management route returns `403 human_session_required`.

<Note>
  A single `Molecule` client instance operates in one mode at a time. Instantiate with `key_id` + `private_key` for trading, or with `token` for management.
</Note>

## Next Steps

<CardGroup cols={3}>
  <Card title="Quickstart" icon="bolt" href="/quickstart">
    Install the SDK, configure credentials, and submit your first order in under five minutes.
  </Card>

  <Card title="Authentication" icon="key" href="/authentication/overview">
    Understand Ed25519 key provisioning, request signing, and the JWT management session.
  </Card>

  <Card title="Market Data" icon="chart-line" href="/guides/market-data">
    Search markets, fetch order books, stream real-time prices, and read trade history.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.