> For the complete documentation index, see [llms.txt](https://docs.xswap.link/xswap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xswap.link/xswap/xpay/api-v1-reference/tokens.md).

# Tokens

The XSwap Tokens API returns token metadata for a given chain—or a single token if you supply its address.

***

### Endpoint

```http
GET https://xswap.link/api/tokens/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  |
| `chainIds`     | string\[] | Chain IDs (e.g. `["1", "56"]`) |

#### Optional Parameters

| Name        | Type      | Description                                                                                                                 |
| ----------- | --------- | --------------------------------------------------------------------------------------------------------------------------- |
| `ecosystem` | string    | <p></p><p>Filter by ecosystem (e.g. "EVM").</p><blockquote><p>Currently only <code>EVM</code> is supported</p></blockquote> |
| `addresses` | string\[] | Token contract addresses                                                                                                    |

***

### Response

| Field      | Type   | Description                            |
| ---------- | ------ | -------------------------------------- |
| `address`  | string | Token contract address                 |
| `symbol`   | string | Token symbol (e.g. `"ETH"`)            |
| `name`     | string | Token name (e.g. `"Ether"`)            |
| `decimals` | number | Number of decimals                     |
| `image`    | string | URL to token’s rounded 64x64 webp logo |

***

### Example Requests

```javascript
;(async () => {
  const payload = {
    integratorId: "xxx"
    chainId: "1"
  };

  const encoded = encodeURIComponent(JSON.stringify(payload));
  const url = `https://xswap.link/api/tokens/v1?data=${encoded}`;

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

### Example Response

```json
[
    {
        "address": "0x0000000000000000000000000000000000000000",
        "symbol": "ETH",
        "decimals": 18,
        "name": "Ether",
        "image": "https://xswap.link/assets/tokens/1_0x0000000000000000000000000000000000000000_ETH.webp"
    },
    {
        "address": "0x8fe815417913a93ea99049fc0718ee1647a2a07c",
        "symbol": "XSWAP",
        "decimals": 18,
        "name": "XSWAP Token",
        "image": "https://xswap.link/assets/tokens/1_0x8fe815417913a93ea99049fc0718ee1647a2a07c_XSWAP.webp"
    },
    ...
]
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.xswap.link/xswap/xpay/api-v1-reference/tokens.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
