# Orders

## Order actions

The partner has 2 main methods - Estimate amount and Create a new order.

## Estimate amount <a href="#estimate-amount" id="estimate-amount"></a>

<mark style="color:green;">`POST`</mark> `https://api.swapple.org/api/v3/estimate-amount`

Using this endpoint, the partner can assess the current terms of exchange.

Returns estimated exchange value with fees included. Note that `fromAmount` and `toAmount` are both optional, but one of them is required.

#### Headers

| Name                                         | Type   | Description                                                                      |
| -------------------------------------------- | ------ | -------------------------------------------------------------------------------- |
| public-key<mark style="color:red;">\*</mark> | String | Your public key.[Authorization](/doc/swapple-api/api-reference/authorization.md) |
| timestamp<mark style="color:red;">\*</mark>  | String | Current timestamp that was used to generate the signature in milliseconds.       |
| signature<mark style="color:red;">\*</mark>  | String | HMAC SHA512 key/value signature.                                                 |

#### Request Body

| Name                                                     | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| -------------------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| from<mark style="color:red;">\*</mark>                   | String | Currency to exchange from. [Currencies](/doc/swapple-api/api-reference/currencies.md)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| to<mark style="color:red;">\*</mark>                     | String | Currency to exchange for. [Currencies](/doc/swapple-api/api-reference/currencies.md)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| fromAmount or toAmount<mark style="color:red;">\*</mark> | String | The amount the partner wants to exchange. Transmitted in the **from** currency or **to** currency (the partner can transfer it in one currency or another (only one of them must be send to us)).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| extraFromFee                                             | String | <p>The percentage that the partner wants to withdraw when processing the payment. Your's fromAmount percentage fee. 0.005 means 0.5%. </p><p>These fees will be accumulated on a separate account of the partner, to which he will have access through the account manager.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| extraToFee                                               | String | <p>The percentage that the partner wants to withdraw when processing the payment. Your's toAmount percentage fee</p><p>0.005 means 0.5% </p><p>These fees will be accumulated on a separate account of the partner, to which he will have access through the account manager.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| rateType                                                 | String | <p>If you need to specify a rate type, then you can do this as follows. Only FLOATING or FIXED codes are supported (FLOATING by default). </p><p>FLOATING rate - when estimating or creating an order, we do not guarantee that the exchange will take place at a specific exchange rate, instead, the exchange will take place at the exchange rate that will be at the time of arrival of the currency. </p><p>FIXED rate - the rate is fixed in 2 stages: 1) the 1st fix is after the estimate - the partner makes an estimate, specifies the fixed rate and this rate is fixed for the agreed period. If the partner creates an order during this period, the rate at the estimate will be maintained. 2) the 2nd stage occurs when we expect the receipt of funds - if we receive funds during this period, we will also exchange at a fixed rate; if the rate expires, and the funds arrive after that time, the funds will be returned.</p> |
| fromNetwork                                              | String | Network to exchange from. If the currency from or the currency to is a cryptocurrency, then it is required to pass Network.[Currencies](/doc/swapple-api/api-reference/currencies.md)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| toNetwork                                                | String | Network to exchange to. If the currency from or the currency to is a cryptocurrency, then it is required to pass Network.[Currencies](/doc/swapple-api/api-reference/currencies.md)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |

{% tabs %}
{% tab title="200: OK Returns estimated exchange value." %}

```javascript
An example of a request:
{
"from": "USDT", 
"to": "CARDUAH",
"fromNetwork": "TRX",
"rateType": "FLOATING", 
"fromAmount": 1, 
"toAmount": 40 
}


An example of a response:
{
  "from": "CARDUAH",
  "to": "USDTERC20",
  "fromNetwork": "TRX",
  "fromAmount": 1500,
  "toAmount": 42.678215,
  "fromRate": 27.93713,
  "toRate": 1,
  "fromFee": 3,
  "toFee": 10,
  "extraFromFee": 7.5,
  "extraToFee": 0.264715,
  "rateType": "FLOATING",
  "rateId": "5ZaBLA2CmBofWURVVmtajn"
}
```

{% endtab %}

