> ## Documentation Index
> Fetch the complete documentation index at: https://digitalsurge.com.au/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Make your first Digital Surge API call in under five minutes: fetch live crypto prices in AUD, read your balances, and quote a swap.

## 1. Get live prices (no auth required)

Public market data works without an account. Fetch the current buy/sell price for every tradeable asset:

```bash theme={null}
curl "https://app.digitalsurge.com.au/api/public/broker/ticker/"
```

The returned prices are indicative — for a binding price, request a swap estimate (step 4).

## 2. Create an API key

Private endpoints need an API key:

1. Log in to the [Digital Surge app](https://app.digitalsurge.com.au).
2. Go to **Account Settings → API Keys**.
3. Choose **Read Only** (portfolio access) or **Read & Write** (can also trade and withdraw).
4. Confirm with your two-factor code, then **copy the key immediately** — it is shown only once.

See [Authentication](/guides/authentication) for details and key-safety guidance.

## 3. Read your balances

Send the key as a Bearer token:

```bash theme={null}
curl "https://app.digitalsurge.com.au/api/private/balances/" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```json theme={null}
{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "total": { "AUD": "1500.50", "BTC": "0.02500000" },
      "available": { "AUD": "1500.50", "BTC": "0.02500000" },
      "withdrawable": { "AUD": "1500.50", "BTC": "0.02500000" }
    }
  ]
}
```

<Warning>
  All monetary amounts are returned as **strings** — parse them with a decimal type, never a float. See [Conventions](/guides/conventions).
</Warning>

## 4. Quote a swap

Swaps are how you trade on Digital Surge: AUD → crypto is a buy, crypto → AUD is a sell. Always estimate first — the estimate is your binding quote:

```bash theme={null}
curl -X POST "https://app.digitalsurge.com.au/api/private/swaps/estimate/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "src_asset": "AUD",
    "dst_asset": "BTC",
    "req_spend_amount": "100.00"
  }'
```

The response includes `estimated_price_exact` and the fees you'd pay.

## 5. Execute the swap

<Warning>
  This places a real order with real funds.
</Warning>

Pass the same parameters plus `expected_price` from the estimate — if the market moves beyond tolerance, the swap is rejected instead of filling at a worse price:

```bash theme={null}
curl -X POST "https://app.digitalsurge.com.au/api/private/swaps/" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "src_asset": "AUD",
    "dst_asset": "BTC",
    "req_spend_amount": "100.00",
    "expected_price": "ESTIMATED_PRICE_EXACT_FROM_STEP_4"
  }'
```

The response returns the swap `id` with `status: "processing"`. Poll `GET /api/private/swaps/{id}/` about once per second (up to \~10 seconds) until the status becomes `processed`.

## Next steps

<CardGroup cols={2}>
  <Card title="API Reference" icon="book" href="/api-reference">
    Withdrawals, recurring buys, price triggers, transaction history, and more.
  </Card>

  <Card title="Connect an AI agent" icon="sparkles" href="/guides/ai-agents">
    Skip the code entirely — let Claude or another agent use your account via MCP.
  </Card>
</CardGroup>
