> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.drazill.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.drazill.com/_mcp/server.

# Quickstart

You can get your first successful response from the Drazill API **before you sign up for
anything**: public market data needs no authentication. From there it is three short steps
to an authenticated call, a paper (test-money) order, and a realtime price tick.

Every request lives under the `/api/v1` prefix.

> **Note**
>
> Every snippet on this page is lifted verbatim from the SDKs' tested example files
> (`sdks/python/examples/`, `sdks/typescript/examples/`) and pinned to them by a
> snippet-parity CI gate, so what you copy is what actually runs. The `curl` calls target
> **staging**, which serves the same code paths as production against a safe test dataset.

## Step 1 — Read a market (no auth)

Listing markets is a public read. This works for every reader, right now:

**`curl`**

```bash title="curl"
curl "https://staging.drazill.com/api/v1/markets?limit=3"
```

**`Python`**

```python title="Python"
client = DrazillClient(api_key=API_KEY, base_url=BASE_URL)
print(f"→ Drazill API @ {BASE_URL}\n")

# 1) List a page of open markets.
page = client.markets.list_markets(status="ACTIVE", limit=5, sort_by="volume")
print(f"Open markets ({page.total} total, showing {len(page.items)}):")
for m in page.items:
    print(f"  • {m.title}")
    print(f"      id={m.id}  slug={m.slug}  volume={m.total_volume}")
```

**`TypeScript`**

```typescript title="TypeScript"
const client = new Drazill({ apiKey: API_KEY, baseUrl: BASE_URL });
console.log(`→ Drazill API @ ${BASE_URL}\n`);

// 1) List a page of open markets.
const page = await client.markets.listMarkets({ status: "ACTIVE", limit: 5, sort_by: "volume" });
console.log(`Open markets (${page.total} total, showing ${page.items.length}):`);
for (const m of page.items) {
  console.log(`  • ${m.title}`);
  console.log(`      id=${m.id}  slug=${m.slug}  volume=${m.total_volume}`);
}
```

The response is a page envelope. Each market carries its outcomes, and each outcome's
`price` is a decimal string in `[0, 1]` — the market's implied probability for that
outcome. (Prices across a market's outcomes always sum to exactly 1 — see
[How pricing works](/concepts/pricing).)

**`Illustrative shape (values are examples)`**

```json title="Illustrative shape (values are examples)"
{
  "items": [
    {
      "id": "mkt_example_toronto_rain",
      "slug": "will-it-rain-in-toronto",
      "title": "Will it rain in Toronto tomorrow?",
      "total_volume": "12840.00",
      "outcomes": [
        { "id": "out_example_yes", "name": "Yes", "price": "0.63" },
        { "id": "out_example_no",  "name": "No",  "price": "0.37" }
      ]
    }
  ],
  "total": 1
}
```

## Environments

| Environment | REST base URL                 | WebSocket URL                  | Use it with                                   |
| ----------- | ----------------------------- | ------------------------------ | --------------------------------------------- |
| Production  | `https://api.drazill.com`     | `wss://api.drazill.com/ws`     | `drzl_live_` keys — real money                |
| Staging     | `https://staging.drazill.com` | `wss://staging.drazill.com/ws` | `drzl_test_` paper keys + the try-it explorer |

Point the SDKs at an environment with `DRAZILL_BASE_URL` (and `DRAZILL_WS_URL` for
realtime); both default to staging in the examples so you can run them safely as-is.

## Step 2 — Get an API key