{% tab title="401: Unauthorized The signature was incorrectly generated." %}

```javascript
{
  "errorCode": "SECURITY_ERROR",
  "message": "Signature is invalid."
}
```

{% endtab %}

{% tab title="400: Bad Request We are currently unable to process this request." %}

```javascript
{
  "errorCode": "PROVIDER_ERROR",
  "message": "Exchange is unavailable."
}
```

{% endtab %}

{% tab title="400: Bad Request The max limit on which the user has not passed. One of the parameters (fromRate or toRate) must be "1", and the other show the rate." %}

```javascript
{
   "errorCode":"EXCEEDING_LIMITS",
   "message":"Amount 31000 is greater than max amount 29500 rate=36.73856",
   "maxAmount":"29500",
   "fromRate":"36.73856",
   "toRate":"1",
   "limit":"impossible"
}
```

{% endtab %}

{% tab title="400: Bad Request The min limit on which the user has not passed. One of the parameters (fromRate or toRate) must be "1", and the other show the rate." %}

```javascript
{
   "errorCode":"EXCEEDING_LIMITS",
   "message":"Amount 1222.01 is lower than min amount 1400 rate=883920",
   "minAmount":"1400",
   "fromRate":"883920",
   "toRate":"1"
}
```

{% endtab %}
{% endtabs %}

## Create a new order

<mark style="color:green;">`POST`</mark> `https://api.swapple.org/api/v3/create-order`

The partner can directly create an exchange.

Generates a pay-in address or pay-in URL and returns Order object with an ID field to track a transaction status.

#### Headers

| Name                                         | Type   | Description                                                                  |
| -------------------------------------------- | ------ | ---------------------------------------------------------------------------- |
| public-key<mark style="color:red;">\*</mark> | String | Your public.[Authorization](/doc/swapple-api/api-reference/authorization.md) |
| timestamp<mark style="color:red;">\*</mark>  | String | Current timestamp that was used to generate the signature in millisecond.    |
| signature<mark style="color:red;">\*</mark>  | String | HMAC SHA512 key/value signature.                                             |

#### Request Body

