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

# Quickstart

> Create an API key, send it as a bearer token, and make your first API request.

Use a workspace API key to hit the Onstacks API. Send the key in the `Authorization` header on every
protected request.

## Base URL

```bash theme={null}
export ONSTACKS_API_URL="https://api.onstacks.io"
```

## Authenticate requests

```bash theme={null}
export ONSTACKS_API_KEY="osk_test_..."
```

Send the key as a bearer token:

```http theme={null}
Authorization: Bearer osk_test_...
```

## Make your first request

<Steps>
  <Step title="Check service readiness">
    Health endpoints do not require an API key.

    ```bash theme={null}
    curl "$ONSTACKS_API_URL/readyz"
    ```
  </Step>

  <Step title="List wallets">
    Use `environment=sandbox` while testing.

    ```bash theme={null}
    curl "$ONSTACKS_API_URL/v1/wallets?environment=sandbox" \
      -H "Authorization: Bearer $ONSTACKS_API_KEY"
    ```
  </Step>

  <Step title="Create a wallet">
    ```bash theme={null}
    curl -X POST "$ONSTACKS_API_URL/v1/wallets?environment=sandbox" \
      -H "Authorization: Bearer $ONSTACKS_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "name": "Operating wallet"
      }'
    ```
  </Step>

  <Step title="Create a transfer preview">
    Preview a withdrawal before creating a transfer.

    ```bash theme={null}
    curl -X POST "$ONSTACKS_API_URL/v1/wallets/$WALLET_ID/withdrawal/preview?environment=sandbox" \
      -H "Authorization: Bearer $ONSTACKS_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "network_code": "ethereum_sepolia",
        "asset": "USDC",
        "amount": "1000000",
        "to_address": "0xabc..."
      }'
    ```
  </Step>
</Steps>

<Tip>
  Treat API keys like passwords. Store them server-side and never expose live keys in browser code.
</Tip>
