# Limit Order APIs

APIs are provided to help users relay the signed orders.

### Basic Information

* **Base URL**: <https://fx-limit-order-api.aladdin.club/>
* **API Swagger Docs**: <https://petstore.swagger.io/?url=https://fx-limit-order-api.aladdin.club/openapi.yml>
* **Supported Blockchains**: Ethereum

#### **1. Create Limit Order**

For risk considerations, creating orders through the API documentation is not recommended at this time. Please use the website to create limit orders.

{% hint style="info" %}
**⚠️ IMPORTANT RISK DISCLAIMER**: By submitting orders through APIs, you acknowledge and accept full responsibility for all trading risks including but not limited to: market volatility, slippage, liquidation risk, smart contract risks, and potential total loss of funds. This API provides no guarantees regarding order execution, profitability, or protection against losses. Use at your own risk and ensure you fully understand the implications of each order before submission.
{% endhint %}

**2. Get Active Orders (For Bots/Keepers)**

```http
GET /v1/active-orders
```

Returns all **open and fillable orders**, sorted by their `createdAt` timestamp in ascending order. This endpoint is optimized for keepers, bots, or external indexers that need to continuously fetch newly created orders available for on-chain execution.

**Query Parameters**:

* `after` (optional): Only include orders created after this UNIX timestamp (in seconds). Useful for incremental syncing.
* `limit` (optional): Maximum number of orders to return (default: 100, max: 5000)

**Response**:

```json
{
  "statusCode": 0,
  "message": "OK",
  "result": [
    {
      "orderHash": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
      "data": {
        "maker": "0x742D35Cc6609CBB9C1EC8f1E4A3ea5A1A8c1aB34",
        "pool": "0x1234567890123456789012345678901234567890",
        "positionId": 1,
        "positionSide": true,
        "orderType": false,
        "orderSide": true,
        "allowPartialFill": true,
        "triggerPrice": "0",
        "fxUSDDelta": "1000000000000000000000",
        "collDelta": "500000000000000000000",
        "debtDelta": "0",
        "nonce": 1,
        "salt": "0x1234567890123456789012345678901234567890123456789012345678901234",
        "deadline": 1703980800
      },
      "signature": "0x1234567890abcdef123456789...",
      "execution": {
        "status": 0,
        "filled": "0",
        "positionId": 1
      },
      "makingAmount": "1000000000000000000000",
      "takingAmount": "500000000000000000000",
      "expired": false,
      "createdAt": 1703894400,
      "updatedAt": 1703894400
    }
  ]
}
```

**3. Get Order Updates (For Real-time Monitoring)**

```http
GET /v1/order-updates
```

Returns orders **that have changed state** (created, filled, cancelled, or expired), sorted by their `updatedAt` timestamp in ascending order. Ideal for clients or bots polling for updates to maintain an up-to-date local view of the order book.

**Query Parameters**:

* `after` (optional): Only include orders updated after this UNIX timestamp (in seconds). Enables incremental polling for order state changes.
* `limit` (optional): Maximum number of orders to return (default: 100, max: 1000)

**Response**:

```json
{
  "statusCode": 0,
  "message": "OK",
  "result": [
    {
      "orderHash": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
      "data": { /* OrderData object */ },
      "signature": "0x1234567890abcdef...",
      "execution": {
        "status": 1,
        "filled": "250000000000000000000",
        "positionId": 1
      },
      "makingAmount": "1000000000000000000000",
      "takingAmount": "500000000000000000000",
      "expired": false,
      "createdAt": 1703894400,
      "updatedAt": 1703894500
    }
  ]
}
```


---

# 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://fxprotocol.gitbook.io/fx-docs/developers/integrating-the-f-x-limit-orders/limit-order-apis.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.