| Name                                               | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| -------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| from<mark style="color:red;">\*</mark>             | String | Currency to exchange from.[Currencies](/doc/swapple-api/api-reference/currencies.md)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| to<mark style="color:red;">\*</mark>               | String | Currency to exchange for.[Currencies](/doc/swapple-api/api-reference/currencies.md)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| fromNetwork                                        | String | Network to exchange from.[Currencies](/doc/swapple-api/api-reference/currencies.md)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| toNetwork                                          | String | Network to exchange for.[Currencies](/doc/swapple-api/api-reference/currencies.md)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| fromAmount or toAmount                             | String | The amount for which you need to calculate. Transmitted in the **from** currency or **to** currency.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| userId<mark style="color:red;">\*</mark>           | String | Partner's client id.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| partnerOrderId                                     | String | Partner's custom order id.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| redirectUrl<mark style="color:red;">\*</mark>      | String | For fiat deposits - where to redirect the user after payment.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| toMemo                                             | String | for XRP etc.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| extraFromFee                                       | String | <p>The percentage that the partner wants to withdraw when processing the payment. Partner's fromAmount percentage fee. 0.005 means 0.5%. </p><p>These fees will be accumulated on a separate account of the partner, to which he will have access through the account manager.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| extraToFee                                         | String | <p>The percentage that the partner wants to withdraw when processing the payment. Partner's toAmount percentage fee</p><p>0.005 means 0.5% </p><p>These fees will be accumulated on a separate account of the partner, to which he will have access through the account manager.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| rateType                                           | String | <p>If you need to specify a rate type, then you can do this as follows. Only FLOATING or FIXED codes are supported (FLOATING by default).</p><p>FLOATING rate - when estimating or creating an order, we do not guarantee that the exchange will take place at a specific exchange rate, instead, the exchange will take place at the exchange rate that will be at the time of arrival of the currency. </p><p>FIXED rate - the rate is fixed in 2 stages: 1) the 1st fix is after the estimate - the partner makes an estimate, specifies the fixed rate and this rate is fixed for the agreed period. If the partner creates an order during this period, the rate at the estimate will be maintained. 2) the 2nd stage occurs when we expect the receipt of funds - if we receive funds during this period, we will also exchange at a fixed rate; if the rate expires, and the funds arrive after that time, the funds will be returned.</p> |
| rateId<mark style="color:red;">\*</mark>           | String | Rate identifier obtained from the [estimate](#returns-estimated-exchange-value-with-fees-included.) method. Required only for fixed rate.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ipAddress                                          | String | ip address of partner's user.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| toPaymentDetails<mark style="color:red;">\*</mark> | String | User's credit card or crypto address. This determines where the partner wants to receive the currency after the exchange (if it is UAH, then it will be a card address, if crypto - a crypto address etc.)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| fromPaymentDetails                                 | String | <p>User's income credit card or crypto address.</p><p>It shows from which card or address the user made the payment.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| withdrawType                                       | String | Withdrawal can be internal or external. All the documentation is described about the external withdrawal which is configured by default (that is, we received funds, exchanged and withdrew funds to toPaymentDetails). We can not withdraw funds, that is, save the result of the exchange on the partner's account in our system (internal withdrawal). The partner can withdraw these funds by contacting the contact manager.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |

{% tabs %}
{% tab title="200: OK See below." %}

```javascript
An example of a request:
order_body = {
            "from": "CARDUAH",
            "to": "USDT",
            "toNetwork": "TRX",
            "ratetype": "FLOATING",
            "fromAmount": 1000,
            "toPaymentDetails": "TBia4uHnb3oSSZm5isP284cA7Np1v15Vhi,
            "redirectUrl": "https://google.ua",
            "userId": "1632076503",
            "partnerOrderId": "343455"
        }


An example of a response:
{
  "id": "69951ec1-6b7a-4eab-ab89-d7f3592788a1",
  "orderType": "USUAL",
  "status": "WAITING",
  "from": "CARDUAH",
  "to": "USDT",
  "toNetwork": "TRX",
  "payUrl": "https://cardgate.paymega.io/hpp/cgi_HxlZo2Gl94TOc5Zg",
  "payCryptoAddress": "",
  "payCryproMemo": "",
  "fromPaymentDetails": "",
  "toPaymentDetails": "0xB44a7dd90e28B10Fdf1283602175A0CdD09c13fB",
  "toMemo": "",
  "fromTxHash": "",
  "toTxHash": "",
  "fromAmount": 1500,
  "fromAmountReceived": 1497,
  "toAmount": 42.678215,
  "fromRate": 27.93713,
  "toRate": 1,
  "fromFee": 3,
  "toFee": 10,
  "extraFromFee": 7.5,
  "extraToFee": 0.264715,
  "redirectUrl": "https://swapple.org/",
  "userId": "4MkQ4RTk",
  "rateType": "FLOATING"
}
```

{% endtab %}

{% tab title="401: Unauthorized The signature was incorrectly generated." %}

```javascript
{
  "errorCode": "SECURITY_ERROR",
  "message": "Signature is invalid."
}
```

{% endtab %}

{% tab title="400: Bad Request We are currently unable to process this request." %}

```javascript
{
  "errorCode": "PROVIDER_ERROR",
  "message": "Exchange is unavailable."
}
```

{% endtab %}

{% tab title="400: Bad Request The max limit on which the user has not passed. One of the parameters (fromRate or toRate) must be "1", and the other show the rate." %}

```javascript
{
   "errorCode":"EXCEEDING_LIMITS",
   "message":"Amount 31000 is greater than max amount 29500 rate=36.73856",
   "maxAmount":"29500",
   "fromRate":"36.73856",
   "toRate":"1",
   "limit":"impossible"
}
```

{% endtab %}

{% tab title="400: Bad Request The min limit on which the user has not passed. One of the parameters (fromRate or toRate) must be "1", and the other show the rate." %}

```javascript
{
   "errorCode":"EXCEEDING_LIMITS",
   "message":"Amount 1222.01 is lower than min amount 1400 rate=883920",
   "minAmount":"1400",
   
```

{% endtab %}

{% tab title="400: Bad Request Invalid toPaymentDetails field." %}

```javascript
{
  "errorCode": "VALIDATION_ERROR",
  "message": ""
}
```

{% endtab %}

{% tab title="400: Bad Request Rate for FIXED rate flow was expired." %}

```javascript
{
    "errorCode": "EXPIRED_RATE",
    "message": "Rate for FIXED rate flow was expired.",
}
```

{% endtab %}
{% endtabs %}

### Order entity response

This is the response we send.

<table><thead><tr><th width="206">Field</th><th width="563.3333333333333">Description</th></tr></thead><tbody><tr><td>id</td><td>Order id.</td></tr><tr><td>status</td><td>The status of order. See <a data-mention href="/pages/RFwhHA8NRd5rC6wvDmWE">/pages/RFwhHA8NRd5rC6wvDmWE</a></td></tr><tr><td>from</td><td>Currency to exchange from. <a data-mention href="/pages/jKFtFa5ihzYYvAcJAc00">/pages/jKFtFa5ihzYYvAcJAc00</a></td></tr><tr><td>to</td><td>Currency to exchange for.<a data-mention href="/pages/jKFtFa5ihzYYvAcJAc00">/pages/jKFtFa5ihzYYvAcJAc00</a></td></tr><tr><td>fromNetwork</td><td>Network to exchange from.<a data-mention href="/pages/jKFtFa5ihzYYvAcJAc00">/pages/jKFtFa5ihzYYvAcJAc00</a></td></tr><tr><td>toNetwork</td><td>Network to exchange for.<a data-mention href="/pages/jKFtFa5ihzYYvAcJAc00">/pages/jKFtFa5ihzYYvAcJAc00</a></td></tr><tr><td>payUrl</td><td>Deposit url in case of fiat from currency. URL for a partner if there is a need to redirect his client to the payment page. It can be an empty field, but then we pass payCryptoAddress (and vice versa for payCryptoAddress)</td></tr><tr><td>payCryptoAddress</td><td>Crypto address deposit in case of crypto from currency.</td></tr><tr><td>payCryptoMemo</td><td>In case the cryptocurrency requires a memo (XRP, etc.)</td></tr><tr><td>fromAmount</td><td>Amount to exchange from.</td></tr><tr><td>toAmount</td><td>Amount to exchange for.</td></tr><tr><td>userId</td><td>Partner's client id.</td></tr><tr><td>partnerOrderId</td><td>Partner's custom order id.</td></tr><tr><td>redirectUrl</td><td>For fiat deposits, where should the user be redirected after payment?</td></tr><tr><td>toPaymentDetails</td><td>User's credit card or crypto address.</td></tr><tr><td>fromPaymentDetails</td><td>This shows from which card or address the user made the payment</td></tr><tr><td>toMemo</td><td>In case the cryptocurrency requires a memo (XRP, etc.)</td></tr><tr><td>fromTxHash</td><td>Crypto deposit transaction hash in Blockchain.</td></tr><tr><td>toTxHash</td><td>Crypto withdraw transaction hash in Blockchain.</td></tr><tr><td>fromRate</td><td>Rate to exchange from.</td></tr><tr><td>toRate</td><td>Rate to exchange for.</td></tr><tr><td>fromFee</td><td>Swapple fromAmount fee.</td></tr><tr><td>toFee</td><td>Swapple toAmount fee.</td></tr><tr><td>extraFromFee</td><td>Partner's fromAmount calculated fee.</td></tr><tr><td>extraToFee</td><td>Partner's toAmount calculated fee.</td></tr><tr><td>rateType</td><td>If you need to specify a rate type, then you can do this as follows. Only FLOATING or FIXED codes are supported (FLOATING by default).</td></tr><tr><td>orderExpirationTimetamp</td><td>Order expiration time (utc)</td></tr><tr><td>fromAmountReceived</td><td>The amount we received after deducting Swapple fees</td></tr><tr><td>fromRate</td><td>It is set depending on whether it is a pair for deposit or withdrawal (if deposit, then fromRate=1)</td></tr><tr><td>toRate</td><td>It is set depending on whether it is a pair for deposit or withdrawal (if withdrawal, then toRate=1)</td></tr></tbody></table>

## Сancel the order before the deposit is started.

<mark style="color:green;">`POST`</mark> `https://api.swapple.org/api/v3/cancel-order`

If the partner has created an order and we have not yet received the funds in the currency from (the deposit has not taken place), the partner can cancel this order by calling this endpoint. If the partner cancels this order, then even if the deposit goes in, we will not exchange it, the funds will be suspended and the partner needs to contact the account manager for their return.

#### Headers

| Name                                         | Type   | Description                                                                      |
| -------------------------------------------- | ------ | -------------------------------------------------------------------------------- |
| public-key<mark style="color:red;">\*</mark> | String | Your public key.[Authorization](/doc/swapple-api/api-reference/authorization.md) |
| timestamp<mark style="color:red;">\*</mark>  | String | Current timestamp that was used to generate the signature in millisecond.        |
| signature<mark style="color:red;">\*</mark>  | String | HMAC SHA512 key/value signature                                                  |

#### Request Body

| Name                                 | Type   | Description  |
| ------------------------------------ | ------ | ------------ |
| id<mark style="color:red;">\*</mark> | String | The order id |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  "status": "SUCCESS"
}
```

{% endtab %}

{% tab title="400: Bad Request Missing fields." %}

```javascript
{
  "errorCode": "INVALID_PARAMETERS",
  "message": "Missing parameters."
}
```

{% endtab %}

{% tab title="401: Unauthorized The signature was incorrectly generated." %}

```javascript
{
  "errorCode": "SECURITY_ERROR",
  "message": "Signature is invalid."
}
```

{% endtab %}

{% tab title="404: Not Found Order not found." %}

```javascript
{
  "errorCode": "NO_ORDER",
  "message": "There is no such order"
}
```

{% endtab %}
{% endtabs %}

## Get information about order

<mark style="color:blue;">`GET`</mark> `https://api.swapple.org/api/v3/check-order`

