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

# Quick Start Guide

Get started with the ForeGate PaaS API in minutes - from your first signed request to your first trade

This guide walks you through your first calls to the ForeGate PaaS API: registering a user, capturing the session cookie, and placing an order.

{% hint style="success" %}
**Prefer working code?** The [Code Examples](/advanced/code-examples.md) page has complete Node.js and Python clients that implement signing and session handling — copy one and skip straight to step 3.
{% endhint %}

## Example: register (cURL)

Replace the placeholders (`<...>`) with your real values. Note `-v`: you need to see the `Set-Cookie` response header.

```bash
curl -v --http1.1 -X POST \
  -H 'accept: application/json' \
  -H 'date: 2026-06-01 17:51:23' \
  -H 'x-ca-key: <APP Key>' \
  -H 'x-ca-signature: <base64 HMAC-SHA256>' \
  -H 'content-type: application/json' \
  -H 'content-md5: <base64 md5 of body>' \
  -H 'x-ca-signature-headers: x-api-key' \
  -H 'x-api-key: <X-API-KEY>' \
  --data-raw '{"userEmail":"userciismd@gmail.com","merchantId":"101001","marchantUserId":"mer_ciismd"}' \
  'https://openapi.foregate.com/user/register'
```

Successful response:

```json
{
  "code": 0,
  "message": "ok",
  "data": {
    "userId": "CbVKe8WOcEF9DzFQDoGQncrU32UKCG18",
    "userName": "M_mer_zc9x5o_3a911a21",
    "email": "user@example.com"
  }
}
```

{% hint style="warning" %}
**Session expiry:** when a session becomes invalid you'll receive `403 Invalid or expired session` — call `/user/register` again for the same `marchantUserId` to mint a fresh cookie. And mind the spelling: the field really is `marchantUserId`.
{% endhint %}

## Complete User Trading Flow

| Step   | Endpoint                                       | Purpose                                                               |
| ------ | ---------------------------------------------- | --------------------------------------------------------------------- |
| **1**  | `POST /user/register`                          | Register/login the user; capture the session cookie from `Set-Cookie` |
| **2**  | `GET /account/assets`                          | Check the user's balances                                             |
| **3**  | `GET /markets/list`                            | Browse available markets                                              |
| **4**  | `GET /markets/{marketId}/detail`               | Inspect a market's outcomes and options                               |
| **5**  | `GET /orderbook/book` + `GET /orderbook/price` | Read the CLOB snapshot and best bid/ask                               |
| **6**  | `POST /ordering/create-order`                  | Place a LIMIT or MARKET order                                         |
| **7**  | `POST /ordering/open-orders`                   | Track unfilled orders (cancel via `/ordering/cancel-order`)           |
| **8**  | `GET /trades`                                  | Review the user's trading activity                                    |
| **9**  | *(Market settles)*                             | —                                                                     |
| **10** | `POST /ordering/claim`                         | Claim winnings from settled orders                                    |

For funding flows, see [Deposits](/api-reference/api-reference/deposit.md) and [Withdrawals](/api-reference/api-reference/withdraw.md). For live data, subscribe to the [WebSocket channels](/advanced/websocket-api.md).

{% hint style="info" %}
**Real-time order books:** the CLOB WebSocket stream is delta-only. Always seed a local book from `GET /orderbook/book` before consuming `/socket/clob-price-update` — see [Building a local order book](/advanced/websocket-api.md#building-a-local-order-book-required-reading).
{% endhint %}

## What's Next?

* 📊 **Browse Markets** — [Markets](/api-reference/api-reference/markets.md) and [Search](/api-reference/api-reference/search.md) endpoints
* 📈 **Read the Order Book** — [Orderbook endpoints](/api-reference/api-reference/orderbook.md)
* 💰 **Trade** — [Ordering endpoints](/api-reference/api-reference/ordering.md)
* 🔔 **Go Real-Time** — [WebSocket API](/advanced/websocket-api.md)
* 🧰 **Copy a Client** — [Code Examples](/advanced/code-examples.md)

{% content-ref url="/pages/BLtr8ip2Yn3d2Kq2qjFZ" %}
[Code Examples](/advanced/code-examples.md)
{% endcontent-ref %}
