# Fetch swaps

<mark style="color:green;">`POST`</mark> `https://app.thedex.cloud/api/v1/swaps`

#### Headers

| Name                                             | Type   | Description                        |
| ------------------------------------------------ | ------ | ---------------------------------- |
| X-EX-APIKEY<mark style="color:red;">\*</mark>    | String | Your API key                       |
| X-EX-PAYLOAD<mark style="color:red;">\*</mark>   | String | Body to base64                     |
| X-EX-SIGNATURE<mark style="color:red;">\*</mark> | String | Encrypted body with the secret key |

#### Request Body

```json
{
    "from": "Number", // timestamp
    "to": "Number" // timestamp
}
```

**Request JSON attributes**

<table><thead><tr><th>Name</th><th width="149">Type</th><th>Description</th></tr></thead><tbody><tr><td>from<mark style="color:red;">*</mark></td><td>Long</td><td>Timestamp (from) in milliseconds since Unix epoch</td></tr><tr><td>to<mark style="color:red;">*</mark></td><td>Long</td><td>Timestamp (to) in milliseconds since Unix epoch</td></tr></tbody></table>

**Response body**

{% tabs %}
{% tab title="200 swaps" %}

```json
[
    {
        "id": "String",
        "receiveMonetary": "String",
        "receiveAmount": "String",
        "send": [
            {
                "monetary": "String",
                "amount": "String",
                "amountWithRate": "String",
                "rate": "String",
                "balanceBefore": "String",
                "balanceAfter": "String"
            }
        ],
        "userSwapCommission": "Null/String",
        "uniqueUserId": "String",
        "statusName": "String",
        "status": "Integer",
        "createDate": "String",
        "modifiedDate": "String",
        "type": "String",
        "balanceBefore": "String",
        "balanceAfter": "String"
    }
]
```

{% endtab %}
{% endtabs %}

**Response JSON attributes**

<table><thead><tr><th></th><th width="190"></th><th></th></tr></thead><tbody><tr><td><code>"id"</code></td><td><code>String</code></td><td>Unique identifier</td></tr><tr><td><code>"receiveMonetary"</code></td><td><code>String</code></td><td>Received currency</td></tr><tr><td><code>"receiveAmount"</code></td><td><code>String</code></td><td>Received amount</td></tr><tr><td>"<code>userSwapCommission</code>"</td><td><code>String</code></td><td>User swap commission</td></tr><tr><td><code>"uniqueUserId"</code></td><td><code>String</code></td><td>Unique User ID</td></tr><tr><td><code>"status"</code></td><td><code>Integer</code></td><td>Swap status code</td></tr><tr><td><code>"statusName"</code></td><td><code>String</code></td><td>Swap status description</td></tr><tr><td><code>"createDate"</code></td><td><code>String</code></td><td>Creation date</td></tr><tr><td><code>"modifiedDate"</code></td><td><code>String</code></td><td>Modified date</td></tr><tr><td><code>"type"</code></td><td><code>String</code></td><td>Swap type (Auto or Manual)</td></tr><tr><td><code>"balanceBefore"</code></td><td><code>String</code></td><td>Balance of received monetary before swap</td></tr><tr><td><code>"balanceAfter"</code></td><td><code>String</code></td><td>Balance of received monetary after swap</td></tr><tr><td><code>"send"</code></td><td><code>Array</code></td><td>Sent currencies details</td></tr><tr><td><code>"send[0].monetary"</code></td><td><code>String</code></td><td>Sent currency</td></tr><tr><td><code>"send[0].amount"</code></td><td><code>String</code></td><td>Sent amount</td></tr><tr><td><code>"send[0].amountWithRate"</code></td><td><code>String</code></td><td>Amount with applied rate</td></tr><tr><td><code>"send[0].rate"</code></td><td><code>String</code></td><td>Rate</td></tr><tr><td><code>"send[0].balanceBefore"</code></td><td><code>String</code></td><td>Balance of send monetary before swap</td></tr><tr><td><code>"send[0].balanceAfter"</code></td><td><code>String</code></td><td>Balance of send monetary after swap</td></tr></tbody></table>

**Curl request**

```powershell
curl --location --request POST 'https://app.thedex.cloud/api/v1/swaps' \
--header 'X-EX-APIKEY: <string>' \
--header 'X-EX-PAYLOAD: <string>' \
--header 'X-EX-SIGNATURE: <string>' \
--header 'Content-Type: application/json' \
--header 'Accept: */*' \
--data '{
  "from": "<Long>",
  "to": "<Long>"
}'
```

**Example Curl**

```powershell
curl --location --request POST 'https://app.thedex.cloud/api/v1/swaps' \
--header 'X-EX-APIKEY: test_api_key_123456' \
--header 'X-EX-PAYLOAD: eyJmcm9tIjoxNjAyODAwMDAwMCwidG8iOjE2MDI4MDYwMDAwfQ==' \
--header 'X-EX-SIGNATURE: dummy_signature_abc123' \
--header 'Content-Type: application/json' \
--header 'Accept: */*' \
--data-raw '{
  "from": 1602800000000,
  "to": 1602806000000
}'
```


---

# 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.thedex.cloud/documentation/swaps/fetch-swaps.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.