This endpoint is used to check the status of the order.

#### Query Parameters

| Name                                 | Type   | Description   |
| ------------------------------------ | ------ | ------------- |
| id<mark style="color:red;">\*</mark> | String | The order id. |

#### Headers

| Name                                         | Type   | Description                                                                      |
| -------------------------------------------- | ------ | -------------------------------------------------------------------------------- |
| public-key<mark style="color:red;">\*</mark> | String | Your public key.[Authorization](/doc/swapple-api/api-reference/authorization.md) |
| timestamp<mark style="color:red;">\*</mark>  | String | Current timestamp that was used to generate the signature in millisecond.        |
| signature<mark style="color:red;">\*</mark>  | String | HMAC SHA512 key/value signature.                                                 |

{% tabs %}
{% tab title="200: OK Returns Order Entity." %}

<pre class="language-javascript"><code class="lang-javascript">An example of a request:
<strong>A parameter (id={order_id}) is indicated in the url
</strong>
An example of a response:
{
"id":"639de231-01fe-4fce-9c5e-3f038e2b6be2",
"status":"WAITING",
"from":"USDT",
"to":"CARDUAH",
"fromNetwork": "TRX",
"payUrl":"https://invoice.swapple.org/order/639de231-01fe-4fce-9c5e-3f038e2b6be2",
"payCryptoAddress":"d4818dca-7c7c-42c0-9617-f7a1e5f43852",
"payCryptoMemo":"",
"fromPaymentDetails":"",
"toPaymentDetails":null,
"toMemo":"",
"fromTxHash":"",
"toTxHash":"",
"fromAmount":118.04562,
"fromAmountReceived":117.81,
"toAmount":5000.0,
"fromRate":1,
"toRate":42.44,
"fromFee":0.23562,
"toFee":0.0,
"side":"SELL",
"extraFromFee":0.0,
"extraToFee":0.0,
"redirectUrl":"https://test.com",
"userId":"111",
"partnerOrderId":null,
"fromRevenueShare":0.0,
"toRevenueShare":0.0,
"failedReason":"",
"created":"2024-02-07T10:55:29.487905+00:00",
"updated":"2024-02-07T10:55:29.545166+00:00"
}
</code></pre>

