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

# Quick Start

> Get up and running with the Easier Prop MT5 API in minutes

## Base URL

```
https://api.easierprop.com
```

## Authentication

All requests require an API key prefixed with `sk_`. Pass it via header, bearer token, or query parameter (WebSocket only).

<CodeGroup>
  ```bash X-API-Key Header (recommended) theme={null}
  curl -H "X-API-Key: sk_your_key" "https://api.easierprop.com/api/accounts"
  ```

  ```bash Bearer Token theme={null}
  curl -H "Authorization: Bearer sk_your_key" "https://api.easierprop.com/api/accounts"
  ```

  ```bash Query Parameter (WebSocket only) theme={null}
  wss://api.easierprop.com/ws?apiKey=sk_your_key
  ```
</CodeGroup>

<Tip>See the full [Authentication guide](/get-started/authentication) for error handling, code examples, and WebSocket auth details.</Tip>

## Step 1: Register Your MT5 Account

```bash theme={null}
curl -X POST https://api.easierprop.com/api/accounts \
  -H "X-API-Key: sk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "My Broker Account",
    "broker_host": "mt5.broker.com",
    "broker_port": 443,
    "mt5_login": 51234567,
    "password": "YourMT5Password"
  }'
```

```json Response theme={null}
{
  "ok": true,
  "data": {
    "id": "70f60784-20f1-45ba-9a04-8e01c0b810c3",
    "label": "My Broker Account",
    "broker_host": "mt5.broker.com",
    "broker_port": 443,
    "mt5_login": 51234567,
    "is_enabled": true,
    "auto_connect": false,
    "session_status": "disconnected",
    "created_at": "2026-04-01T12:00:00Z",
    "updated_at": "2026-04-01T12:00:00Z"
  }
}
```

<Note>Credentials are encrypted at rest with AES-256-GCM. The password is not echoed by the account CRUD endpoints — only by the read-only `GET /api/accounts/{id}/details`, for credential-verification flows.</Note>

## Step 2: Connect to the Broker

```bash theme={null}
curl -X POST https://api.easierprop.com/api/accounts/70f60784-.../connect \
  -H "X-API-Key: sk_your_key"
```

```json Response theme={null}
{
  "ok": true,
  "data": {
    "account_id": "70f60784-20f1-45ba-9a04-8e01c0b810c3",
    "connected": true
  }
}
```

<Note>You can skip this step. All endpoints auto-connect when needed. Sessions are health-checked every 30s with automatic reconnection.</Note>

## Step 3: Place a Trade

```bash theme={null}
curl -X POST https://api.easierprop.com/api/accounts/70f60784-.../orders \
  -H "X-API-Key: sk_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "symbol": "EURUSD",
    "side": "buy",
    "type": "market",
    "volume": 0.01
  }'
```

```json Response theme={null}
{
  "ok": true,
  "data": {
    "ticket": 12345678,
    "symbol": "EURUSD",
    "orderType": "Buy",
    "lots": 0.01,
    "openPrice": 1.08542,
    "stopLoss": 0.0,
    "takeProfit": 0.0,
    "profit": 0.0,
    "swap": 0.0,
    "commission": -0.07
  }
}
```

Supported order types: `market`, `limit`, `stop`, `stop_limit`.

## Step 4: Stream Live Data

Connect via WebSocket and subscribe to real-time channels:

<CodeGroup>
  ```javascript JavaScript theme={null}
  const ws = new WebSocket("wss://api.easierprop.com/ws?apiKey=sk_your_key");

  ws.onopen = () => {
    ws.send(JSON.stringify({
      type: "subscribe",
      channel: "quotes",
      account_id: "70f60784-20f1-45ba-9a04-8e01c0b810c3",
      symbols: ["EURUSD", "GBPUSD"],
      interval_ms: 500
    }));

    ws.send(JSON.stringify({
      type: "subscribe",
      channel: "profit",
      account_id: "70f60784-20f1-45ba-9a04-8e01c0b810c3",
      interval_ms: 1000
    }));

    ws.send(JSON.stringify({
      type: "subscribe",
      channel: "heartbeat",
      account_id: "70f60784-20f1-45ba-9a04-8e01c0b810c3"
    }));
  };

  ws.onmessage = (e) => {
    const msg = JSON.parse(e.data);
    switch (msg.type) {
      case "quote":
        console.log(`${msg.data.symbol}: ${msg.data.bid} / ${msg.data.ask}`);
        break;
      case "profit":
        console.log(`Equity: ${msg.data.equity} | P&L: ${msg.data.profit}`);
        break;
      case "heartbeat":
        console.log(`Balance: ${msg.balance} | Positions: ${msg.position_count}`);
        break;
    }
  };
  ```

  ```python Python theme={null}
  import asyncio, json, websockets

  async def main():
      uri = "wss://api.easierprop.com/ws?apiKey=sk_your_key"
      async with websockets.connect(uri) as ws:
          await ws.send(json.dumps({
              "type": "subscribe",
              "channel": "quotes",
              "account_id": "70f60784-20f1-45ba-9a04-8e01c0b810c3",
              "symbols": ["EURUSD"],
              "interval_ms": 500
          }))

          async for message in ws:
              msg = json.loads(message)
              if msg["type"] == "quote":
                  d = msg["data"]
                  print(f"{d['symbol']}: {d['bid']} / {d['ask']}")
              elif msg["type"] == "heartbeat":
                  print(f"Balance: {msg['balance']} | Positions: {msg['position_count']}")

  asyncio.run(main())
  ```
</CodeGroup>

| Stream         | Description                    | `symbols` required | Default interval                |
| -------------- | ------------------------------ | :----------------: | ------------------------------- |
| `quotes`       | Real-time bid/ask ticks        |         Yes        | 500ms                           |
| `orders`       | Order open/modify/close events |         No         | instant                         |
| `profit`       | Live equity, margin, and P\&L  |         No         | 1000ms                          |
| `heartbeat`    | Account health snapshot        |         No         | 5000ms                          |
| `new_position` | New position opened            |         No         | instant                         |
| `ohlc`         | Live OHLC candle updates       |         Yes        | Uses `interval_ms` as timeframe |
| `order_book`   | Market depth / order book      |         Yes        | 500ms                           |
| `tick_value`   | Tick value updates             |         Yes        | 500ms                           |

<Tip>See the full [WebSocket Guide](/get-started/websocket) for alerts, aggregate messages, unsubscribing, and multi-account streaming.</Tip>

## Response Format

Every API response uses this envelope:

<CodeGroup>
  ```json Success theme={null}
  {
    "ok": true,
    "data": { ... }
  }
  ```

  ```json Error theme={null}
  {
    "ok": false,
    "error": {
      "code": "CONNECTION_FAILED",
      "message": "Could not connect to broker"
    }
  }
  ```
</CodeGroup>

## Error Codes

| Code                    | HTTP | Description                                                             |
| ----------------------- | :--: | ----------------------------------------------------------------------- |
| `UNAUTHORIZED`          |  401 | Missing or invalid API key                                              |
| `FORBIDDEN`             |  403 | Account belongs to another key                                          |
| `ACCOUNT_NOT_FOUND`     |  404 | Account ID does not exist                                               |
| `INVALID_REQUEST`       |  400 | Bad request body or params                                              |
| `ORDER_FAILED`          |  422 | Broker rejected the trade                                               |
| `ACCOUNT_LIMIT_REACHED` |  409 | API-key account cap reached. Default is 4 unless your admin grants more |
| `CONNECTION_FAILED`     |  502 | Could not reach MT5 broker                                              |
| `SESSION_LOST`          |  503 | Broker session dropped                                                  |
| `UPSTREAM_ERROR`        |  502 | Broker service error                                                    |

## Next Steps

<CardGroup cols={2}>
  <Card title="REST API Reference" icon="bolt" href="/api-reference/accounts/list-accounts">
    Browse all 55+ client endpoints with the interactive playground.
  </Card>

  <Card title="WebSocket Guide" icon="signal-stream" href="/get-started/websocket">
    Real-time streams, alerts, aggregate messages, and multi-account streaming.
  </Card>
</CardGroup>
