# swap

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

The endpoint allows you to specify priority fees and tips to later control the transaction inclusion and propagation.  Refer to the[ Transaction Submission ](https://docs.bloxroute.com/solana/trader-api/quick-start/transaction-submission)& [Front-Running Protection, Revert Protection, & Transaction Bundle](https://docs.bloxroute.com/solana/trader-api/api-endpoints/pump.fun/broken-reference) page for additional information about these parameters.&#x20;

### Request

#### Method:&#x20;

`POST ./api/v2/pumpfun/swap`

#### Parameters:

<table><thead><tr><th width="196.71896910191123">Parameter</th><th width="92">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>userAddress</code></td><td>string</td><td>Solana address which is placing swap.</td></tr><tr><td><code>bondingCurveAddress</code></td><td>string</td><td>Bonding Curve program address.</td></tr><tr><td><code>tokenAddress</code></td><td>string</td><td>Token address. </td></tr><tr><td><code>tokenAmount</code></td><td>double</td><td>The amount of token users expected to swap. </td></tr><tr><td><code>solThreshold</code></td><td>double</td><td>The amount of SOL to determine if executing the transaction will be failed or not. When it is a buy token transaction, this is the maximum SOL users will spend. When it is a sell token transaction, this is the minimum SOL users will receive. </td></tr><tr><td><code>isBuy</code></td><td>boolean</td><td>Specify if this is a buy or sell transaction. </td></tr><tr><td><code>slippage</code></td><td>double</td><td>The maximum slippage tolerance in percentage. Can be from 0-1000. (E.g. 1 = 1%)</td></tr><tr><td><code>creator</code></td><td>string</td><td>The token creator address. </td></tr><tr><td><code>computeLimit</code></td><td>uint64</td><td><strong>OPTIONAL</strong>. Specifies total compute limit to be allocated for all instructions within the created tx</td></tr><tr><td><code>computePrice</code></td><td>uint64</td><td><strong>OPTIONAL</strong>. Specifies compute price in Lamport (0.000001 SOL = 1,000 Lamport)  to be included as a part of instruction, known as priority fee. </td></tr><tr><td><code>tip</code></td><td>unit64</td><td><strong>OPTIONAL.</strong> Specifies a tip amount.</td></tr></tbody></table>

#### Request example:

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

```bash
curl -X 'POST' \
  -H "Authorization: $AUTH_HEADER"" \
  -H 'Content-Type: application/json' \
  'https://pump-ny.solana.dex.blxrbdn.com/api/v2/pumpfun/swap' \
  -d '{
    "userAddress": "9VUYmJa8NAB8uDe9P9aiFw3DEfezdkg5P5nQH6gcK5Kq", 
    "bondingCurveAddress": "BcVzydVqA4C9c3u4NJhkJZs3BBkqzwa2cqAkMUqfgHV9", 
    "tokenAddress": "Ds37SDZNukQj1aQYKgyWDkDz5xvpNx7PhiwE58TApump", 
    "tokenAmount": 22002, 
    "solThreshold": 0.0001, 
    "isBuy": false, 
    "creator": "JBYTEiKue7TdNMWtSKUZwyyRpHpTV9UKgkioQP4JttPn", 
    "slippage": 1
}'
```

{% endtab %}
{% endtabs %}

### Response:

#### Fields:

<table><thead><tr><th width="177.5236885968357">Field</th><th width="245">Type</th><th width="419.58916051319363">Description</th></tr></thead><tbody><tr><td><code>transaction</code></td><td><code>TransactionMessage</code></td><td>See <code>TransactionMessage</code> below for details</td></tr></tbody></table>

`TransactionMessage`

<table><thead><tr><th width="236">Parameter</th><th width="261.2"></th><th width="369">Description</th></tr></thead><tbody><tr><td><code>content</code></td><td>string</td><td>Raw bytes of signed transaction (should be in base64)</td></tr></tbody></table>

#### Example:

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

```json
{
    "id": 1,
    "result": {
        "transaction": {
            "content": "AQAA...QXBp"
        }
    },
    "jsonrpc": "2.0"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bloxroute.com/solana/trader-api/api-endpoints/pump.fun/swap.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