{% endtab %}

{% tab title="400: Bad Request Missing fields." %}

```javascript
{
  "errorCode": "INVALID_PARAMETERS",
  "message": "Missing parameters."
}
```

{% endtab %}

{% tab title="401: Unauthorized The signature was incorrectly generated." %}

```javascript
{
  "errorCode": "SECURITY_ERROR",
  "message": "Signature is invalid."
}
```

{% endtab %}

{% tab title="404: Not Found Order not found." %}

```javascript
{
  "errorCode": "NO_ORDER",
  "
```

{% endtab %}
{% endtabs %}

## Returns list of orders

<mark style="color:blue;">`GET`</mark> `https://api.swapple.org/api/v3/get-orders`

This is the endpoint for getting order history.

#### Query Parameters

| Name     | Type   | Description                                                                    |
| -------- | ------ | ------------------------------------------------------------------------------ |
| limit    | String | To limit max returned orders.                                                  |
| offset   | String | To offset returned orders.                                                     |
| user\_id | String | filter by userId.                                                              |
| status   | String | filter by order status. [Statuses](/doc/swapple-api/api-reference/statuses.md) |

#### Headers

| Name                                         | Type   | Description                                                                      |
| -------------------------------------------- | ------ | -------------------------------------------------------------------------------- |
| public-key<mark style="color:red;">\*</mark> | String | Your public key.[Authorization](/doc/swapple-api/api-reference/authorization.md) |
| timestamp<mark style="color:red;">\*</mark>  | String | Current timestamp that was used to generate the signature in millisecond.        |
| signature<mark style="color:red;">\*</mark>  | String | HMAC SHA512 key/value signature.                                                 |

