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

# Quickstart

> Fund your account, create an API key, and place your first order in about ten minutes.

This guide takes you from nothing to a filled order and back out of the position. You need an email address and at least 5 USDC on Arbitrum.

<Warning>
  Orders trade real money on Hyperliquid mainnet. The amounts in this guide are small on purpose.
</Warning>

<Steps>
  <Step title="Sign in">
    Go to [tradingapi.dev/login](https://tradingapi.dev/login) and sign in with your email. The first time you sign in, we create your account and a deposit address for it.
  </Step>

  <Step title="Deposit USDC">
    Your account page shows a deposit address. Send **native USDC on Arbitrum** to it: at least 5 USDC, and at least \$30 if you want room to follow every step here.

    We move USDC from that address to your trading balance automatically, usually within a few minutes. Transfers under 5 USDC wait until the address holds at least 5.

    <Warning>
      Send only native USDC, and only on Arbitrum. Other tokens and other networks are not credited.
    </Warning>
  </Step>

  <Step title="Activate trading">
    On the account page, choose **Activate trading**. This lets the Trading API place orders for your account. It does not let anything withdraw your money. Activation lasts until the date the page shows; renew it there before it ends.
  </Step>

  <Step title="Create an API key">
    On the account page, create a key and set its limits:

    * **Markets**: the markets this key may trade, for example BTC and ETH.
    * **Max order**: the largest single order, in USD.
    * **Max per 24 hours**: how much the key may place in any 24 hours, in USD.

    The key is shown once. Store it somewhere safe, then put it in your shell:

    ```bash theme={"system"}
    export TRADINGAPI_KEY="tapi_..."
    ```
  </Step>

  <Step title="Check the key">
    Ask the API what this key may do:

    ```bash theme={"system"}
    curl https://tradingapi.dev/v1/api_key \
      -H "Authorization: Bearer $TRADINGAPI_KEY"
    ```

    ```json theme={"system"}
    {
      "object": "api_key",
      "name": "quickstart",
      "limits": { "markets": ["BTC", "ETH"], "max_order_value": "25.00", "max_daily_value": "100.00" },
      "usage": { "daily_value_used": "0.00", "daily_value_remaining": "100.00", "next_release": null }
    }
    ```
  </Step>

  <Step title="Look at the market">
    ```bash theme={"system"}
    curl https://tradingapi.dev/v1/markets/BTC \
      -H "Authorization: Bearer $TRADINGAPI_KEY"
    ```

    Note `min_value` and `max_value`: every order must be worth between them.
  </Step>

  <Step title="Preview the order">
    A preview runs the order without placing it, and shows what would happen:

    ```bash theme={"system"}
    curl https://tradingapi.dev/v1/orders/preview \
      -H "Authorization: Bearer $TRADINGAPI_KEY" \
      -H "Content-Type: application/json" \
      -d '{"market": "BTC", "side": "buy", "type": "market", "value": "15.00"}'
    ```

    Check that `valid` is `true`. If it is `false`, `errors` says what to change.
  </Step>

  <Step title="Place the order">
    Pick a `client_order_id` that is new for every order. It makes retries safe: if you send the same request twice, you still get one order.

    <CodeGroup>
      ```bash cURL theme={"system"}
      curl https://tradingapi.dev/v1/orders \
        -H "Authorization: Bearer $TRADINGAPI_KEY" \
        -H "Content-Type: application/json" \
        -d '{
          "client_order_id": "quickstart-1",
          "market": "BTC",
          "side": "buy",
          "type": "market",
          "value": "15.00"
        }'
      ```

      ```python Python theme={"system"}
      import os
      import requests

      response = requests.post(
          "https://tradingapi.dev/v1/orders",
          headers={"Authorization": f"Bearer {os.environ['TRADINGAPI_KEY']}"},
          json={
              "client_order_id": "quickstart-1",
              "market": "BTC",
              "side": "buy",
              "type": "market",
              "value": "15.00",
          },
          timeout=30,
      )
      order = response.json()
      print(order["status"], order["summary"])
      ```

      ```javascript JavaScript theme={"system"}
      const response = await fetch("https://tradingapi.dev/v1/orders", {
        method: "POST",
        headers: {
          Authorization: `Bearer ${process.env.TRADINGAPI_KEY}`,
          "Content-Type": "application/json",
        },
        body: JSON.stringify({
          client_order_id: "quickstart-1",
          market: "BTC",
          side: "buy",
          type: "market",
          value: "15.00",
        }),
      });
      const order = await response.json();
      console.log(order.status, order.summary);
      ```
    </CodeGroup>

    The response usually arrives with the order already `filled`. Read `summary` for what happened in plain English.
  </Step>

  <Step title="See your position">
    ```bash theme={"system"}
    curl https://tradingapi.dev/v1/positions/BTC \
      -H "Authorization: Bearer $TRADINGAPI_KEY"
    ```
  </Step>

  <Step title="Close it">
    ```bash theme={"system"}
    curl https://tradingapi.dev/v1/positions/BTC/close \
      -H "Authorization: Bearer $TRADINGAPI_KEY" \
      -H "Content-Type: application/json" \
      -d '{"client_order_id": "quickstart-close-1"}'
    ```

    With no `value` or `percent`, this closes the whole position. The response is the closing order.
  </Step>
</Steps>

<Check>
  You have placed an order, read a position and closed it.
</Check>

## Next steps

<Columns cols={2}>
  <Card title="How orders work" icon="list-checks" href="/concepts/orders">
    Why the order came to slightly less than you asked for, and what each status means.
  </Card>

  <Card title="Retry safely" icon="refresh-cw" href="/guides/retries">
    What to do when a request times out.
  </Card>
</Columns>
