> For the complete documentation index, see [llms.txt](https://docs.panora.exchange/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.panora.exchange/developer/limit.md).

# Limit

Explore authentication, endpoints, and trading operations to start trading efficiently. Whether you're a developer or a trader, this guide has everything you need to get started with Panora's APIs.

## 1. Create a Limit Order

<mark style="color:green;">`POST`</mark> `https://api.panora.exchange/limit/v1/createOrder`

### Headers

* **Public API Key**:

  ```
  a4^KV_EaTf4MW#ZdvgGKX#HUD^3IFEAOV_kzpIE^3BQGA8pDnrkT7JcIy#HNlLGi
  ```

  ***Note:** This API key's limits should be sufficient for most use cases. Protocols within the Aptos ecosystem with specific requirements or customization may submit a ticket on Discord.*&#x20;

<table><thead><tr><th width="127.81817626953125">Name</th><th width="167.27264404296875">Value</th><th>Description</th></tr></thead><tbody><tr><td>x-api-key</td><td>Your API Key</td><td>Use the public API key or enter the API key provided by Panora</td></tr></tbody></table>

### Request Body

<table><thead><tr><th width="147.3636474609375">Parameter</th><th width="106.90911865234375">Required</th><th width="113.363525390625">Type</th><th>Descriptio</th></tr></thead><tbody><tr><td>chainId</td><td>no </td><td>string</td><td>ID for the chain for which the endpoint is being invoked.</td></tr><tr><td>toTokenAddress</td><td>yes</td><td>string</td><td>Address of the token you're buying</td></tr><tr><td>fromWalletAddress</td><td>yes</td><td>string</td><td>Address of the token you're selling</td></tr><tr><td>toWalletAddress</td><td>yes </td><td>string</td><td><p>Address of the wallet to which the received</p><p> tokens will be sent</p></td></tr><tr><td>fromTokenAmount</td><td>yes</td><td>string</td><td>Amount of the token you want to sell</td></tr><tr><td>rateToTokenPerFromToken</td><td>yes</td><td>string</td><td>Conversion rate from the token you're selling to the token you're buying</td></tr><tr><td>slippagePercentage</td><td>no</td><td>string</td><td>Slippage tolerance as 'auto' (which lets Panora choose the optimal slippage for the transaction, up to a maximum of 5%) or a percentage value.</td></tr><tr><td>expiry.value</td><td>no</td><td>string</td><td>Numerical value representing the time until the order expires.</td></tr><tr><td>expiry.timePeriod</td><td>no</td><td>string</td><td>Unit of time for the expiry (e.g., "minute", "hour", "day", "week", "month").</td></tr></tbody></table>

### Request Example

{% tabs %}
{% tab title="Javascript" %}

```javascript
// CALL THE BELOW FUNCTION WITH ASYNC
const end_point = 'https://api.panora.exchange/limit/v1/createOrder';

const requestBody = {
    "chainId": "1",
    "fromTokenAddress": "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b",
    "fromTokenAmount": "0.25",
    "toWalletAddress": "0xe98d018a6958a6d1cde384aa69a746259df98488970c49fc5f46d10c5229ee56",
    "toTokenAddress": "0xa",
    "slippagePercentage": "1",
    "platformId": "500",
    "rateToTokenPerFromToken": "0.214468496",
    "expiry": {
        "timePeriod": "week",
        "value": "1"
    },
    "integratorFeePercentage": "0"
};

const headers = {
    "x-api-key": "Your API key",
    "Content-Type": "application/json"
};

const url = `${end_point}`;

const response = await (
    await fetch(url, {
        method: 'POST',
        headers: headers,
        body: JSON.stringify(requestBody)
    })
).json();

console.log(response);

```

{% endtab %}

{% tab title="Python" %}

```python
# CALL THE BELOW FUNCTION WITH ASYNC
import requests
import json

end_point = 'https://api.panora.exchange/limit/v1/createOrder'

request_body = {
    "chainId": "1",
    "fromTokenAddress": "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b",
    "fromTokenAmount": "0.25",
    "toWalletAddress": "0xe98d018a6958a6d1cde384aa69a746259df98488970c49fc5f46d10c5229ee56",
    "toTokenAddress": "0xa",
    "slippagePercentage": "1",
    "platformId": "500",
    "rateToTokenPerFromToken": "0.214468496",
    "expiry": {
        "timePeriod": "week",
        "value": "1"
    },
    "integratorFeePercentage": "0"
}

headers = {
    "x-api-key": "Your API key",
    "Content-Type": "application/json"
}

response = requests.post(end_point, headers=headers, data=json.dumps(request_body))
print(response.json())

```

{% endtab %}

{% tab title="Go" %}

```go
// CALL THE BELOW FUNCTION WITH ASYNC
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
)

func main() {
	endpoint := "https://api.panora.exchange/limit/v1/createOrder"

	requestBody := map[string]interface{}{
		"chainId":              "1",
		"fromTokenAddress":     "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b",
		"fromTokenAmount":      "0.25",
		"toWalletAddress":      "0xe98d018a6958a6d1cde384aa69a746259df98488970c49fc5f46d10c5229ee56",
		"toTokenAddress":       "0xa",
		"slippagePercentage":   "1",
		"platformId":           "500",
		"rateToTokenPerFromToken": "0.214468496",
		"expiry": map[string]string{
			"timePeriod": "week",
			"value":      "1",
		},
		"integratorFeePercentage": "0",
	}

	payload, err := json.Marshal(requestBody)
	if err != nil {
		panic(err)
	}

	req, err := http.NewRequest("POST", endpoint, bytes.NewBuffer(payload))
	if err != nil {
		panic(err)
	}

	req.Header.Set("x-api-key", "Your API key")
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	body, _ := ioutil.ReadAll(resp.Body)
	fmt.Println(string(body))
}

```

{% endtab %}

{% tab title="Curl" %}

```javascript
# CALL THE BELOW FUNCTION WITH ASYNC
curl -X POST https://api.panora.exchange/limit/v1/createOrder \
  -H "x-api-key: Your API key" \
  -H "Content-Type: application/json" \
  -d '{
    "chainId": "1",
    "fromTokenAddress": "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b",
    "fromTokenAmount": "0.25",
    "toWalletAddress": "0xe98d018a6958a6d1cde384aa69a746259df98488970c49fc5f46d10c5229ee56",
    "toTokenAddress": "0xa",
    "slippagePercentage": "1",
    "platformId": "500",
    "rateToTokenPerFromToken": "0.214468496",
    "expiry": {
      "timePeriod": "week",
      "value": "1"
    },
    "integratorFeePercentage": "0"
}'

```

{% endtab %}
{% endtabs %}

## 2. Cancel a Limit Order

<mark style="color:green;">`POST`</mark> `https://api.panora.exchange/limit/v1/cancelOrder`

### Request Body

| Parameter       | Required | Type   | Description                                                            |
| --------------- | -------- | ------ | ---------------------------------------------------------------------- |
| chainId         | no       | string | ID for the chain for which the endpoint is being invoked.              |
| toWalletAddress | no       | string | Address of the wallet associated with the transaction to be cancelled. |
| panoraTxId      | yes      | string | The Panora transaction ID of the order that needs to be cancelled.     |

### Request Example

{% tabs %}
{% tab title="Javascript" %}

```javascript
// CALL THE BELOW FUNCTION WITH ASYNC
const end_point = 'https://api.panora.exchange/limit/v1/cancelOrder';

const requestBody = {
    "chainId": "1",
    "toWalletAddress": "0xe98d018a6958a6d1cde384aa69a746259df98488970c49fc5f46d10c5229ee56",
    "panoraTxId": "0xd88d69a35bac183dd91e5a836e0fd0182127c557045db052fb6565dc5d98b962",
};

const headers = {
    "x-api-key": "Your API key",
    "Content-Type": "application/json"
};

const url = `${end_point}`;

const response = await (
    await fetch(url, {
        method: 'POST',
        headers: headers,
        body: JSON.stringify(requestBody)
    })
).json();

console.log(response);

```

{% endtab %}

{% tab title="Python" %}

```python
# CALL THE BELOW FUNCTION WITH ASYNC
import requests
import json

end_point = 'https://api.panora.exchange/limit/v1/cancelOrder'

request_body = {
    "chainId": "1",
    "toWalletAddress": "0xe98d018a6958a6d1cde384aa69a746259df98488970c49fc5f46d10c5229ee56",
    "panoraTxId": "0xd88d69a35bac183dd91e5a836e0fd0182127c557045db052fb6565dc5d98b962"
}

headers = {
    "x-api-key": "Your API key",
    "Content-Type": "application/json"
}

response = requests.post(end_point, headers=headers, data=json.dumps(request_body))
print(response.json())

```

{% endtab %}

{% tab title="Go" %}

```go
// CALL THE BELOW FUNCTION WITH ASYNC
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
)

func main() {
	endpoint := "https://api.panora.exchange/limit/v1/cancelOrder"

	requestBody := map[string]interface{}{
		"chainId":         "1",
		"toWalletAddress": "0xe98d018a6958a6d1cde384aa69a746259df98488970c49fc5f46d10c5229ee56",
		"panoraTxId":      "0xd88d69a35bac183dd91e5a836e0fd0182127c557045db052fb6565dc5d98b962",
	}

	payload, err := json.Marshal(requestBody)
	if err != nil {
		panic(err)
	}

	req, err := http.NewRequest("POST", endpoint, bytes.NewBuffer(payload))
	if err != nil {
		panic(err)
	}

	req.Header.Set("x-api-key", "Your API key")
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	body, _ := ioutil.ReadAll(resp.Body)
	fmt.Println(string(body))
}

```

{% endtab %}

{% tab title="Curl" %}

```
# CALL THE BELOW FUNCTION WITH ASYNC
curl -X POST https://api.panora.exchange/limit/v1/cancelOrder \
  -H "x-api-key: Your API key" \
  -H "Content-Type: application/json" \
  -d '{
    "chainId": "1",
    "toWalletAddress": "0xe98d018a6958a6d1cde384aa69a746259df98488970c49fc5f46d10c5229ee56",
    "panoraTxId": "0xd88d69a35bac183dd91e5a836e0fd0182127c557045db052fb6565dc5d98b962"
}'

```

{% endtab %}
{% endtabs %}

## 3. Get Limit Orders

<mark style="color:green;">`POST`</mark> `https://api.panora.exchange/limit/v1/getOrders`

| Parameter       | Type | Required                | Description                                                   |
| --------------- | ---- | ----------------------- | ------------------------------------------------------------- |
| chainId         | no   | number                  | ID for the chain for which the endpoint is being invoked.     |
| toWalletAddress | no   | string                  | Address of the wallet associated with the transaction(s).     |
| panoraTxId      | no   | string                  | The Panora transaction ID of the order to retrieve.           |
| status          | no   | "active" \| "completed" | Filter orders by status (`"active"` or `"completed"`).        |
| txDetails       | no   | boolean                 | Whether to include detailed transaction data (true or false). |
| limit           | no   | number                  | Maximum number of results to return in a single page.         |
| pageNumber      | no   | number                  | Current page number                                           |

### Request Example

{% tabs %}
{% tab title="Javascript" %}

```javascript
// CALL THE BELOW FUNCTION WITH ASYNC
const end_point = 'https://api.panora.exchange/limit/v1/getOrders';

const queryParams = {
    chainId: 1,
    limit: 5,
    pageNumber: 1,
    status: "active",
    toWalletAddress: "0xe98d018a6958a6d1cde384aa69a746259df98488970c49fc5f46d10c5229ee56",
    txDetails: true
};

const queryString = new URLSearchParams(queryParams).toString();
const url = `${end_point}?${queryString}`;

const headers = {
    "x-api-key": "Your API key"
};

const response = await (
    await fetch(url, {
        method: 'GET',
        headers: headers
    })
).json();

console.log(response);

```

{% endtab %}

{% tab title="Python" %}

```python
# CALL THE BELOW FUNCTION WITH ASYNC
import requests

end_point = 'https://api.panora.exchange/limit/v1/getOrders'

params = {
    "chainId": 1,
    "limit": 5,
    "page_number": 1,
    "status": "active",
    "toWalletAddress": "0xe98d018a6958a6d1cde384aa69a746259df98488970c49fc5f46d10c5229ee56",
    "txDetails": True
}

headers = {
    "x-api-key": "Your API key"
}

response = requests.get(end_point, headers=headers, params=params)
print(response.json())

```

{% endtab %}

{% tab title="Go" %}

```go
// CALL THE BELOW FUNCTION WITH ASYNC
package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
)

func main() {
	baseURL := "https://api.panora.exchange/limit/v1/getOrders"

	params := url.Values{}
	params.Add("chainId", "1")
	params.Add("limit", "5")
	params.Add("page_number", "1")
	params.Add("status", "active")
	params.Add("toWalletAddress", "0xe98d018a6958a6d1cde384aa69a746259df98488970c49fc5f46d10c5229ee56")
	params.Add("txDetails", "true")

	reqURL := fmt.Sprintf("%s?%s", baseURL, params.Encode())

	req, err := http.NewRequest("GET", reqURL, nil)
	if err != nil {
		panic(err)
	}

	req.Header.Set("x-api-key", "Your API key")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	body, _ := ioutil.ReadAll(resp.Body)
	fmt.Println(string(body))
}

```

{% endtab %}

{% tab title="Curl" %}

```
# CALL THE BELOW FUNCTION WITH ASYNC
curl -X GET "https://api.panora.exchange/limit/v1/getOrders?chainId=1&limit=5&page_number=1&status=active&toWalletAddress=0xe98d018a6958a6d1cde384aa69a746259df98488970c49fc5f46d10c5229ee56&txDetails=true" \
  -H "x-api-key: Your API key"

```

{% endtab %}
{% endtabs %}

### 📦 `LimitOrdersResponse` (Object)

| Field             | Type   | Description                                               |
| ----------------- | ------ | --------------------------------------------------------- |
| `chainId`         | number | ID for the chain for which the endpoint is being invoked. |
| `toWalletAddress` | string | Wallet address for which the limit orders were queried    |
| `pageNumber`      | number | Current page number                                       |
| `totalPages`      | number | Total number of pages available                           |
| `orders`          | array  | List of limit order objects (see below for structure)     |

`orders[]` (Order Object)

| Field                         | Type   | Description                                                                                                 |
| ----------------------------- | ------ | ----------------------------------------------------------------------------------------------------------- |
| `panoraTxId`                  | string | Unique Panora transaction ID of the limit order                                                             |
| `fromToken`                   | Token  | Token being sold                                                                                            |
| `toToken`                     | Token  | Token being bought                                                                                          |
| `feeToken`                    | Token  | Token used for fees                                                                                         |
| `createdAtTime`               | string | ISO timestamp when the order was created                                                                    |
| `status`                      | string | Status of the order: `"active"`, `"partially_filled"`, `"filled"`, `"cancelled"`, `"refunded"`, `"expired"` |
| `expireAtTime`                | string | ISO timestamp for when the order expires                                                                    |
| `fromTokenAmount`             | string | Total amount of `fromToken` specified for the order                                                         |
| `rateToTokenPerFromToken`     | string | Exchange rate (toToken per fromToken)                                                                       |
| `fromTokenAmountSpent`        | string | Amount of `fromToken` already spent                                                                         |
| `fromTokenAmountBalance`      | string | Remaining `fromToken` amount left in the order                                                              |
| `fromTokenAmountWithdrawn`    | string | Amount withdrawn from the order manually                                                                    |
| `toTokenAmountWithdrawn`      | string | Amount of `toToken` received from completed portions                                                        |
| `numberOfOrdersCompleted`     | number | Total number of fills completed on this order                                                               |
| `avgPriceFromTokenPerToToken` | string | Average fill price (fromToken per toToken)                                                                  |
| `avgPriceToTokenPerFromToken` | string | Average fill price (toToken per fromToken)                                                                  |
| `slippagePercentage`          | string | Slippage tolerance percentage applied to the order                                                          |
| `txDetails` (optional)        | array  | List of transaction events (see below)                                                                      |

txDetails\[] (Optional Transaction Data)

| Field                                 | Type   | Description                                                               |
| ------------------------------------- | ------ | ------------------------------------------------------------------------- |
| `txId`                                | string | Transaction ID                                                            |
| `txNumber`                            | number | Order event sequence number                                               |
| `type`                                | string | One of: `"created"`, `"filled"`, `"attempted"`, `"failed"`, `"cancelled"` |
| `attemptNumber`                       | number | Attempt number for execution                                              |
| `fromTokenAmount`                     | string | Amount attempted in this transaction                                      |
| `fromTokenAmountUSD`                  | string | USD equivalent of `fromTokenAmount`                                       |
| `toTokenAmount`                       | string | Amount of token received in this attempt                                  |
| `toTokenAmountUSD`                    | string | USD equivalent of `toTokenAmount`                                         |
| `feeTokenAmount`                      | string | Fee charged in this attempt                                               |
| `feeTokenAmountUSD`                   | string | USD equivalent of the fee                                                 |
| `time`                                | string | ISO timestamp of this event                                               |
| `priceFromTokenPerToToken` (optional) | string | Actual rate in this tx                                                    |
| `priceToTokenPerFromToken` (optional) | string | Actual reverse rate                                                       |
| `keeperWalletAddress` (optional)      | string | Executor wallet that processed the tx                                     |

Token Object

The `Token` object is a standard representation of a token:

| Field      | Type   | Description                          |
| ---------- | ------ | ------------------------------------ |
| `address`  | string | Token contract address               |
| `symbol`   | string | Symbol of the token (e.g. ETH, USDC) |
| `decimals` | number | Number of decimals used by the token |
| `name`     | string | Human-readable name of the token     |
