# History

***

### Endpoint

```http
GET https://swapper.finance/api/history/v1
Content-Type: application/json
```

All query parameters are passed as a JSON payload in the `data` query parameter, URL-encoded.

***

### Request

#### Required Parameters

| Name          | Type   | Description                                |
| ------------- | ------ | ------------------------------------------ |
| integratorId  | string | Your registered integrator ID              |
| walletAddress | string | EVM wallet address to retrieve history for |

#### Optional Parameters

| Name     | Type             | Description                                                                                            |
| -------- | ---------------- | ------------------------------------------------------------------------------------------------------ |
| chainIds | string\[]        | Array of supported chain IDs. See [Supported Chains](/api-v1-reference/types.md#supported-chains).     |
| actions  | HistoryAction\[] | Array of transaction types. See [Transaction Actions](/api-v1-reference/types.md#transaction-actions). |

***

### Response

Array of `HistoryEntry` objects sorted by `date` (descending).

<table><thead><tr><th>Field</th><th width="251.84375">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>chainId</code></td><td>string</td><td>Blockchain network ID where the transaction occurred. See <a href="/pages/rWYgw2RcngNhwR7GM92R#supported-chains">Supported Chains</a>.</td></tr><tr><td><code>txHash</code></td><td>string | null</td><td>Transaction hash (if available).</td></tr><tr><td><code>date</code></td><td>string (ISO 8601)</td><td>UTC timestamp of the transaction. Example: <code>2025-01-01T12:00:00.000Z</code></td></tr><tr><td><code>action</code></td><td>string</td><td>Transaction type. See <a href="/pages/rWYgw2RcngNhwR7GM92R#transaction-actions">Transaction Actions</a>.</td></tr><tr><td><code>tokenAddress</code></td><td>string</td><td>ERC-20 token contract address (lowercased).</td></tr><tr><td><code>tokenAmount</code></td><td>string | null</td><td>Amount of tokens involved in the transaction.</td></tr><tr><td><code>priceUsd</code></td><td>string</td><td>USD value of the transaction. </td></tr><tr><td><code>status</code></td><td>string</td><td>Status of the transaction. (<code>Success</code>, <code>Pending</code> or <code>Error</code>)</td></tr></tbody></table>

***

### Example Request

```javascript
;(async () => {
  const payload = {
    integratorId: "xxx",
    walletAddress: "0x0..."
  };

  const encoded = encodeURIComponent(JSON.stringify(payload));
  const url = `https://swapper.finance/api/history/v1?data=${encoded}`;

  const res = await fetch(url, {
    method: "GET",
    headers: { "Content-Type": "application/json" },
  });
  const tokens = await res.json();
  console.log("Fetched history:", tokens);
})();
```

***

### Example Response

```json
[
    {
        "chainId": "1",
        "txHash": "0x0...",
        "date": "2025-01-10T00:00:00.000Z",
        "action": "SELL",
        "tokenAddress": "0x0...",
        "tokenAmount": "37853336658481234",
        "priceUsd": "59.49",
        "status": "Success"
    },
    ...
]
```


---

# 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.swapper.finance/api-v1-reference/history.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.