{% tabs %}
{% tab title="200: OK Returns a list of Order entities." %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="401: Unauthorized The signature was incorrectly generated." %}

```javascript
{
  "errorCode": "SECURITY_ERROR",
  "message": "Signature is invalid."
}
```

{% endtab %}
{% endtabs %}

## Get list of available exchange pairs

<mark style="color:blue;">`GET`</mark> `https://api.swapple.org/api/v3/get-pairs-info`

This is the endpoint for getting a list of available pairs for exchange

[Currencies](/doc/swapple-api/api-reference/currencies.md)

#### Headers

| Name                                         | Type   | Description                                                                      |
| -------------------------------------------- | ------ | -------------------------------------------------------------------------------- |
| public-key<mark style="color:red;">\*</mark> | String | Your public key.[Authorization](/doc/swapple-api/api-reference/authorization.md) |
| timestamp<mark style="color:red;">\*</mark>  | String | Current timestamp that was used to generate the signature in millisecond.        |
| signature<mark style="color:red;">\*</mark>  | String | HMAC SHA512 key/value signature.                                                 |

{% tabs %}
{% tab title="200: OK Returns a list of Pair Entity." %}

<pre class="language-javascript"><code class="lang-javascript"><strong>An example of an request:
</strong><strong>https://swapple.org/api/v3/get-pairs-info
</strong>
An example of an response:
[
    {
        "from": "USDT",
        "to": "USDT",
        "fromnetwork": "TRX",
        "tonetwork": "ETH",
        "in": "1",
        "out": "1",
        "ratetype": "FIXED",
        "amount": "215808.769064",
        "tofee": "1.0 USDT",
        "fromfee": "0 USDT",
        "minamount": "15 USDT",
        "maxamount": "215808.769064 USDT"
    },
    {
        "from": "USDT",
        "to": "ETH",
        "fromnetwork": "TRX",
        "tonetwork": null,
        "in": "2388.1652",
        "out": "1",
        "ratetype": "FLOATING",
        "amount": "20.09266151",
        "tofee": "0.0041447 ETH",
        "fromfee": "0.2 %",
        "minamount": "33.88121995 USDT",
        "maxamount": "47984.59499356 USDT"
    },
    {
        "from": "USDT",
        "to": "CARDKZT",
        "fromnetwork": "TRX",
        "tonetwork": null,
        "in": "1",
        "out": "463.67",
        "ratetype": "FLOATING",
        "amount": "20378.84",
        "tofee": "1.5 %",
        "fromfee": "0.2 %",
        "minamount": "26.54578917 USDT",
        "maxamount": "43.95715788 USDT"
    }]
