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

# Quickstart

> Log in, check your balance, find an instrument, and place and close your first trade.

This guide takes you from login to your first trade in five steps.

## Prerequisites

* An Amana account with API access. See [Getting started](/revamp/getting-started).
* For business access, your server IP addresses must be whitelisted.
* The base URL for your environment ‹confirm with Amana›.

<Warning>
  Orders placed in production use real money. Run this guide in the sandbox ‹sandbox URL› first.
</Warning>

Set your base URL once so you can copy the examples:

```bash theme={null}
export BASE_URL="‹base URL›"
```

<Steps>
  <Step title="Log in">
    Send your email and password to get an access token.

    ```bash theme={null}
    curl -X POST "$BASE_URL/auth/login" \
      -H "Content-Type: application/json" \
      -d '{"email": "you@example.com", "password": "your-password"}'
    ```

    ```json theme={null}
    {
      "access_token": "eyJhbGciOi...",
      "refresh_token": "eyJhbGciOi...",
      "passkey": false
    }
    ```

    Save the `access_token` and send it as a Bearer token in every following request.

    ```bash theme={null}
    export TOKEN="eyJhbGciOi..."
    ```
  </Step>

  <Step title="Check your balance">
    Get your trading account, including the balance and account currency.

    ```bash theme={null}
    curl "$BASE_URL/trading/me" \
      -H "Authorization: Bearer $TOKEN"
    ```

    The `user.balance` field shows your balance and `user.currency` shows the account currency.
  </Step>

  <Step title="Find an instrument">
    Search for the instrument you want to trade.

    ```bash theme={null}
    curl "$BASE_URL/trading/symbols/search?query=AAPL" \
      -H "Authorization: Bearer $TOKEN"
    ```

    Use the `symbol` value from the results when you place the order.
  </Step>

  <Step title="Place a market order">
    Buy \$100 of the instrument. Set the size in USD with `amount`. The `sl` (stop loss) and `tp` (take profit) prices are optional.

    ```bash theme={null}
    curl -X POST "$BASE_URL/trading/positions/market" \
      -H "Authorization: Bearer $TOKEN" \
      -H "Content-Type: application/json" \
      -d '{"symbol": "AAPL", "side": "buy", "amount": 100, "sl": 180, "tp": 220}'
    ```

    ```json theme={null}
    {
      "success": true,
      "orderId": "123456"
    }
    ```
  </Step>

  <Step title="View and close the position">
    List your open positions and note the `id` of the one you opened.

    ```bash theme={null}
    curl "$BASE_URL/trading/positions" \
      -H "Authorization: Bearer $TOKEN"
    ```

    Close the position at the current market price.

    ```bash theme={null}
    curl -X DELETE "$BASE_URL/trading/positions/{id}" \
      -H "Authorization: Bearer $TOKEN"
    ```
  </Step>
</Steps>

## Next steps

* Browse every endpoint in the [API reference](/revamp/api-reference/overview).
* Learn how to handle failures in [Error codes](/revamp/error-codes).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.