> For the complete documentation index, see [llms.txt](https://agentdex.gitbook.io/agentdex-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://agentdex.gitbook.io/agentdex-docs/welcome/getting-started.md).

# Getting started

Three steps to your first trade: create an account, deposit USDT through the bridge, place an order. This page walks each step end-to-end.

{% stepper %}
{% step %}

## Create an account

AgentDex authenticates end users through the Auth service. Sign in with email (Firebase-backed) or with a connected wallet — both produce a session bearer token used by the web UI and REST API. The same identity also issues programmatic API keys (see [API keys](/agentdex-docs/developers/api-keys.md)).

You don't need to fund the account yet. New users get an onboarding grace of up to **5 000 quest points** for completing first-time actions (see [Quests and referrals](/agentdex-docs/incentives/quests-and-referrals.md)).
{% endstep %}

{% step %}

## Deposit

Custody is on-chain via the `BridgeUpgradeable` contract. To deposit:

1. Connect a wallet that holds a supported token on a supported network. On the current testnet (Base Mainnet), `USDC`  tokens are used; the production deposit list is published in the bridge UI — see [Deposits and withdrawals](/agentdex-docs/account/deposits-and-withdrawals.md).
2. Approve the spend and call `depositToken(token, amount)` on the bridge. The transaction transfers tokens to the contract and emits a `Deposit` event.
3. AgentDex's `state-service` observes the event, sends the matching engine a credit message, and your off-chain balance becomes available for trading once the engine confirms.

Typical credit time is a small number of L1 confirmations plus the engine handshake — usually under a minute on a healthy chain. The deposit will show as **on-hold** in the bridge state until the credit is finalized. If something goes wrong on the engine side, the bridge state still reflects your deposit and the force-withdrawal escape hatch (see [Deposits and withdrawals](/agentdex-docs/account/deposits-and-withdrawals.md)) remains available.
{% endstep %}

{% step %}

## Place a trade

Pick an instrument from `get_instruments` — at launch the list includes `BTC_USDT_PERPETUAL`, `ETH_USDT_PERPETUAL`, and several altcoin perpetuals. Each instrument has a default leverage (5×) and a maximum leverage that varies per pair (20× for BTC/ETH, up to 50× for some alts).

Two ways to enter:

**Web UI** — pick the instrument, set leverage on the position panel, type the size in USDT, click Buy or Sell. The UI uses the same REST endpoints documented in [Rest API](/agentdex-docs/developers/rest-api.md).

**Programmatic (recommended for agents)** — create an API key with tight limits, point any MCP-capable client at the server, and ask it to trade:

```
URL:    https://agentdex.xyz/mcp
Header: X-Api-Key: <your key>
Tool:   place_order
Args:   {"instrument_id":"BTC_USDT_PERPETUAL",
         "side":"sell", "type":"market", "amount": 50}
```

The `amount` is **USDT notional**, not contracts. A `$50 sell` opens a $50 short at the prevailing market price. The response contains `order_id`, `avg_price`, `filled`, and `remaining`.
{% endstep %}
{% endstepper %}

### What's next

* Learn the contract mechanics: [Perpetual futures](/agentdex-docs/trading/perpetual-futures.md) → [Fees](/agentdex-docs/trading/fees.md).
* Get an API key with limits scoped to one instrument: [API keys](/agentdex-docs/developers/api-keys.md).
* Plug a Claude / Cursor / Goose agent into the MCP server: [MCP server](/agentdex-docs/developers/mcp-server.md).
* Understand how withdrawals work and what the escape hatch is: [Deposits and withdrawals](/agentdex-docs/account/deposits-and-withdrawals.md).

### Common first-time errors

| Error                                    | Likely cause                                                                | Fix                                                                                       |
| ---------------------------------------- | --------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| `INSUFFICIENT_FUNDS`                     | Position margin + fee reserve exceeds available USDT                        | Deposit more, or reduce size / leverage                                                   |
| `INVALID_INSTRUMENT_ID`                  | Typo or instrument not whitelisted on your key                              | Call `get_instruments` to list allowed pairs                                              |
| `AMOUNT_TOO_SMALL`                       | Below the minimum-order-size for the instrument                             | Increase the amount, or check the instrument's lot size                                   |
| `ORDER_VOLUME_MISMATCHES_CONTRACT_SIZE`  | Order is not a multiple of contract size when using `volume_mode=contracts` | Switch to USDT sizing or align to contract size                                           |
| Wallet shows tokens, AgentDex shows zero | Deposit event still in flight                                               | Wait for L1 confirmations + engine handshake; check the bridge transaction in an explorer |

See [FAQ](/agentdex-docs/reference/faq.md) for more.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://agentdex.gitbook.io/agentdex-docs/welcome/getting-started.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
