> ## Documentation Index
> Fetch the complete documentation index at: https://docs.raydium.io/llms.txt
> Use this file to discover all available pages before exploring further.

# AMM Routing

> A program that chains swaps across multiple pools (AMM v4, CPMM, CLMM, Stable) in a single transaction, with user-controlled intermediate ATAs.

## What it is

The AMM Routing program is a CPI router that executes multi-hop swaps across Raydium's AMM pools in one on-chain transaction. Instead of bundling N child-program CPIs in your client code, you can invoke the router once and pass the route as a list of accounts. The router dispatches each hop to the correct pool program (AMM v4, CPMM, CLMM, or Stable) and chains the output of one hop as the input to the next.

**Program ID:** see [`reference/program-addresses`](/reference/program-addresses).

**Devnet:** `DRaybByLpbUL57LJARs3j8BitTxVfzBg351EaMr5UTCd`.

**Account model:** every intermediate token flows through a **user-owned ATA**. The user signs with their input ATA and provides each intermediate ATA in the accounts list. The recommended swap entrypoints are tag 8 (`SwapBaseIn`) and tag 9 (`SwapBaseOut`), which accept an empty `limit_prices` deque when no CLMM hop is involved.

## Chapter contents

<CardGroup cols={2}>
  <Card title="Overview" icon="circle-info" href="/products/routing/overview">
    What the router does, why it exists, and when you should use it vs. client-side stitching.
  </Card>

  <Card title="Accounts" icon="database" href="/products/routing/accounts">
    User-ATA layout, per-hop account block, and how the router dispatches by reading the program ID slot.
  </Card>

  <Card title="Math" icon="function" href="/products/routing/math">
    The router does no math. Each hop prices off its own curve. Slippage compounds over hops; `limit_prices` for CLMM.
  </Card>

  <Card title="Instructions" icon="terminal" href="/products/routing/instructions">
    Reference for the six enabled instruction variants: exact-input / exact-output Current (8 / 9) and Legacy (0 / 1) swaps, plus the wSOL utilities (5 / 6).
  </Card>

  <Card title="Fees" icon="percent" href="/products/routing/fees">
    No router fee. Each hop pays its underlying program's fee. CU cost scales linearly with hop count.
  </Card>

  <Card title="Code demos" icon="code" href="/products/routing/code-demos">
    TypeScript examples using the SDK and raw instruction building.
  </Card>
</CardGroup>

## When to read this

* You need to execute a route with 2+ hops in one transaction.
* You are implementing a program that CPIs into the router.
* You are an aggregator deciding between client-side stitching and on-chain routing.

## Where to go next

* [`products/routing/overview`](/products/routing/overview) — the design and motivation.
* [`products/routing/instructions`](/products/routing/instructions) — the full instruction reference.
* [`integration-guides/routing-and-mev`](/integration-guides/routing-and-mev) — broader routing strategy.
* [`integration-guides/aggregator`](/integration-guides/aggregator) — when to use the router in an aggregator context.

Sources:

* [`reference/program-addresses`](/reference/program-addresses) for the canonical program ID
* `raydium-io/raydium-programs/raydium-route` for the source code
