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

# Swaps

> Swap any token to another token with route options across DEXs, bridges, and liquidity venues.

Socket supports token swaps for apps that need users to convert from the asset they hold into the asset they need. Swaps can happen on the same chain or be combined with bridging as part of a cross-chain route.

## Swap with Socket

Socket is useful as a swap layer because it can evaluate multiple execution venues and return executable routes through one integration:

* **Any-token conversion**: Route between supported assets without forcing users to visit separate swap or bridge interfaces.
* **Best execution options**: Compare routes by price, speed, output amount, and provider availability.
* **Same-chain simplicity**: Route entirely through DEX liquidity when the input and output assets are on the same network.
* **Cross-chain composition**: Combine swap and bridge execution when the user starts and ends on different chains.

## Who this is for

Use swaps when users need to trade into a required token, rebalance wallet assets, enter a market, or complete an app flow without leaving your product experience.

## How it works

When `originChainId` and `destinationChainId` are identical, Socket routes the swap entirely on-chain through the best available DEX. The API returns a transaction that the user submits directly from their wallet.

## Supported DEX providers

| Provider ID | Display name |
| ----------- | ------------ |
| `bebopPmm`  | Bebop        |
| `kyberswap` | Kyberswap    |
| `openocean` | OpenOcean    |
| `zeroxv2`   | 0x           |

You can use the `includeProvider` and `excludeProvider` parameters on `/v3/swap/quote` to control which DEXs are considered for the swap.

## Example

```bash theme={null}
curl -sS -G "https://dedicated-backend.socket.tech/v3/swap/quote" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "affiliate: YOUR_AFFILIATE_ID" \
  --data-urlencode "userOps=tx" \
  --data-urlencode "originChainId=42161" \
  --data-urlencode "destinationChainId=42161" \
  --data-urlencode "inputToken=0xaf88d065e77c8cC2239327C5EDb3A432268e5831" \
  --data-urlencode "outputToken=0x912ce59144191c1204e64559fe8253a0e49e6548" \
  --data-urlencode "inputAmount=10000000" \
  --data-urlencode "userAddress=0x1111111111111111111111111111111111111111" \
  --data-urlencode "receiverAddress=0x1111111111111111111111111111111111111111" \
  --data-urlencode "slippage=0.5"
```

## Key rules

* `inputToken` and `outputToken` must be different for same-chain swaps.
* `userAddress` is required for transaction routes.
* `receiverAddress` must be valid on the destination chain (same chain in this case).
* All amounts are expressed in the token's smallest unit (wei for EVM).
* The native token address is `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE`.

<CardGroup cols={2}>
  <Card title="API Integration Guide" icon="code" href="/integrate/integration-guides/socket-api">
    Full guide to integrating the Socket Swap V3 API
  </Card>

  <Card title="Get API Access" icon="key" href="/integrate/get-api-access">
    Set up your API credentials
  </Card>
</CardGroup>
