> 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.

# Get an API key

This is the shortest path from nothing to a `200`. It uses **staging** and a **paper key**
throughout, so every step is safe to run while you read.

## Step 0 — call the API before you have a key

`GET /api/v1/markets` needs no authentication. Open it in the reference and press send:

#### [Try GET /api/v1/markets](/markets)

The Explorer on that page is already pointed at staging. You should get a list of real
staging markets back.

Or from a terminal:

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

If that returns markets, your network path is fine and everything below is about
*authentication*, not connectivity.

## Step 1 — mint a `drzl_test_` key

Sign in to the developer dashboard on staging and create a key with
`environment: "test"`:

#### [Staging developer dashboard](https://staging.drazill.com/developers/api-keys)

Sign in, then **Create key** → environment **test**.

The same thing over HTTP:

**`POST /api/v1/api-keys`**

```json title="POST /api/v1/api-keys"
{ "name": "My integration (sandbox)", "environment": "test" }
```

Three things to know before you click:

* **The secret is shown once.** Store it immediately; it is never retrievable again. If you
  lose it, rotate the key rather than creating a new one.
* **New keys are read-only by default.** Write scopes (`orders:write`, `wallet:write`, …)
  must be requested explicitly *and* acknowledged with `acknowledge_write_scopes: true`, and
  they require a verified email on the account.
* **The sandbox is on for staging.** Test keys are mintable there today
  (`DEVELOPER_SANDBOX_ENABLED` defaults on for staging and development). On production it is
  off, so production mints live-class keys only. See **[Sandbox](/sandbox)**.

> **Warning**
>
> A `drzl_live_` key trades **real money**. Never paste one into this site, a browser, a
> shared notebook, or any client you do not control. Everything on this page uses a
> `drzl_test_` paper key against staging.

## Step 2 — authenticate the Explorer

On any operation page, open the Explorer's auth panel and paste the key as **`X-API-Key`**.
Fern stores it client-side for your session only. Confirm the environment dropdown reads
**Staging** — it is the only environment offered, so a real-money call cannot be issued from
this site at all.

Now run an authenticated read:

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

That is the smallest possible proof your key works. If it returns `401`, the key is wrong or
revoked; if it returns `403`, the key is valid but lacks the scope.

> **Info**
>
> Point a test key at a real-money endpoint and you get `403 TEST_KEY_LIVE_ENDPOINT`. That
> is the guardrail working, not a misconfiguration — a paper key can never move real funds.

## Step 3 — the same call from the SDK

Install the official client for your language. Both packages are named `drazill`:

```bash
pip install drazill      # PyPI
npm install drazill      # npm
```

Then list markets — this is the exact code from the SDK's tested quickstart:

**`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}`);
}
```

An unconfigured client already points at staging, so there is no base URL to set while you
are testing. Set `DRAZILL_BASE_URL` (or pass `base_url=` / `baseUrl`) when you move to
another environment.

## Step 4 — place a paper trade

With a `drzl_test_` key, the **ordinary** trading endpoints route onto the paper engine —
your production code path is unchanged, only the key differs. Paper orders run on the real
LMSR pricing engine against isolated virtual balances, so what you observe is what you get
live.

Walk that path on **[Quickstart](/quickstart)**, and read
**[Paper vs live](/concepts/paper-vs-live)** for exactly what is and isn't shared between
the two.

## Where to go next

#### [Authentication](/authentication)

Scopes, key rotation, optional HMAC request signing, the withdrawal MFA step-up.

#### [Rate limits & quotas](/rate-limits)

Per-key limits, the headers that report them, and how to back off.

#### [Errors](/errors)

The error envelope and the full code catalog.

#### [SDKs](/sdks/overview)

Retries, idempotency, cursor iteration, WebSockets, webhook verification.