# REST Endpoints

### **Overview**

#### **1. Access URL**

* **Production Environment**: [https://api.paddlefi.com](https://api.paddlefi.com/)

#### **2. Request Format**

The API supports both `GET` and `POST` methods. The only request parameter is `p`, and its format is JSON.

* Example: `https://api.paddlefi.com/api/dapp/querychainallinfo.do?p={}`

#### **3. Response Format**

* The response format is standardized as follows:

  ```json
  jsonCopy code{"code":"0","msg":"OK","info":{}}
  ```

| **Parameter Name** | **Type**      | **Description**                                       |
| ------------------ | ------------- | ----------------------------------------------------- |
| `code`             | `string`      | `0`: Successful response, Non-0: Failed response      |
| `msg`              | `string`      | Corresponding failure information for non-0 responses |
| `info`             | `json_object` | Response data (varies by endpoint)                    |

***

### **REST Endpoints**

#### **1. Create Lending/OTC Orders**

* **Endpoint**: `/api/dapp/createorder.do`

**Request Parameters**

| **Parameter Name** | **Required** | **Type**      | **Description**               |
| ------------------ | ------------ | ------------- | ----------------------------- |
| `chainname`        | Yes          | `string`      | Name of the blockchain        |
| `chainid`          | Yes          | `string`      | ID of the blockchain          |
| `useraddr`         | Yes          | `string`      | User address                  |
| `orderfrom`        | Yes          | `string`      | Source platform for the order |
| `orderinfo`        | Yes          | `json_object` | Order object details          |

**OrderInfo Structure (Loan/OTC)**

| **Parameter Name**  | **Required** | **Type**     | **Description**                                                                                    |
| ------------------- | ------------ | ------------ | -------------------------------------------------------------------------------------------------- |
| `maker`             | Yes          | `string`     | Order creator address                                                                              |
| `taker`             | Yes          | `string`     | Trader address, usually filled with `0x000...`                                                     |
| `asset`             | Yes          | `json_array` | List of asset details                                                                              |
| `currency`          | Yes          | `json_array` | List of fund details                                                                               |
| `deadline`          | Yes          | `string`     | Fundraising end time (for Loan orders)                                                             |
| `duration`          | Yes          | `string`     | Loan repayment time after fundraising is successful (in seconds)                                   |
| `interestPerSecond` | Yes          | `string`     | Interest generated per second                                                                      |
| `nonce`             | Yes          | `string`     | Nonce value obtained via contract interface `ApproveTrade.nonces(address maker)`                   |
| `endTime`           | Yes          | `string`     | Repayment deadline, usually filled with `0` and updated automatically after successful fundraising |
| `themselves`        | Yes          | `string`     | Signature (EIP712)                                                                                 |
| `orderType`         | Yes          | `string`     | Type of the order: `LOAN`/`OTC`                                                                    |

**Asset Structure Parameter Description**

<table data-header-hidden><thead><tr><th></th><th width="122"></th><th></th><th></th></tr></thead><tbody><tr><td><strong>Parameter Name</strong></td><td><strong>Required</strong></td><td><strong>Type</strong></td><td><strong>Description</strong></td></tr><tr><td><code>collection</code></td><td>Yes</td><td><code>string</code></td><td>Token address</td></tr><tr><td><code>assetClass</code></td><td>Yes</td><td><code>string</code></td><td>Token class (e.g., <code>ERC20</code>, <code>ERC721</code>, etc.)</td></tr><tr><td><code>amountOrID</code></td><td>Yes</td><td><code>string</code></td><td>Token quantity (ERC20) or ID (ERC721)</td></tr><tr><td><code>name</code></td><td>Yes</td><td><code>string</code></td><td>Token name</td></tr><tr><td><code>symbol</code></td><td>Yes</td><td><code>string</code></td><td>Token symbol</td></tr><tr><td><code>decimal</code></td><td>Yes</td><td><code>string</code></td><td>Token precision</td></tr></tbody></table>

**Response Parameters**

<table data-header-hidden><thead><tr><th></th><th width="169"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter Name</strong></td><td><strong>Type</strong></td><td><strong>Description</strong></td></tr><tr><td><code>warrants</code></td><td><code>string</code></td><td>Order ID</td></tr><tr><td><code>orderHash</code></td><td><code>string</code></td><td>Unique order hash</td></tr></tbody></table>

**Response Example**

```json
jsonCopy code{
  "code": "0",
  "msg": "OK",
  "info": {
      "orderid":"1",
      "orderhash":"0xb3e6fed053a30c96d03861a60ff4a197cf62fa8588878a567913eb14a87fb723"
  }
}
```

***

#### **2. Query Market Order List by Page**

* **Endpoint**: `/api/dapp/querymarketorder.do`

**Request Parameters**

<table data-header-hidden><thead><tr><th width="264"></th><th width="161"></th><th></th><th></th></tr></thead><tbody><tr><td><strong>Parameter Name</strong></td><td><strong>Required</strong></td><td><strong>Type</strong></td><td><strong>Description</strong></td></tr><tr><td><code>page</code></td><td>No</td><td><code>string</code></td><td>Page number (default: 1)</td></tr><tr><td><code>count</code></td><td>No</td><td><code>string</code></td><td>Number of records per page (default: 100)</td></tr><tr><td><code>filter_ordertype</code></td><td>No</td><td><code>string</code></td><td>Filter by order type (<code>LOAN</code>, <code>OTC</code>)</td></tr><tr><td><code>filter_orderfrom</code></td><td>No</td><td><code>string</code></td><td>Filter by order source platform</td></tr><tr><td><code>filter_orderhash</code></td><td>No</td><td><code>string</code></td><td>Filter by order hash</td></tr><tr><td><code>filter_chainname</code></td><td>No</td><td><code>string</code></td><td>Filter by asset chain name (<code>Bitlayer</code>, <code>Bsquare</code>)</td></tr><tr><td><code>filter_chainid</code></td><td>No</td><td><code>string</code></td><td>Filter by chain ID</td></tr><tr><td><code>filter_assetname</code></td><td>No</td><td><code>string</code></td><td>Filter by asset name (<code>USD Coin</code>, <code>Ether</code>)</td></tr><tr><td><code>filter_currencyName</code></td><td>No</td><td><code>string</code></td><td>Filter by currency name (<code>USD Coin</code>, <code>Ether</code>)</td></tr><tr><td><code>filter_assetSymbol</code></td><td>No</td><td><code>string</code></td><td>Filter by asset symbol (<code>USDT</code>, <code>ETH</code>)</td></tr><tr><td><code>filter_currencySymbol</code></td><td>No</td><td><code>string</code></td><td>Filter by currency symbol (<code>USDT</code>, <code>BTC</code>)</td></tr><tr><td><code>filter_taker</code></td><td>No</td><td><code>string</code></td><td>Filter by order taker (can be specific address, <code>0x</code>, or empty)</td></tr><tr><td><code>filter_status</code></td><td>No</td><td><code>string</code></td><td>Filter by order status (e.g., <code>0</code>, <code>1</code>, <code>2</code>)</td></tr><tr><td><code>order_by</code></td><td>No</td><td><code>string</code></td><td>Sort by field and order type (e.g., <code>createtime,desc</code>)</td></tr></tbody></table>

**Response Parameters**

| **Parameter Name** | **Type**      | **Description**                                       |
| ------------------ | ------------- | ----------------------------------------------------- |
| `count`            | `string`      | Total number of matching orders                       |
| `datas`            | `json_array`  | List of matching orders                               |
| `f_chain_name`     | `string`      | Chain name                                            |
| `f_chain_id`       | `string`      | Chain ID                                              |
| `f_create_time`    | `string`      | Order creation time                                   |
| `f_create_user`    | `string`      | Order creator (maker) address                         |
| `f_order_hash`     | `string`      | Unique order hash                                     |
| `f_order_from`     | `string`      | Source platform of the order                          |
| `f_trade_user`     | `string`      | Taker (order trader) address                          |
| `f_status`         | `string`      | Order status                                          |
| `f_order_info`     | `json_string` | Order details (formatted as JSON)                     |
| `f_trade_info`     | `json_string` | Trade details (formatted as JSON)                     |
| `f_id`             | `string`      | Order ID                                              |
| `f_isshow`         | `string`      | Internal flag for whether to display on the front-end |
| `f_update_time`    | `string`      | Last update time                                      |
| `f_uuid`           | `string`      | Internal flag for tracking updates                    |

***

#### **3. Paginated Query of Historical Orders**

* **Endpoint**: `/api/dapp/queryhistoryorder.do`
* **Request Parameters**: Same as for querying the market order list.
* **Response Parameters**: Same as for querying the market order list.

***

#### **4. Paginated Query of Orders Created by User (Maker)**

* **Endpoint**: `/api/dapp/queryusercreateorder.do`

**Request Parameters**

| **Parameter Name** | **Required** | **Type** | **Description**                                  |
| ------------------ | ------------ | -------- | ------------------------------------------------ |
| `useraddr`         | Yes          | `string` | Address of the user whose orders will be queried |

* **Response Parameters**: Same as for querying the market order list.

***

#### **5. Paginated Query of User's Completed Orders (Taker)**

* **Endpoint**: `/api/dapp/queryusertradeorder.do`

**Request Parameters**

| **Parameter Name** | **Required** | **Type** | **Description**                                            |
| ------------------ | ------------ | -------- | ---------------------------------------------------------- |
| `useraddr`         | Yes          | `string` | Address of the user whose completed orders will be queried |

* **Response Parameters**: Same as for querying the market order list


---

# 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.paddlefi.com/api-documentation/rest-endpoints.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.
