# Get Order

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

GET https://solana-mainnet.g.alchemy.com/v2/{apiKey}/swap/v2/order

Returns a swap quote for `inputMint` → `outputMint`.

Reference: https://www.alchemy.com/docs/chains/solana/solana-trader-api/get-swap-order

## Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| apiKey | string | Yes | For higher throughput, [create your own API key](https://dashboard.alchemy.com/signup). |

## Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| inputMint | string | Yes | Mint address of the input token. |
| outputMint | string | Yes | Mint address of the output token. |
| amount | string | Yes | Amount to swap in the smallest unit of the input token (lamports for native SOL, base units for SPL tokens). Refers to the input token by default, or to the output token when `swapMode` is `ExactOut`.  |
| taker | string | No | Public key of the wallet that will sign the transaction. When omitted, the response returns a quote only and `transaction` is `null`.  |
| receiver | string | No | Wallet to receive the output instead of `taker` (omit to keep it with `taker`). Expects a wallet address, not a token account. Missing ATAs are created automatically.  |
| swapMode | string | No | How `amount` is interpreted. |
| slippageBps | integer | No | Slippage tolerance in basis points, 0–10000. `rtse` (automatic slippage) is not supported.  |
| priorityFeeLamports | integer | No | Custom priority fee, in lamports. Only used when `broadcastFeeType` is set; otherwise ignored and the fee is estimated automatically. Added to `jitoTipLamports` (if set) to form the fee total that `broadcastFeeType` applies.  |
| jitoTipLamports | integer | No | Custom Jito tip, in lamports (minimum 1000). Only used when `broadcastFeeType` is set; otherwise ignored and the fee is estimated automatically. Added to `priorityFeeLamports` (if set) to form the fee total that `broadcastFeeType` applies.  |
| broadcastFeeType | string | No | How your custom fee (`priorityFeeLamports` + `jitoTipLamports`) is applied. When omitted, or sent without `priorityFeeLamports` or `jitoTipLamports`, the fee is estimated automatically.  |
| excludeDexes | string | No | Comma-separated list of DEX labels to exclude from routing. Labels are case-sensitive (for example, `Raydium,Orca+V2,Meteora+DLMM`).  |
| excludeRouters | string | No | Not supported yet; routing uses only `metis`, so excluding it returns an error. |
| payer | string | No | Wallet that pays transaction costs (fees, Jito tip, token-account rent) for `taker`; the taker still signs and pays the trade amount. Any public key can be used; no effect if equal to `taker`. See `errorCode` for funding failures. Does not change `mode`.  |
| referralFee | integer | No | Integrator fee in basis points (50–255). Must be sent with `referralAccount`. |
| referralAccount | string | No | Referral account in the referral program. Must be sent with `referralFee`. The fee is charged in the output token on `ExactIn` and in the input token on `ExactOut`, and is paid into that mint’s fee token account under this referral account. That account must already exist.  |

## Code Examples

### cURL

```bash
curl --request GET \
  --url 'https://solana-mainnet.g.alchemy.com/v2/docs-demo/swap/v2/order?inputMint=So11111111111111111111111111111111111111112&outputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&amount=1000000000'
```

### JavaScript

```javascript
const options = {method: 'GET'};

fetch('https://solana-mainnet.g.alchemy.com/v2/docs-demo/swap/v2/order?inputMint=So11111111111111111111111111111111111111112&outputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&amount=1000000000', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://solana-mainnet.g.alchemy.com/v2/docs-demo/swap/v2/order?inputMint=So11111111111111111111111111111111111111112&outputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&amount=1000000000"

response = requests.get(url)

print(response.text)
```

### Go

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://solana-mainnet.g.alchemy.com/v2/docs-demo/swap/v2/order?inputMint=So11111111111111111111111111111111111111112&outputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&amount=1000000000"

	req, _ := http.NewRequest("GET", url, nil)

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
```

### Java

```java
HttpResponse<String> response = Unirest.get("https://solana-mainnet.g.alchemy.com/v2/docs-demo/swap/v2/order?inputMint=So11111111111111111111111111111111111111112&outputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&amount=1000000000")
  .asString();
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://solana-mainnet.g.alchemy.com/v2/docs-demo/swap/v2/order?inputMint=So11111111111111111111111111111111111111112&outputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&amount=1000000000");
var client = new RestClient(options);
var request = new RestRequest("");
var response = await client.GetAsync(request);

