> For the complete documentation index, see [llms.txt](https://docs.kyberswap.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kyberswap.com/developer-guide/zap-as-a-service-zaas-api/how-to-guides/zap-migrate-move-between-pools.md).

# Zap Migrate — Move Between Pools

Use the ZaaS API to migrate an existing liquidity position from one pool to   another in a single transaction.

## Zap Migrate — Move Between Pools

Zap Migrate lets users move their liquidity from a source pool (or position) to a destination pool without manually removing liquidity, swapping, and re-depositing. This is useful for rebalancing across DEXes, fee tiers, or price ranges.

### Prerequisites

* Know the source position (`positionId` or tick range + pool) to migrate from.
* Know the destination pool and target tick range.
* Approve the `KSZapRouterPosition` contract on the source token if required.

{% hint style="info" %}
Curve and Balancer pools can be used as the **source** of a migration but not as the destination. See Supported Chains & DEXes.
{% endhint %}

### Flow Overview

```
GetMigrateRoute  →  (user reviews preview)  →  BuildMigrateRoute  →  send transaction
```

### Step 1 — Preview the Migrate Route

Call `GET /api/v1/migrate/route` to preview the migration before the user confirms.

**Key request parameters:**

| Parameter                          | Description                                                                                                                        |
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `dexFrom`                          | Source DEX ID — see [DEX IDs](https://docs.kyberswap.com/developer-guide/zap-as-a-service-zaas-api/zaps-supported-chains-dexes.md) |
| `dexTo`                            | Destination DEX ID                                                                                                                 |
| `poolFrom.id`                      | Source pool address                                                                                                                |
| `poolTo.id`                        | Destination pool address                                                                                                           |
| `position.id`                      | Source position NFT ID                                                                                                             |
| `position.tickLower` / `tickUpper` | Target tick range in the destination pool                                                                                          |
| `slippage`                         | Slippage tolerance in basis points                                                                                                 |

**Key response fields:**

| Field                    | Description                                    |
| ------------------------ | ---------------------------------------------- |
| `poolDetails`            | Pool info after zapping for destination pools  |
| `positionDetails`        | Estimated new position in the destination pool |
| `zapDetails.priceImpact` | Combined price impact of the migration         |
| `route`                  | Encoded route to pass to `BuildMigrateRoute`   |

### Step 2 — Build the Transaction

Call `POST /api/v1/migrate/route/build` with the `route` from Step 1:

```bash
curl -X POST "https://zap-api.kyberswap.com/{chain}/api/v1/migrate/route/build" \
-H "content-type: application/json" \
-H "x-client-id: your-client-id" \
-d '{
  "sender": "0xYourAddress",
  "recipient": "0xYourAddress",
  "route": "<route from GetMigrateRoute response>",
  "deadline": 1800000000
}'
```

### Step 3 — Send the Transaction

```javascript
const tx = await signer.sendTransaction({
  to:    buildResponse.routerAddress,
  data:  buildResponse.calldata,
  value: buildResponse.value,
  gasLimit: getMigrateRouteResponse.gas * 2,
});
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.kyberswap.com/developer-guide/zap-as-a-service-zaas-api/how-to-guides/zap-migrate-move-between-pools.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