Create a key in the [staging developer dashboard](https://staging.drazill.com/developers/api-keys).
Prefer a **test key** first: test keys carry the `drzl_test_` prefix, trade paper money
only, and are the only keys you should ever place in a browser or a shared notebook. Live
keys carry `drzl_live_`. The full key is shown **once** at creation — store it securely.

Test keys require the sandbox (`DEVELOPER_SANDBOX_ENABLED`), which is **on by default on
staging** and off on production — see [Sandbox](/sandbox) for the per-environment table.

> **Info**
>
> **[Get an API key](/get-a-key)** walks this step in full: minting the key, pasting it into
> the interactive Explorer, and running the same call from the `drazill` SDKs.

## Step 3 — Make an authenticated call

Send the key in the `X-API-Key` header. `GET /auth/me` echoes the authenticated identity —
a one-line proof your key works:

**`curl`**

```bash title="curl"
curl -H "X-API-Key: $DRAZILL_API_KEY" \
  https://staging.drazill.com/api/v1/auth/me
```

Keep the key server-side. See [Authentication](/authentication) for scopes, key classes,
and why browser apps must proxy through your own backend.

## Step 4 — Place a paper order

With a `drzl_test_` key, the ordinary trading endpoints route onto the price-isolated
paper engine — the same request you would send in production, with zero real-money risk.
Preview a fee-inclusive quote, then place the order **binding that quote and an idempotency
key** so a client-side retry can never double-place:

**`Python`**

```python title="Python"
idempotency_key = f"quickstart-trade-{uuid.uuid4()}"
result = client.orders.place_order(
    models.OrderCreate(
        market_id=market.id,
        outcome_id=outcome_id,
        side="BUY",
        type="MARKET",
        quantity=ORDER_QTY,
        preview_quote_token=quote.quote_token,
    ),
    include_receipt=True,
    request_options=RequestOptions(idempotency_key=idempotency_key),
)
```

**`TypeScript`**

```typescript title="TypeScript"
const idempotencyKey = `quickstart-trade-${crypto.randomUUID()}`;
const result = (await client.orders.placeOrder(
  {
    market_id: market.id,
    outcome_id: outcomeId,
    side: "BUY",
    type: "MARKET",
    quantity: ORDER_QTY,
    preview_quote_token: quote.quote_token,
  },
  { include_receipt: true },
  { idempotencyKey },
)) as any;
```

A `drzl_test_` key is hard-rejected with `TEST_KEY_LIVE_ENDPOINT` if it ever hits a
real-money endpoint, so a paper key cannot move real funds. See [Paper vs live](/concepts/paper-vs-live).

## Step 5 — Follow a live price tick

Open a WebSocket to `/ws`, authenticate with your key, and subscribe to
`prices:{outcome_id}` for price-tick updates (the lightest realtime channel — one
`price_tick` per price move):

**`Python`**

```python title="Python"
import asyncio
from drazill import DrazillClient

client = DrazillClient(api_key="<DRAZILL_API_KEY>")
ws = client.ws()

async def stream():
    await ws.connect()
    await ws.subscribe("orderbook:OUTCOME_UUID")
    await ws.subscribe("trades:MARKET_UUID")

    async for event in ws.listen():
        event_type = event.get("type")
        channel = event.get("channel", "")
        data = event.get("data", {})
        if event_type == "orderbook_update":
            print(f"Order book update on {channel}: {data}")
        elif event_type == "trade":
            print(f"Trade on {channel}: price={data.get('price')}")

asyncio.run(stream())
```

**`TypeScript`**

```typescript title="TypeScript"
const ws = client.ws();
ws.connect();

ws.subscribe("orderbook:OUTCOME_UUID", (data) => console.log("Order book:", data));
ws.subscribe("trades:MARKET_UUID", (data) => console.log("New trade:", data));
ws.subscribe("prices:OUTCOME_UUID", (data) => console.log("Price:", data));

ws.on("connected", () => console.log("Connected"));
ws.on("disconnected", () => console.log("Disconnected"));
ws.on("error", (data) => console.log("Error:", data));

ws.disconnect();
```

The full realtime contract — every channel, the sequence/replay guarantees, and the raw
message protocol — lives under [Realtime](/realtime/overview).

## Where next

* [Authentication](/authentication) — scopes, key classes, and request signing.
* [Concepts](/concepts/pricing) — how the hybrid order-book + LMSR engine actually prices.
* [Sandbox](/sandbox) — the paper-trading environment end to end.
* [SDKs](/sdks/overview) — install the Python and TypeScript clients.

> **Info**
>
> A longer, onboarding-checklist version of this walkthrough (accept terms → key → first
> call → webhook) lives in the repo at `docs/guides/getting-started.md`; this page is its
> canonical rendering.