Console.WriteLine("{0}", response.Content);

```


## Operation Specification

```yaml
path: /{apiKey}/swap/v2/order
method: GET
operation:
  summary: Get Order
  description: Returns a swap quote for `inputMint` → `outputMint`.
  x-compute-units: 100
  x-rate-limit-cus: 80
  operationId: get-swap-order
  parameters:
    - name: apiKey
      in: path
      required: true
      schema:
        type: string
        default: docs-demo
      description: For higher throughput, [create your own API key](https://dashboard.alchemy.com/signup).
    - name: inputMint
      in: query
      required: true
      description: Mint address of the input token.
      schema:
        type: string
      example: So11111111111111111111111111111111111111112
    - name: outputMint
      in: query
      required: true
      description: Mint address of the output token.
      schema:
        type: string
      example: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
    - name: amount
      in: query
      required: true
      description: |
        Amount to swap in the smallest unit of the input token (lamports for native SOL, base units for SPL tokens). Refers to the input token by default, or to the output token when `swapMode` is `ExactOut`.
      schema:
        type: string
      example: '1000000000'
    - name: taker
      in: query
      required: false
      description: |
        Public key of the wallet that will sign the transaction. When omitted, the response returns a quote only and `transaction` is `null`.
      schema:
        type: string
      example: GkwFnmMDvn3HGMpJpWBg8tgJxr3NxNvg3AXxvXVPbRGJ
    - name: receiver
      in: query
      required: false
      description: |
        Wallet to receive the output instead of `taker` (omit to keep it with `taker`). Expects a wallet address, not a token account. Missing ATAs are created automatically.
      schema:
        type: string
    - name: swapMode
      in: query
      required: false
      description: How `amount` is interpreted.
      schema:
        type: string
        enum:
          - ExactIn
          - ExactOut
        oneOf:
          - type: string
            title: ExactIn
            description: Spend exactly `amount`; slippage sets the minimum you receive.
          - type: string
            title: ExactOut
            description: Receive exactly `amount`; slippage sets the maximum you spend.
    - name: slippageBps
      in: query
      required: false
      description: |
        Slippage tolerance in basis points, 0–10000.

        `rtse` (automatic slippage) is not supported.
      schema:
        type: integer
        minimum: 0
        maximum: 10000
        default: 50
      example: 50
    - name: priorityFeeLamports
      in: query
      required: false
      description: |
        Custom priority fee, in lamports. Only used when `broadcastFeeType` is set; otherwise ignored and the fee is estimated automatically. Added to `jitoTipLamports` (if set) to form the fee total that `broadcastFeeType` applies.
      schema:
        type: integer
    - name: jitoTipLamports
      in: query
      required: false
      description: |
        Custom Jito tip, in lamports (minimum 1000). Only used when `broadcastFeeType` is set; otherwise ignored and the fee is estimated automatically. Added to `priorityFeeLamports` (if set) to form the fee total that `broadcastFeeType` applies.
      schema:
        type: integer
        minimum: 1000
    - name: broadcastFeeType
      in: query
      required: false
      description: |
        How your custom fee (`priorityFeeLamports` + `jitoTipLamports`) is applied.

        When omitted, or sent without `priorityFeeLamports` or `jitoTipLamports`, the fee is estimated automatically.
      schema:
        type: string
        enum:
          - maxCap
          - exactFee
        oneOf:
          - type: string
            title: exactFee
            description: Use exactly your fee total.
          - type: string
            title: maxCap
            description: Use the automatic estimate, capped at your fee total.
    - name: excludeDexes
      in: query
      required: false
      description: |
        Comma-separated list of DEX labels to exclude from routing. Labels are case-sensitive (for example, `Raydium,Orca+V2,Meteora+DLMM`).
      schema:
        type: string
    - name: excludeRouters
      in: query
      required: false
      description: Not supported yet; routing uses only `metis`, so excluding it returns an error.
      schema:
        type: string
    - name: payer
      in: query
      required: false
      description: |
        Wallet that pays transaction costs (fees, Jito tip, token-account rent) for `taker`; the taker still signs and pays the trade amount. Any public key can be used; no effect if equal to `taker`. See `errorCode` for funding failures. Does not change `mode`.
      schema:
        type: string
    - name: referralFee
      in: query
      required: false
      description: Integrator fee in basis points (50–255). Must be sent with `referralAccount`.
      schema:
        type: integer
        minimum: 50
        maximum: 255
    - name: referralAccount
      in: query
      required: false
      description: |
        Referral account in the referral program. Must be sent with `referralFee`. The fee is charged in the output token on `ExactIn` and in the input token on `ExactOut`, and is paid into that mint’s fee token account under this referral account. That account must already exist.
      schema:
        type: string
  responses:
    '200':
      description: Quote, plus an unsigned transaction when a funded `taker` is supplied. Insufficient funding returns `200` with an empty transaction and error fields.
      content:
        application/json:
          schema:
            type: object
            description: Quote fields plus an assembled transaction when a taker was supplied.
            properties:
              mode:
                type: string
                description: |
                  Compatibility mode label: `ultra` or `manual`. Informational only; both are processed identically.
              inputMint:
                type: string
                description: Mint of the input token, echoed back.
              outputMint:
                type: string
                description: Mint of the output token, echoed back.
              inAmount:
                type: string
                description: Input amount used for the quote, in base units of the input mint.
              outAmount:
                type: string
                description: |
                  Estimated output amount before slippage, in base units of the output mint.
              otherAmountThreshold:
                type: string
                description: |
                  Slippage threshold, in base units. On `ExactIn` this is the minimum output amount after slippage; on `ExactOut` this is the maximum input amount after slippage. Always present.
              swapMode:
                type: string
                description: Swap mode used to build the quote.
                enum:
                  - ExactIn
                  - ExactOut
              slippageBps:
                type: integer
                description: Slippage tolerance in basis points.
              priceImpact:
                type: number
                description: |
                  Price impact of the swap, in percentage points (for example, `-0.1` means -0.1%). Always present.
              priceImpactPct:
                type: string
                description: |
                  Price impact as a decimal fraction string. Divide `priceImpact` by 100 to reconcile the two values.
              inUsdValue:
                type: number
                description: |
                  USD value of the input amount at quote time. Omitted (not `null`) when the input mint cannot be priced.
              outUsdValue:
                type: number
                description: |
                  USD value of the output amount at quote time. Omitted (not `null`) when the output mint cannot be priced.
              swapUsdValue:
                type: number
                description: |
                  USD value of the swap, equal to either `inUsdValue` or `outUsdValue` depending on the token pair. Omitted when neither side can be priced.
              swapType:
                type: string
                description: Quote routing category. Always `aggregator`.
              gasless:
                type: boolean
                description: |
                  `true` only when a ready transaction uses a `payer` different from the `taker`; otherwise `false`.
              router:
                type: string
                description: Router that produced the quote. Always `metis`.
              routePlan:
                type: array
                description: Ordered list of route steps that make up the swap.
                items:
                  type: object
                  properties:
                    swapInfo:
                      type: object
                      properties:
                        ammKey:
                          type: string
                          description: On-chain address of the AMM pool used for this step.
                        label:
                          type: string
                          description: Human-readable DEX label (for example, `Orca V2`, `Raydium CLMM`).
                        inputMint:
                          type: string
                        outputMint:
                          type: string
                        inAmount:
                          type: string
                        outAmount:
                          type: string
                      required:
                        - ammKey
                        - label
                        - inputMint
                        - outputMint
                        - inAmount
                        - outAmount
                    percent:
                      type: integer
                      description: Router-assigned percentage for this route step, from 0 to 100.
                      minimum: 0
                      maximum: 100
                    bps:
                      type: integer
                      description: Router-assigned share for this route step in basis points, from 0 to 10000.
                      minimum: 0
                      maximum: 10000
                    usdValue:
                      type: number
                      description: |
                        USD value of this step's input amount. Omitted when its input mint cannot be priced.
                  required:
                    - swapInfo
                    - percent
                    - bps
              transaction:
                type:
                  - string
                  - 'null'
                description: |
                  Base64-encoded unsigned Solana transaction. `null` when no `taker` was supplied; empty when funding was insufficient—see `errorCode`.
              taker:
                type:
                  - string
                  - 'null'
                description: |
                  Taker echoed back from the request. Always present. `null` when `taker` was not supplied.
              lastValidBlockHeight:
                type: string
                description: |
                  Block height beyond which the assembled transaction is no longer valid, as a decimal string. Omitted (not `null`) when the response does not carry a usable transaction.
              signatureFeeLamports:
                type: integer
                description: |
                  Estimated signature fee in lamports. `0` without a ready transaction. A sponsored transaction requires two signatures and reports `10000`.
              prioritizationFeeLamports:
                type: integer
                description: |
                  Estimated priority fee, including any Jito tip, in lamports. `0` without a ready transaction.
              rentFeeLamports:
                type: integer
                description: |
                  Estimated token-account rent in lamports. `0` without a ready transaction.
              signatureFeePayer:
                type:
                  - string
                  - 'null'
                description: |
                  Wallet that pays the signature fee. The sponsor when `payer` differs from `taker`; otherwise the taker. `null` without a ready transaction.
              prioritizationFeePayer:
                type:
                  - string
                  - 'null'
                description: |
                  Wallet that pays the priority fee and any Jito tip. The sponsor when `payer` differs from `taker`; otherwise the taker. `null` without a ready transaction.
              rentFeePayer:
                type:
                  - string
                  - 'null'
                description: |
                  Wallet that pays token-account rent. The sponsor when `payer` differs from `taker`; otherwise the taker. `null` without a ready transaction.
              totalTime:
                type: number
                description: Time in milliseconds spent producing the response.
              feeBps:
                type: integer
                description: |
                  Referral fee in basis points. Present only when `referralFee` and `referralAccount` were supplied.
              feeMint:
                type: string
                description: |
                  Mint in which the referral fee is quoted: the output mint on ExactIn or input mint on ExactOut.
              platformFee:
                type: object
                description: |
                  Quoted referral-fee details. Present only when `referralFee` and `referralAccount` were supplied.
                properties:
                  amount:
                    type: string
                    description: Fee amount in the smallest unit of `feeMint`.
                  feeBps:
                    type: integer
                    description: Referral fee in basis points, echoed back.
                  feeMint:
                    type: string
                    description: |
                      Mint of the token in which the fee is charged. Optional inside `platformFee`; when present, matches the top-level `feeMint`.
                required:
                  - amount
                  - feeBps
              errorCode:
                type: integer
                description: |
                  Present only when funding is insufficient and `transaction` is empty:

                  * `1` — insufficient input funds
                  * `2` — insufficient SOL for transaction costs
              errorMessage:
                type: string
                description: |
                  Human-readable funding error. Present with `errorCode`; match on the code instead of this message.
              error:
                type: string
                description: Duplicate of `errorMessage`, retained for compatibility.
            required:
              - mode
              - inputMint
              - outputMint
              - inAmount
              - outAmount
              - otherAmountThreshold
              - swapMode
              - slippageBps
              - priceImpact
              - priceImpactPct
              - swapType
              - gasless
              - router
              - routePlan
              - transaction
              - taker
              - signatureFeeLamports
              - prioritizationFeeLamports
              - rentFeeLamports
              - signatureFeePayer
              - prioritizationFeePayer
              - rentFeePayer
              - totalTime
          examples:
            quoteOnly:
              summary: Quote-only (no taker)
              value:
                mode: ultra
                inputMint: So11111111111111111111111111111111111111112
                outputMint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                inAmount: '1000000000'
                outAmount: '234506710'
                otherAmountThreshold: '233333336'
                swapMode: ExactIn
                slippageBps: 50
                priceImpact: -0.05
                priceImpactPct: '-0.0005'
                inUsdValue: 234.5
                outUsdValue: 234.2
                swapUsdValue: 234.3
                swapType: aggregator
                gasless: false
                router: metis
                routePlan:
                  - swapInfo:
                      ammKey: 5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1
                      label: Orca V2
                      inputMint: So11111111111111111111111111111111111111112
                      outputMint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                      inAmount: '1000000000'
                      outAmount: '234506710'
                    percent: 100
                    bps: 10000
                    usdValue: 234.3
                transaction: null
                taker: null
                signatureFeeLamports: 0
                prioritizationFeeLamports: 0
                rentFeeLamports: 0
                signatureFeePayer: null
                prioritizationFeePayer: null
                rentFeePayer: null
                totalTime: 42
            withTransaction:
              summary: Quote plus assembled transaction (taker supplied)
              value:
                mode: ultra
                inputMint: So11111111111111111111111111111111111111112
                outputMint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                inAmount: '1000000000'
                outAmount: '234506710'
                otherAmountThreshold: '233333336'
                swapMode: ExactIn
                slippageBps: 50
                priceImpact: -0.05
                priceImpactPct: '-0.0005'
                inUsdValue: 234.5
                outUsdValue: 234.2
                swapUsdValue: 234.3
                swapType: aggregator
                gasless: false
                router: metis
                routePlan:
                  - swapInfo:
                      ammKey: 5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1
                      label: Orca V2
                      inputMint: So11111111111111111111111111111111111111112
                      outputMint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                      inAmount: '1000000000'
                      outAmount: '234506710'
                    percent: 100
                    bps: 10000
                    usdValue: 234.3
                transaction: AQAAAA...base64-encoded-unsigned-transaction...
                taker: GkwFnmMDvn3HGMpJpWBg8tgJxr3NxNvg3AXxvXVPbRGJ
                lastValidBlockHeight: '300000000'
                signatureFeeLamports: 5000
                prioritizationFeeLamports: 500000
                rentFeeLamports: 2039280
                signatureFeePayer: GkwFnmMDvn3HGMpJpWBg8tgJxr3NxNvg3AXxvXVPbRGJ
                prioritizationFeePayer: GkwFnmMDvn3HGMpJpWBg8tgJxr3NxNvg3AXxvXVPbRGJ
                rentFeePayer: GkwFnmMDvn3HGMpJpWBg8tgJxr3NxNvg3AXxvXVPbRGJ
                totalTime: 87
            sponsoredWithReferral:
              summary: Sponsored transaction (payer set) with referral fee
              value:
                mode: ultra
                inputMint: So11111111111111111111111111111111111111112
                outputMint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                inAmount: '1000000000'
                outAmount: '234506710'
                otherAmountThreshold: '233333336'
                swapMode: ExactIn
                slippageBps: 50
                priceImpact: -0.05
                priceImpactPct: '-0.0005'
                inUsdValue: 234.5
                outUsdValue: 234.2
                swapUsdValue: 234.3
                swapType: aggregator
                gasless: true
                router: metis
                routePlan:
                  - swapInfo:
                      ammKey: 5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1
                      label: Orca V2
                      inputMint: So11111111111111111111111111111111111111112
                      outputMint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                      inAmount: '1000000000'
                      outAmount: '234506710'
                    percent: 100
                    bps: 10000
                    usdValue: 234.3
                transaction: AQAAAA...base64-encoded-unsigned-transaction...
                taker: GkwFnmMDvn3HGMpJpWBg8tgJxr3NxNvg3AXxvXVPbRGJ
                lastValidBlockHeight: '300000000'
                signatureFeeLamports: 10000
                prioritizationFeeLamports: 500000
                rentFeeLamports: 2039280
                signatureFeePayer: 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM
                prioritizationFeePayer: 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM
                rentFeePayer: 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM
                feeBps: 100
                feeMint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                platformFee:
                  amount: '2345067'
                  feeBps: 100
                  feeMint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                totalTime: 104
            pricedButUnexecutable:
              summary: 200 rejection (priced but transaction could not be built)
              value:
                mode: ultra
                inputMint: So11111111111111111111111111111111111111112
                outputMint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                inAmount: '1000000000'
                outAmount: '234506710'
                otherAmountThreshold: '233333336'
                swapMode: ExactIn
                slippageBps: 50
                priceImpact: -0.05
                priceImpactPct: '-0.0005'
                inUsdValue: 234.5
                outUsdValue: 234.2
                swapUsdValue: 234.3
                swapType: aggregator
                gasless: false
                router: metis
                routePlan:
                  - swapInfo:
                      ammKey: 5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1
                      label: Orca V2
                      inputMint: So11111111111111111111111111111111111111112
                      outputMint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                      inAmount: '1000000000'
                      outAmount: '234506710'
                    percent: 100
                    bps: 10000
                    usdValue: 234.3
                transaction: ''
                taker: GkwFnmMDvn3HGMpJpWBg8tgJxr3NxNvg3AXxvXVPbRGJ
                signatureFeeLamports: 0
                prioritizationFeeLamports: 0
                rentFeeLamports: 0
                signatureFeePayer: null
                prioritizationFeePayer: null
                rentFeePayer: null
                errorCode: 1
                errorMessage: Insufficient funds
                error: Insufficient funds
                totalTime: 63
```
