> For the complete documentation index, see [llms.txt](https://titan-exchange.gitbook.io/titan/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://titan-exchange.gitbook.io/titan/developer-doc/swap-api/guides/configure-routing.md).

# Configure Routing

Control which venues, providers, and route shapes Titan uses when computing swap quotes.

Titan routes through [Argos](/titan/developer-doc/getting-started/introduction.md) across all available venues and providers by default. You can restrict or filter routing using the parameters below — all go into the `swap` or `transaction` object of your request.

## Routing parameters

These fields are part of [`SwapParams`](/titan/developer-doc/swap-api/reference/types.md):

* **`dexes`** (`string[]`) — Only route through these venues. Venues are on-chain liquidity sources — Raydium, Phoenix, Meteora, Orca, Whirlpool, PumpFun, and others.
* **`excludeDexes`** (`string[]`) — Exclude these venues from routing. All other venues remain available.
* **`venueAllowlist`** (`Pubkey[]`) — Constrain quotes to routes that only use venues (pools) whose **address** is in this list. Filters by individual venue address, unlike `dexes`/`excludeDexes` which filter by venue label.- **`venueBanlist`** (`Pubkey[]`) — Exclude any route that uses a venue (pool) whose address is in this list. The banlist overrides `venueAllowlist` — a venue in both lists is always excluded.- **`noVoteAccounts`** (`bool`) — Exclude a server-configured set of market-maker venues from routing. When absent or false, those venues are included as normal.- **`providers`** (`string[]`) — Only use these quote providers. Providers are the quote sources that compete to give you the best price — `Titan`, `Metis`, `Okx`, and others.
* **`onlyDirectRoutes`** (`bool`) — Skip multi-hop routes. Useful when you want predictable gas costs or need to avoid complex route topologies.
* **`addSizeConstraint`** (`bool`) — If true, only quotes with transactions that fit within the size constraint are returned.
* **`sizeConstraint`** (`u32`) — Maximum transaction size in bytes when `addSizeConstraint` is set. Values are clamped to the requested format's maximum: 1232 bytes for V0 and 4096 bytes for V1.
* **`accountsLimitTotal`** (`u16`) — Max total accounts per route. Transaction V1 supports at most 64 addresses; higher values are clamped.
* **`accountsLimitWritable`** (`u16`) — Max writable accounts per route. If not set, any number that still allows an executable transaction is allowed (currently 64).

The transaction format is selected with `transaction.transactionFormat`: `0` for V0 (the default) or `1` for Transaction V1. See [NewSwapQuoteStream → Transaction format](/titan/developer-doc/swap-api/reference/direct/new-swap-quote-stream.md#transaction-format) for compatibility and activation requirements.

{% hint style="info" %}
Providers and venues are independent filters. Providers decide *who computes* the route; venues decide *where liquidity is sourced*. You can combine both.
{% endhint %}

## Example: combining multiple filters

{% tabs %}
{% tab title="Titan Direct" %}

```typescript
import WebSocket from 'ws';
import { Encoder } from '@msgpack/msgpack';
import bs58 from 'bs58';
import { zstdCompress } from 'http-encoding';

const encoder = new Encoder({ useBigInt64: true });

const url = `${process.env.TITAN_ENDPOINT}?auth=${process.env.TITAN_API_KEY}`;
const ws = new WebSocket(url, [
  'v1.api.titan.ag+zstd',
  'v1.api.titan.ag',
]);

let useCompression = false;
let requestId = 0;

ws.on('open', async () => {
  useCompression = ws.protocol !== 'v1.api.titan.ag';

  const encoded = encoder.encode({
    id: requestId++,
    data: {
      NewSwapQuoteStream: {
        swap: {
          inputMint: bs58.decode('So11111111111111111111111111111111111111112'),
          outputMint: bs58.decode('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'),
          amount: 1_000_000_000n,
          slippageBps: 50,
          dexes: ['Raydium', 'Whirlpool', 'Phoenix'],  // Only these venues
          providers: ['Titan', 'Metis'],                 // Only these providers
          onlyDirectRoutes: true,                        // No multi-hop
          addSizeConstraint: true,
          accountsLimitTotal: 40,
        },
        transaction: {
          userPublicKey: bs58.decode('YOUR_WALLET_PUBLIC_KEY'),
        },
      },
    },
  });
  ws.send(useCompression ? await zstdCompress(encoded) : encoded);
});
```

{% endtab %}

{% tab title="Titan Gateway" %}

```typescript
import { decode } from '@msgpack/msgpack';

const params = new URLSearchParams({
  inputMint: 'So11111111111111111111111111111111111111112',
  outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
  amount: '1000000000',
  userPublicKey: 'YOUR_WALLET_PUBLIC_KEY',
  slippageBps: '50',
  dexes: 'Raydium,Whirlpool,Phoenix',
  providers: 'Titan,Metis',
  onlyDirectRoutes: 'true',
  addSizeConstraint: 'true',
  accountsLimitTotal: '40',
});

const res = await fetch(
  `${process.env.TITAN_ENDPOINT}/api/v1/quote/swap?${params}`,
  {
    headers: {
      'Authorization': `Bearer ${process.env.TITAN_API_KEY}`,
      'Accept': 'application/vnd.msgpack',
    },
  }
);

const buffer = await res.arrayBuffer();
const quotes = decode(new Uint8Array(buffer)) as any;
```

{% endtab %}
{% endtabs %}

## List available venues and providers

Query the server at runtime to discover which venues and providers are currently active.

{% tabs %}
{% tab title="Titan Direct" %}

```typescript
// List all venues with their program IDs
sendRequest({ GetVenues: { includeProgramIds: true } });

// List all active providers
sendRequest({ ListProviders: {} });
```

{% endtab %}

{% tab title="Titan Gateway" %}

```typescript
import { decode } from '@msgpack/msgpack';

const venuesRes = await fetch(
  `${process.env.TITAN_ENDPOINT}/api/v1/venues?includeProgramIds=true`,
  {
    headers: {
      'Authorization': `Bearer ${process.env.TITAN_API_KEY}`,
      'Accept': 'application/vnd.msgpack',
    },
  }
);
const venues = decode(new Uint8Array(await venuesRes.arrayBuffer())) as any;
console.log('Available venues:', venues.labels);

const providersRes = await fetch(
  `${process.env.TITAN_ENDPOINT}/api/v1/providers`,
  {
    headers: {
      'Authorization': `Bearer ${process.env.TITAN_API_KEY}`,
      'Accept': 'application/vnd.msgpack',
    },
  }
);
const providers = decode(new Uint8Array(await providersRes.arrayBuffer())) as any[];
console.log('Active providers:', providers.map((p: any) => p.id));
```

{% endtab %}
{% endtabs %}

## Related pages

* [Stream & Execute a Swap](/titan/developer-doc/swap-api/guides/stream-and-execute.md) — full guide with transaction building and error handling
* [Fee Collection](/titan/developer-doc/swap-api/guides/fee-collection.md) — add platform fees to swap transactions
* [Types Reference](/titan/developer-doc/swap-api/reference/types.md) — `SwapParams`, `TransactionParams`, and all type definitions
* [GetVenues / ListProviders Reference](/titan/developer-doc/swap-api/reference/direct/venues-providers.md) — complete response schemas
