# Chains

The XSwap Chains Metadata API provides detailed information on supported blockchains - you can fetch all chains, filter by ecosystem, or retrieve a single chain by its ID.

***

### Endpoint

```http
GET https://xswap.link/api/chains/v1
Content-Type: application/json
```

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

***

### Request

#### Required Parameters

| Field          | Type   | Description                   |
| -------------- | ------ | ----------------------------- |
| `integratorId` | string | Your registered integrator ID |

#### Optional Parameters

| Field       | Type      | Description                                                                                                          |
| ----------- | --------- | -------------------------------------------------------------------------------------------------------------------- |
| `ecosystem` | string    | <p>Filter by ecosystem (e.g. "EVM").</p><blockquote><p>Currently only <code>EVM</code> is supported</p></blockquote> |
| `chainIds`  | string\[] | Chain IDs (e.g. `["1", "56"]`)                                                                                       |

***

### Response

The endpoint returns a JSON array of objects matching the model defined in the table below.

| Field                   | Type      | Description                                                       |
| ----------------------- | --------- | ----------------------------------------------------------------- |
| `ecosystem`             | string    | Chain ecosystem identifier (currently only "EVM" supported)       |
| `chainId`               | string    | Chain ID (e.g. `"1"`, `"56"`, `"137"`)                            |
| `name`                  | string    | Human-readable name (e.g. `"Ethereum"`)                           |
| `ccipChainId`           | number    | CCIP chain ID for cross-chain messaging                           |
| `tokenSymbol`           | string    | Native token symbol (e.g. `"ETH"`, `"MATIC"`)                     |
| `bridgeSupported`       | boolean   | `true` if cross-chain bridging is supported                       |
| `swapSupported`         | boolean   | `true` if single-chain swaps are supported                        |
| `supportedDstForBridge` | string\[] | List of chain IDs you can **bridge** **to** (e.g. `["56","137"]`) |
| `supportedDstForSwap`   | string\[] | List of chain IDs you can **swap** **to** (e.g. `["56","137"]`)   |

***

### Example Request

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

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

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

### Example Response

```json
[
    {
        "ecosystem": "evm",
        "chainId": "1",
        "name": "ethereum",
        "ccipChainId": "5009297550715157269",
        "tokenSymbol": "ETH",
        "bridgeSupported": true,
        "swapSupported": true,
        "supportedDstForBridge": ["42161", "592", ...],
        "supportedDstForSwap": ["1", "42161", ...]
    },
    {
        "ecosystem": "solana",
        "chainId": "mainnet-beta",
        "name": "solana",
        "ccipChainId": "124615329519749607",
        "tokenSymbol": "SOL",
        "bridgeSupported": true,
        "swapSupported": true,
        "supportedDstForBridge": ["56", "8453", ...],
        "supportedDstForSwap": ["mainnet-beta", ...]
    },
    ...
]
```


---

# 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.xswap.link/xswap/xpay/api-v1-reference/chains.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.
