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

# Quickstart

> Quote and place your first Coins order

## Overview

This guide walks a full quote-to-execute flow: read your balance, quote a buy, then accept the quote to place an order. Every call uses your Daya API key in the `X-API-Key` header.

<Info>
  **Prerequisites:** a Daya API key with `coins:read` and `coins:trade` scopes. Issue keys in the [Daya dashboard](https://dashboard.daya.co). See [Authentication](/coins/authentication).
</Info>

## Step 1: Check your balance

<CodeGroup>
  ```bash cURL theme={"dark"}
  curl --request GET \
    --url https://api.daya.co/coins/v1/balance \
    --header 'X-API-Key: YOUR_DAYA_API_KEY'
  ```

  ```javascript JavaScript theme={"dark"}
  const res = await fetch('https://api.daya.co/coins/v1/balance', {
    headers: { 'X-API-Key': 'YOUR_DAYA_API_KEY' }
  });
  console.log((await res.json()).data);
  ```

  ```python Python theme={"dark"}
  import requests
  res = requests.get(
      'https://api.daya.co/coins/v1/balance',
      headers={'X-API-Key': 'YOUR_DAYA_API_KEY'}
  )
  print(res.json()['data'])
  ```
</CodeGroup>

**Response:**

```json theme={"dark"}
{
  "success": true,
  "message": "Balance retrieved",
  "data": {
    "available": "500.00",
    "held": "0.00",
    "total": "500.00",
    "currency": "USD"
  },
  "timestamp": "2026-01-15T10:30:00Z"
}
```

`held` currently returns `"0"`, so `total` equals `available`.

## Step 2: Request a quote

Quote a trade between two assets with `POST /quote`. The response is short-lived: use its `id` as `quote_id` to execute before `expires_at`. Amounts are shown fee-inclusive; the taker fee settles separately at execution. (To cash out to NGN instead, use `POST /fx/quotes` for a USD→NGN rate.)

<CodeGroup>
  ```bash cURL theme={"dark"}
  curl --request POST \
    --url https://api.daya.co/coins/v1/quote \
    --header 'X-API-Key: YOUR_DAYA_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
      "input_asset": "USD",
      "output_asset": "BTC",
      "input_amount": "100.00"
    }'
  ```

  ```javascript JavaScript theme={"dark"}
  const res = await fetch('https://api.daya.co/coins/v1/quote', {
    method: 'POST',
    headers: {
      'X-API-Key': 'YOUR_DAYA_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      input_asset: 'USD',
      output_asset: 'BTC',
      input_amount: '100.00'
    })
  });
  const quote = (await res.json()).data;
  console.log(quote.id, quote.rate, quote.expires_at);
  ```

  ```python Python theme={"dark"}
  import requests
  res = requests.post(
      'https://api.daya.co/coins/v1/quote',
      headers={'X-API-Key': 'YOUR_DAYA_API_KEY'},
      json={
          'input_asset': 'USD',
          'output_asset': 'BTC',
          'input_amount': '100.00'
      }
  )
  quote = res.json()['data']
  print(quote['id'], quote['rate'], quote['expires_at'])
  ```
</CodeGroup>

**Response:**

```json theme={"dark"}
{
  "success": true,
  "message": "Quote issued",
  "data": {
    "id": "qt_9f0c2b1a",
    "market": "BTC-USD",
    "side": "buy",
    "input_asset": "USD",
    "input_amount": "100.00",
    "output_asset": "BTC",
    "output_amount": "0.00151234",
    "rate": "66123.00",
    "expires_at": "2026-01-15T10:30:20Z",
    "created_at": "2026-01-15T10:30:00Z"
  },
  "timestamp": "2026-01-15T10:30:00Z"
}
```

## Step 3: Accept the quote and place the order

Reference the quote `id` to execute. Create and save one `Idempotency-Key` for this logical order before sending it. Reuse the same key for every retry.

<CodeGroup>
  ```bash cURL theme={"dark"}
  IDEMPOTENCY_KEY='4a7f6b2e-1c3d-4e5f-8a9b-0c1d2e3f4a5b'

  curl --request POST \
    --url https://api.daya.co/coins/v1/orders \
    --header 'X-API-Key: YOUR_DAYA_API_KEY' \
    --header "Idempotency-Key: $IDEMPOTENCY_KEY" \
    --header 'Content-Type: application/json' \
    --data '{ "quote_id": "qt_9f0c2b1a"}'
  ```

  ```javascript JavaScript theme={"dark"}
  const idempotencyKey = crypto.randomUUID();
  // Persist this key with the logical order before the first request.
  const res = await fetch('https://api.daya.co/coins/v1/orders', {
    method: 'POST',
    headers: {
      'X-API-Key': 'YOUR_DAYA_API_KEY',
      'Idempotency-Key': idempotencyKey,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ quote_id: 'qt_9f0c2b1a' })
  });
  console.log((await res.json()).data);
  ```

  ```python Python theme={"dark"}
  import requests, uuid

  idempotency_key = str(uuid.uuid4())
  # Persist this key with the logical order before the first request.
  res = requests.post(
      'https://api.daya.co/coins/v1/orders',
      headers={
          'X-API-Key': 'YOUR_DAYA_API_KEY',
          'Idempotency-Key': idempotency_key
      },
      json={'quote_id': 'qt_9f0c2b1a'}
  )
  print(res.json()['data'])
  ```
</CodeGroup>

**Response:**

```json theme={"dark"}
{
  "success": true,
  "message": "Order placed",
  "data": {
    "id": "ord_2d4e6f8a",
    "status": "pending",
    "side": "buy",
    "base_asset": "BTC",
    "quote_asset": "USD",
    "base_amount": "0.00151234",
    "quote_amount": "100.00",
    "fee": "0.00",
    "fee_asset": "USD",
    "created_at": "2026-01-15T10:30:05Z"
  },
  "timestamp": "2026-01-15T10:30:05Z"
}
```

<Info>
  Order placement is asynchronous. Do not allocate assets from the initial `pending` response. Wait for an `order.filled` or `order.failed` webhook, or poll `GET /orders/{id}` for a terminal status.
</Info>

<Info>
  The `id` values shown here are shortened for readability; a real quote `id` is a long opaque string you pass back verbatim as `quote_id`. An expired quote returns `410 Gone` and an already-consumed quote returns `409 Conflict` — request a fresh quote and retry with a new logical-order idempotency key.
</Info>

## Next steps

<CardGroup cols={2}>
  <Card title="Concepts" icon="book" href="/coins/concepts">
    How quotes, orders, and withdrawals fit together.
  </Card>

  <Card title="API Reference" icon="code" href="/coins/api-reference/overview">
    Every Coins endpoint with schemas and examples.
  </Card>
</CardGroup>
