# swap

{% hint style="warning" %}
This endpoint does not submit the transaction to the network.
{% endhint %}

### Request

#### Method:&#x20;

`POST ./api/v2/jupiter/swap`

The **`tip`** parameter is currently not supported. You can create an additional transaction with an **`tip`** instruction and submit the swap & tip transactions as a Bundle.

#### Parameters:

<table><thead><tr><th width="177.5236885968357">Parameter</th><th width="106.69187038489522">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>ownerAddress</code></td><td>string</td><td>Solana address which is placing swap.</td></tr><tr><td><code>inToken</code></td><td>string</td><td>Symbol or token program address of the swap-in token for the current step.</td></tr><tr><td><code>outToken</code></td><td>string</td><td>Symbol or token program address of the swap-out token.</td></tr><tr><td><code>inAmount</code></td><td>number</td><td>The amount of token wanted to be swapped from.</td></tr><tr><td><code>slippage</code></td><td>number</td><td>The maximum slippage tolerance in percentage.</td></tr><tr><td><code>computePrice</code></td><td>number</td><td><strong>OPTIONAL</strong>. Specifies compute price in Lamport (0.000001 SOL = 1,000 Lamport)  to overwrite default Jupiter compute price. </td></tr></tbody></table>

#### Request example:

{% tabs %}
{% tab title="HTTP" %}

```bash
curl -X 'POST' \
  -H "Authorization: $AUTH_HEADER" \
  -H 'Content-Type: application/json' \
  'https://ny.solana.dex.blxrbdn.com/api/v2/jupiter/swap' \
  -d '{
  "ownerAddress": "AFT8VayE7qr8MoQsW3wHsDS83HhEvhGWdbNSHRKeUDfQ",
  "inToken": "SOL",
  "outToken": "USDC",
  "inAmount": 0.1,
  "slippage": 0.001
}'
```

{% endtab %}

{% tab title="WebSocket" %}

```bash
wscat --header "Authorization: $AUTH_HEADER" 
-c wss://ny.solana.dex.blxrbdn.com/ws 
--execute '{"jsonrpc": "2.0", "id": 1, 
"method": "PostTradeSwap", 
"params": {"Owner": "2JJQHAYdogfB1fE1ftcvFcsQAXSgQQKkafCwZczWdSWd", 
"inToken": "USDC", 
"outToken":"SOL", 
"inAmount": 0.1, 
"slippage": 5, 
"project": "P_JUPITER"}}'
```

{% endtab %}

{% tab title="Go" %}

```go
g.PostTradeSwap(context.Background(), "AFT8VayE7qr8MoQsW3wHsDS83HhEvhGWdbNSHRKeUDfQ", "SOL", "USDC", 0.1, 0.001, pb.Project_P_JUPITER)
```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
await provider.postTradeSwap({
    ownerAddress: ownerAddress,
    inToken: "USDC",
    outToken: "SOL",
    inAmount: 0.01,
    slippage: 0.1,
    project: "P_JUPITER",
})
```

{% endtab %}
{% endtabs %}

### Response:

#### Fields:

<table><thead><tr><th width="199.5236885968357">Field</th><th width="265">Type</th><th width="419.58916051319363">Description</th></tr></thead><tbody><tr><td><code>transaction</code></td><td>[]<code>TransactionMessage</code></td><td>Raw bytes of unsigned transaction. See <code>TransactionMessage</code> below</td></tr><tr><td><code>outAmount</code></td><td>double</td><td>Amount of tokens expected from the swap</td></tr><tr><td><code>outAmountMin</code></td><td>double</td><td>Minimum amount of tokens allowed from swap given slippage</td></tr><tr><td><code>priceImpact</code></td><td><code>PriceImpactPercentV2</code></td><td>Impact of swap upon the pool's liquidity. See <code>PriceImpactPercentV2</code> below.</td></tr><tr><td><code>fee</code></td><td><code>Fee</code></td><td>Fee paid to AMM project. See <code>Fee</code> below.</td></tr></tbody></table>

`PriceImpactPercentV2`

<table><thead><tr><th width="177.5236885968357">Field</th><th width="150">Type</th><th width="419.58916051319363">Description</th></tr></thead><tbody><tr><td><code>percent</code></td><td>double</td><td>Percentage impact on price.</td></tr><tr><td><code>infinity</code></td><td>string</td><td>Indicates possible infinity values: <code>INF_NOT</code>, <code>INF_POSITIVE</code>, <code>INF_NEGATIVE</code>. Usually <code>INF_NOT</code>.</td></tr></tbody></table>

`fee`

<table><thead><tr><th width="173.5236885968357">Field</th><th width="150">Type</th><th width="419.58916051319363">Description</th></tr></thead><tbody><tr><td><code>amount</code></td><td>float</td><td>Amount paid to AMM project</td></tr><tr><td><code>mint</code></td><td>string</td><td>Token currency the fee is paid in</td></tr><tr><td><code>percent</code></td><td>float</td><td>Percentage of the swap consumed by the fee</td></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e4j1u2K4WnhlVcz30AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEvZScQ2AsM/IHeQ7RajUkyhuZdc8SGiqQz/7H34torN86EED9glv4WMHdJchvP2ZZvDPQq6PniaYqUsrsmZ94EZ8+1v+p9XMyTSHFcQqqY1KB217YyB72dA2rGwMEftogUUAgABNAAAAACAd44GAAAAAKUAAAAAAAAABt324ddloZPZy+FGzut5rBy0he1fWzeROoz1hX7/AKkQBAEOAA8BARUSEAIRAwQFBhIHCAkKCwwTAQ0AEQkA4fUFAAAAAMaAAAAAAAAAEAMBAAABCRYAH1Bvd2VyZWQgYnkgYmxvWHJvdXRlIFRyYWRlciBBcGk="
    ],
    "outAmount":3.296703,
    "outAmountMin":0.032966,
    "priceImpact":{
        "percent":4.5386233671508175e-7,
        "infinity":"INF_NOT"
    },
    "fee":{
        "amount":0.00025,
        "mint":"",
        "percent":0
    }
}
```

{% endtab %}
{% endtabs %}
