# Quick Start Guide

This guide will walk you through the process of making your first API call to the ForePaaS API.

{% hint style="success" %}
**Quick Start:** If you prefer to see working code first, check out our [complete examples](/advanced/code-examples.md) with full SDK implementations in Node.js and Python.
{% endhint %}

## Example: authorize (cURL)

Replace the placeholders (`<...>`) with your real values.

```bash
curl -X POST "https://apidev.forepass.org/api/user/openapi/authorize" \
  -H "Content-Type: application/json" \
  -H "X-API-KEY: <your_api_key>" \
  -H "X-Signature: <base64_signature>" \
  -H "X-Timestamp: <unix_ms_timestamp>" \
  -H "X-Nonce: <random_nonce>" \
  -d '{
    "marchantUserId": "mer016",
    "userEmail": "mer016@gmail.com",
    "userType": "creator",
    "merchantId": "101001",
    "coinType": "crypto",
    "currency": "SGD"
  }'
```

{% hint style="warning" %}
**Token Expiry:** JWT tokens expire after 24 hours. Store the token securely and implement refresh logic when it expires by calling the authorize endpoint again.
{% endhint %}

## Complete User Trading Flow

Here's a step-by-step guide for a complete user trading journey:

| Step   | Endpoint                                             | Purpose                                        |
| ------ | ---------------------------------------------------- | ---------------------------------------------- |
| **1**  | `POST /api/user/openapi/authorize`                   | Authenticate user and get JWT token            |
| **2**  | `GET /api/market/openapi/category`                   | Browse available market categories             |
| **3**  | `GET /api/market/openapi/market/list`                | Browse markets with filters                    |
| **4**  | `GET /api/market/openapi/{marketId}/outcome`         | View market details and current prices         |
| **5**  | `POST /api/order/openapi/order/submit`               | Submit buy order, receive `fgRequestId`        |
| **6**  | `GET /api/user/openapi/request/result/{fgRequestId}` | Poll for order status (SUCCESS/FAILED/PENDING) |
| **7**  | `POST /api/order/openapi/positions`                  | Check your positions and P\&L                  |
| **8**  | `GET /api/order/openapi/query-user-activity`         | View your trading history                      |
| **9**  | *(Wait for market settlement)*                       | Market creator sets result                     |
| **10** | `POST /api/order/openapi/order/claim`                | Claim rewards from winning positions           |
| **11** | `GET /api/user/notification/list`                    | Check notifications for settlements            |

{% hint style="info" %}
**Async Operations:** Steps 5-6 demonstrate the async pattern. Always poll the transaction result endpoint after receiving a `fgRequestId` to confirm success before proceeding.
{% endhint %}

## What's Next?

* 📊 **Browse Markets** - Use the [Get Market List](/api-reference/api-reference/market.md) endpoint to discover available markets
* 💰 **Place Orders** - Use the [Submit Order](/api-reference/api-reference/order.md) endpoint to trade on market outcomes
* 📈 **Track Positions** - Monitor your portfolio with the [Get User Positions](/api-reference/api-reference/user.md) endpoint
* 🏗️ **Create Markets** - If you're a creator, use the [Submit Market Application](/api-reference/api-reference/creator.md) endpoint

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


---

# Agent Instructions: 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:

```
GET https://docs.forepaas.org/getting-started/quick-start.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