</code></pre>

{% endtab %}

{% tab title="401: Unauthorized The signature was incorrectly generated." %}

```javascript
{
  "errorCode": "SECURITY_ERROR",
  "message": "Signature is invalid."
}
```

{% endtab %}
{% endtabs %}

## Get exchange pair info

<mark style="color:blue;">`GET`</mark> `https://api.swapple.org/api/v3/get-pair-info`

The partner specifies a specific pair and if it is configured for them, we return the same parameters (rate, min-max amount etc) but for a specific pair.

#### Path Parameters

| Name                                             | Type   | Description                                                |
| ------------------------------------------------ | ------ | ---------------------------------------------------------- |
| currency\_from<mark style="color:red;">\*</mark> | String | [Currencies](/doc/swapple-api/api-reference/currencies.md) |
| currency\_to<mark style="color:red;">\*</mark>   | String | [Currencies](/doc/swapple-api/api-reference/currencies.md) |

#### Query Parameters

| Name        | Type   | Description                                                                                                                           |
| ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------- |
| rateType    | String | If you need to specify a rate type, then you can do this as follows. Only FLOATING or FIXED codes are supported (FLOATING by default) |
| fromnetwork | String | Network to exchange from. [Currencies](/doc/swapple-api/api-reference/currencies.md)                                                  |
| tonetwork   | String | Network to exchange for.[Currencies](/doc/swapple-api/api-reference/currencies.md)                                                    |

#### Headers

| Name       | Type   | Description                                                                      |
| ---------- | ------ | -------------------------------------------------------------------------------- |
| public-key | String | Your public key.[Authorization](/doc/swapple-api/api-reference/authorization.md) |
| timestamp  | String | Current timestamp that was used to generate the signature in millisecond.        |
| signature  | String | HMAC SHA512 key/value signature.                                                 |

{% tabs %}
{% tab title="401: Unauthorized The signature was incorrectly generated." %}

```javascript
{
  "errorCode": "SECURITY_ERROR",
  "message": "Signature is invalid."
}
```

{% endtab %}

{% tab title="200: OK Returns Pair Entity." %}

```javascript
{
  "from": "ETH",
  "to": "BTC",
  "in": "1",
  "out": "0.063716762624722",
  "amount": "0.60302220",
  "tofee": "0.0005 BTC",
  "fromfee": "0.2 %",
  "minamount": "0.027909904946227501",
  "maxamount": "9.6173098756942792860",
  "ratetype": "FLOATING",
  "side": "SELL"
}

* Amount - Our current liquidity in currency from.
  Side - This informs the partner whether this pair is for deposit or for withdrawal.

```

{% endtab %}
{% endtabs %}

### Pair Entity

This is a description of the pair model. When a partner requests a pair, it is returned the fields shown in the table below.

| Field       | Description                                                                           | Type   |
| ----------- | ------------------------------------------------------------------------------------- | ------ |
| from        | Currency to exchange from. [Currencies](/doc/swapple-api/api-reference/currencies.md) | string |
| to          | Currency to exchange for.[Currencies](/doc/swapple-api/api-reference/currencies.md)   | string |
| fromnetwork | [Currencies](/doc/swapple-api/api-reference/currencies.md)                            | string |
| tonetwork   | [Currencies](/doc/swapple-api/api-reference/currencies.md)                            | string |
| in          | Rate to exchange from.                                                                | string |
| out         | Rate to exchange for.                                                                 | string |
| fromfee     | Swapple fromAmount fee. May be percentage or static.                                  | string |
| tofee       | Swapple toAmount fee. May be percentage or static.                                    | string |
| maxamount   | The maximum amount of from currency that can be exchanged.                            | string |
| minamount   | The minimum amount of from currency that can be exchanged.                            | string |
| rateType    | Only FLOATING or FIXED codes are supported (FLOATING by default).                     | string |


---

# 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.swapple.org/doc/swapple-api/api-reference/orders.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.
