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

# Execute a swap

> Buy or sell a token across one or more of your wallets.

> [!NOTE]
>
> **`wallets` is optional.** Omit it (or pass `null`), set a top-level `amount`,
> and the swap runs on every wallet with spot trading enabled in Bloom — the
> same wallets the bot and extension trade from. To name wallets explicitly,
> list them with **[`GET /api/v1/wallets`](https://dev.bloombot.app/api-reference/wallets)** first. An
> empty `wallets` array is an error (`NO_WALLETS`), not a fallback.

> [!NOTE]
>
> **`auto_orders` has three states.** Omitted or `null` applies the Spot
> strategy saved in Bloom Manager; an empty array `[]` attaches no auto-orders
> at all; a non-empty array uses exactly those orders. See the
> **[Auto-orders guide](https://dev.bloombot.app/concepts/auto-orders.md)** for the full field reference,
> the `target_value` table, and examples.

> [!TIP]
>
> Building a bot that might see the same token twice? Set **`skip_if_bought`** on
> a Buy and the request becomes a no-op if any wallet on your account already
> bought that token. A skipped request is a `200` with `data.skipped: true` and
> no signatures — not an error.

> [!TIP]
>
> Building on Bloom for other traders? Set **`builder_address`** and
> **`builder_fee_bps`** (1–100) together and that wallet earns a share of the
> swap, paid on top of Bloom's fee in the same transaction. See
> **[Builder fees](https://dev.bloombot.app/concepts/builder-fees.md)**.


## OpenAPI

````yaml openapi.yaml POST /api/v1/swap
openapi: 3.1.0
info:
  title: Bloom API
  version: 1.0.0
  description: |
    Programmatic trading and token-deploy API for Bloom. Drive swaps and token
    launches with a personal API key authenticated as a Bearer token.
servers:
  - url: https://eu.solana.bloombot.app
    description: Solana — EU
  - url: https://us.solana.bloombot.app
    description: Solana — US
  - url: https://evm.bloombot.app
    description: EVM
security:
  - bearerAuth: []
tags:
  - name: Trading
    description: Execute swaps across your wallets.
  - name: Deploy
    description: Launch new tokens.
  - name: Utility
    description: Connection probes and account lookups.
paths:
  /api/v1/swap:
    post:
      tags:
        - Trading
      summary: Execute a swap
      description: >
        Execute a buy or sell across one or more of your wallets — the ones you
        name in `wallets`, or, when `wallets` is omitted, every wallet with spot
        trading enabled.
      operationId: swap
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SwapRequest'
            examples:
              buy:
                summary: Buy — spend 0.1 SOL on a token from one wallet
                value:
                  address: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                  side: Buy
                  wallets:
                    - address: 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
                      amount: '0.1'
                  slippage: 10
                  priority_fee: 0.001
                  processor_tip: 0.0001
                  anti_mev: false
                  auto_tip: false
              buyDefaultWallets:
                summary: >-
                  Buy from your default wallets — omit wallets, set a top-level
                  amount
                value:
                  address: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                  side: Buy
                  amount: '0.1'
                  slippage: 10
                  priority_fee: 0.001
                  processor_tip: 0.0001
                  anti_mev: false
                  auto_tip: false
              buyOnce:
                summary: Buy once — skip if any wallet already bought this token
                value:
                  address: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                  side: Buy
                  skip_if_bought: true
                  wallets:
                    - address: 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
                      amount: '0.1'
                  slippage: 10
                  priority_fee: 0.001
                  processor_tip: 0.0001
                  anti_mev: false
                  auto_tip: false
              buyEvm:
                summary: Buy on EVM — spend 0.05 native (BNB) on BNB Chain
                value:
                  address: '0x9afedf881ca7e07f4f3cc7ecd2b974705834ffce'
                  chain: bsc
                  side: Buy
                  wallets:
                    - address: '0x2e8f0C9199cE40a66100917Ec09BD67A114D2827'
                      amount: '0.05'
                  slippage: 10
                  priority_fee: 3
                  processor_tip: 0.0005
                  anti_mev: false
                  auto_tip: false
              buyEvmStable:
                summary: Buy on EVM — spend 25 USDG on Robinhood chain
                value:
                  address: '0x9afedf881ca7e07f4f3cc7ecd2b974705834ffce'
                  chain: rbh
                  side: Buy
                  quote_asset: USDG
                  wallets:
                    - address: '0x2e8f0C9199cE40a66100917Ec09BD67A114D2827'
                      amount: '25'
                  slippage: 10
                  priority_fee: 3
                  processor_tip: 0.0005
                  anti_mev: false
                  auto_tip: false
              buyWithTakeProfit:
                summary: Buy with a +50% take-profit auto-order
                value:
                  address: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                  side: Buy
                  wallets:
                    - address: 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
                      amount: '0.05'
                  slippage: 10
                  priority_fee: 0.001
                  processor_tip: 0.0001
                  anti_mev: false
                  auto_tip: false
                  auto_orders:
                    - target_type: percentage
                      target_value: 50
                      amount: 100
                      slippage: 15
                      priority_fee: 0.001
                      anti_mev: true
              buyWithDevSell:
                summary: >-
                  Buy with a dev-sell auto-order (exit when the token creator
                  sells)
                value:
                  address: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                  side: Buy
                  wallets:
                    - address: 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
                      amount: '0.05'
                  slippage: 10
                  priority_fee: 0.001
                  processor_tip: 0.0001
                  anti_mev: false
                  auto_tip: true
                  auto_orders:
                    - target_type: dev_sell
                      target_value: 0
                      amount: 100
                      slippage: 25
                      priority_fee: 0.001
                      anti_mev: false
              buyWithoutAutoOrders:
                summary: >-
                  Buy with no auto-orders — an empty array overrides your saved
                  strategy
                value:
                  address: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                  side: Buy
                  wallets:
                    - address: 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
                      amount: '0.1'
                  auto_orders: []
                  slippage: 10
                  priority_fee: 0.001
                  processor_tip: 0.0001
                  anti_mev: false
                  auto_tip: false
              buyWithBuilderFee:
                summary: >-
                  Buy with a builder fee — 0.5% of the amount spent goes to the
                  builder
                value:
                  address: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                  side: Buy
                  wallets:
                    - address: 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
                      amount: '0.1'
                  builder_address: 9xQeWvG816bUx9EPjHmaT23yvVM2ZWbrrpZb9PusVFin
                  builder_fee_bps: 50
                  slippage: 10
                  priority_fee: 0.001
                  processor_tip: 0.0001
                  anti_mev: false
                  auto_tip: false
              sellPercent:
                summary: Sell 100% of holdings (percentage mode, the default)
                value:
                  address: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                  side: Sell
                  sell_mode: percent
                  wallets:
                    - address: 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
                      amount: '100'
                  slippage: 25
                  priority_fee: 0.001
                  processor_tip: 0.0001
                  anti_mev: false
                  auto_tip: false
              sellTokens:
                summary: Sell an exact token quantity (tokens mode)
                value:
                  address: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                  side: Sell
                  sell_mode: tokens
                  wallets:
                    - address: 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
                      amount: '330000.5'
                  slippage: 25
                  priority_fee: 0.001
                  processor_tip: 0.0001
                  anti_mev: false
                  auto_tip: false
      responses:
        '200':
          description: Swap accepted.
          headers:
            X-RateLimit-Limit-Minute:
              description: Configured per-minute limit.
              schema:
                type: integer
            X-RateLimit-Limit-Hour:
              description: Configured per-hour limit.
              schema:
                type: integer
            X-RateLimit-Limit-Week:
              description: Configured per-week limit.
              schema:
                type: integer
            X-RateLimit-Remaining-Minute:
              description: Requests remaining in the current minute window.
              schema:
                type: integer
            X-RateLimit-Remaining-Hour:
              description: Requests remaining in the current hour window.
              schema:
                type: integer
            X-RateLimit-Remaining-Week:
              description: Requests remaining in the current week window.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SwapResponse'
        '400':
          description: >-
            Bad request. Codes: NO_WALLETS (`wallets` is empty, or it was
            omitted and no wallet has spot trading enabled), INVALID_REQUEST
            (missing or invalid field, or a builder fee that cannot be applied),
            WALLET_NOT_OWNED (a wallet address does not belong to your account),
            LIQUIDITY_OUT_OF_RANGE (pool liquidity outside requested band),
            MARKET_CAP_OUT_OF_RANGE (market cap outside requested band),
            TOKEN_OR_POOL_NOT_FOUND (mint or pool address could not be
            resolved), NO_ROUTE (no swap route found), INSUFFICIENT_BALANCE (the
            wallet cannot cover the trade — including when the fees alone exceed
            the balance).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: >-
            Unauthorized. Codes: UNAUTHORIZED (missing, malformed, unknown, or
            revoked Bearer token).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: >-
            Too many requests. Code: RATE_LIMITED. The rejected request is not
            counted against your budget.
          headers:
            Retry-After:
              description: Seconds until the blocking window resets.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: >-
            Internal server error (code `INTERNAL_ERROR`). The request could not
            be completed — safe to retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SwapRequest:
      type: object
      required:
        - address
        - side
        - priority_fee
        - processor_tip
        - slippage
        - anti_mev
        - auto_tip
      properties:
        address:
          type: string
          description: Token mint address or pool ID.
        side:
          type: string
          enum:
            - Buy
            - Sell
        chain:
          type: string
          enum:
            - eth
            - bsc
            - base
            - rbh
            - arc
          description: >
            **EVM host only.** The chain to trade on, matched
            case-insensitively. Optional — when omitted, the token address is
            resolved across the supported chains automatically. Pass it
            explicitly to pin the lookup to one chain. An unrecognised value
            fails with `INVALID_REQUEST`. Not used on the Solana host. See
            [Chains and quote assets](/concepts/chains).
        sell_mode:
          type: string
          enum:
            - percent
            - tokens
          default: percent
          description: >
            For a Sell, how each wallet's `amount` is interpreted: `percent`
            (1-100 of holdings, the default) or `tokens` (absolute token
            quantity). An over-amount in `tokens` mode sells the full balance.
            Ignored for a Buy. `tokens` is **Solana-only** — the EVM host
            rejects it with `INVALID_REQUEST`.
        skip_if_bought:
          type: boolean
          default: false
          description: >
            When true, skip the whole swap if **any** wallet on your account has
            already bought this token — for a bot that may see the same token
            twice and must not double-buy. The check runs against your Bloom
            trade history for the token, so it also covers buys placed from the
            bot, the extension, or the manager, not just from this API.


            A skipped request is **not** an error: it returns `200` with
            `data.skipped: true` and an empty `signatures`. It still consumes
            one unit of rate-limit budget.


            **Buys only** — ignored for a Sell, where it would mean "refuse to
            sell what you hold".
        priority_fee:
          type: number
          description: >
            Priority fee. Denominated in SOL on the Solana host and in **gwei**
            on the EVM host — see [Fee
            denomination](/concepts/chains#fee-denomination).
        processor_tip:
          type: number
          description: >
            Processor tip; ignored when `auto_tip` is true. Denominated in SOL
            on the Solana host and in the chain's **native asset** on the EVM
            host.
        slippage:
          type: number
          description: Slippage tolerance as a percentage, e.g. 10 = 10%.
        max_tax:
          type: number
          minimum: 0
          maximum: 100
          description: >
            **EVM host only.** Maximum token buy/sell tax you will accept, as a
            percentage (5 = 5%). The token's tax is probed before execution; a
            trade on a token whose tax exceeds the cap is rejected with
            `TAX_OUT_OF_RANGE`. An explicit `0` means "tax-free tokens only".
            **Omitted = no cap: the tax check does not run.** Not used on the
            Solana host.


            The tax check is best-effort and not guaranteed to catch every case:
            the tax actually applied at execution can differ from the probed
            value. Trading taxed or malicious tokens is at your own risk; Bloom
            is not responsible for losses caused by token taxes or token
            contract behaviour.
        anti_mev:
          type: boolean
        auto_tip:
          type: boolean
          description: >-
            When true, the server sets the priority fee and processor tip for
            you.
        amount:
          type: string
          description: >
            Default amount for every wallet the swap runs on, as a decimal
            string in the same units as `wallets[].amount` (quote asset to spend
            on a Buy; percent of holdings or token quantity on a Sell, per
            `sell_mode`). **Required when `wallets` is omitted** — each default
            wallet trades this amount. When `wallets` is given, it is the
            fallback for any entry that leaves its own `amount` unset.
        wallets:
          type: array
          minItems: 1
          description: >
            Wallets to swap from; each must belong to your account.
            **Optional:** omit it (or pass `null`) and the swap runs on every
            wallet with spot trading enabled in Bloom — the same set the Bloom
            bot and extension trade from — each spending the top-level `amount`.
            List them with [`GET /api/v1/wallets`](/api-reference/wallets)
            (`spot_active: true`). An empty array is rejected with `NO_WALLETS`;
            it never falls back to the defaults.
          items:
            $ref: '#/components/schemas/SwapWallet'
        auto_orders:
          type: array
          maxItems: 20
          description: >
            Attach take-profit / stop-loss / trailing / time / dev-sell exits to
            this swap (up to 20; any beyond 20 are dropped). See the
            [Auto-orders guide](/concepts/auto-orders) for the full field
            reference, the `target_value` table, and examples.


            **Omitted or `null`:** the swap uses the auto-orders of the Spot
            strategy saved in Bloom Manager, exactly as a trade from the bot or
            extension would. **Empty array `[]`:** no auto-orders at all, even
            if a strategy is saved. **Non-empty:** exactly the orders given; the
            saved strategy is not merged in.
          items:
            $ref: '#/components/schemas/AutoOrder'
        quote_asset:
          type: string
          enum:
            - SOL
            - ETH
            - BNB
            - USDC
            - USDT
            - USD1
            - USDG
          description: >
            Quote asset to trade against — what a Buy spends, and the unit of
            `wallets[].amount`. Omit it to use the chain's native token.


            Each chain's native token is named by its own symbol: `SOL` on the
            Solana host, and on EVM `ETH` (eth, base, rbh), `BNB` (bsc) or
            `USDC` (arc, whose native token is USDC).


            Support is validated **per chain** — eth `USDC`/`USDT`, bsc
            `USD1`/`USDC`/`USDT`, base `USDC`, rbh `USDG`, arc native only,
            Solana `USDC`/`USD1`. An asset the chain does not support is
            rejected with `INVALID_REQUEST`, and the error lists the valid set.
            See [Chains and quote assets](/concepts/chains).
        min_liquidity:
          type: number
          description: Pool liquidity bounds in USD.
        max_liquidity:
          type: number
          description: Pool liquidity bounds in USD.
        min_market_cap:
          type: number
          description: Token market-cap bounds in USD.
        max_market_cap:
          type: number
          description: Token market-cap bounds in USD.
        builder_address:
          type: string
          description: >
            Builder fee: a wallet that earns a share of this trade, paid on top
            of Bloom's fee as a separate transfer in the same transaction, in
            the asset the trade settles in. A Buy pays it on the amount spent, a
            Sell on the proceeds. An address on the chain being traded — base58
            on the Solana host, `0x…` on the EVM host.


            **Sent together with `builder_fee_bps`, or not at all** — one
            without the other is rejected with `INVALID_REQUEST`, never
            half-applied. Omit both for a swap with no builder fee. See [Builder
            fees](/concepts/builder-fees).
        builder_fee_bps:
          type: integer
          minimum: 1
          maximum: 100
          description: >
            The builder's share in basis points, `1`–`100` (100 = 1%). Required
            with `builder_address`; a value outside the range is rejected with
            `INVALID_REQUEST`.
    SwapResponse:
      type: object
      required:
        - success
        - data
      properties:
        success:
          type: boolean
          example: true
        data:
          type: object
          required:
            - order_id
            - signatures
          properties:
            order_id:
              type: string
            signatures:
              type: array
              description: >-
                Submitted transaction signatures, one per wallet/transaction.
                These confirm what was broadcast on-chain (not final
                confirmation). May be empty if nothing was submitted.
              items:
                type: string
            skipped:
              type: boolean
              default: false
              description: >-
                True only when `skip_if_bought` suppressed the swap. Lets you
                tell "we chose not to trade" apart from an execution that
                submitted nothing — both return an empty `signatures`.
    ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            details:
              type:
                - string
                - 'null'
    SwapWallet:
      type: object
      required:
        - address
      properties:
        address:
          type: string
          description: >-
            One of your wallets — see [`GET
            /api/v1/wallets`](/api-reference/wallets).
        amount:
          type: string
          description: >
            Amount to swap from this wallet, as a decimal string (avoids
            floating-point precision loss). For a Buy, this is the amount of the
            chosen `quote_asset` to spend (e.g. `"10"` with `quote_asset: USDC`
            spends 10 USDC; SOL when `quote_asset` is SOL or omitted). For a
            Sell, it is interpreted per the request's `sell_mode`: a percentage
            of holdings `1`-`100` (default), or an absolute token quantity when
            `sell_mode` is `tokens`. Optional when the request carries a
            top-level `amount`, which then applies to this wallet.
    AutoOrder:
      type: object
      description: >
        An exit order attached to a swap (take-profit, stop-loss, trailing,

        time-based, or dev-sell). The order is evaluated after the parent trade

        lands and sells automatically when it triggers. See the

        [Auto-orders guide](/concepts/auto-orders) for examples and guidance.


        The meaning of `target_value` depends on `target_type`:


        | target_type  | target_value
        means                                                                                                    
        |

        |--------------|------------------------------------------------------------------------------------------------------------------------|

        | `percentage` | Percent to sell at. Positive = take-profit (sell when
        up X%); negative = stop-loss (sell when down X%).                 |

        | `fixed`      | Target market cap in USD — sell when the market cap
        reaches this value.                                                 |

        | `fixed_add`  | Market-cap change threshold in USD — sell when the
        market cap moves (up or down) by this amount.                        |

        | `trailing`   | Trailing distance as a percent — the stop trails this
        far below the peak and moves up as the price rises.               |

        | `time`       | Seconds — sell this many seconds after the order is
        placed.                                                             |

        | `dev_sell`   | Triggers when the token creator sells: `0` = any dev
        sell, `100` = only a full (whole-position) dev sell.               |
      required:
        - target_type
        - target_value
        - amount
        - slippage
        - priority_fee
      properties:
        target_type:
          type: string
          enum:
            - percentage
            - fixed
            - fixed_add
            - trailing
            - time
            - dev_sell
          description: >-
            Order trigger type. The meaning of `target_value` depends on this.
            Use `dev_sell` for an automatic dev-sell.
        target_value:
          type: number
          description: >-
            Trigger threshold; its meaning depends on `target_type` — see [what
            target_value means](/concepts/auto-orders#what-target_value-means).
        amount:
          type: number
          description: >-
            Percentage of your position to sell when the order triggers, 1–100
            (100 = sell the entire position).
        slippage:
          type: number
          description: Slippage tolerance as a percentage (e.g. 10 = 10%).
        priority_fee:
          type: number
          description: >
            Priority fee. Denominated in SOL on the Solana host and in **gwei**
            on the EVM host — see [Fee
            denomination](/concepts/chains#fee-denomination).
        processor_tip:
          type: number
          description: >
            Processor tip. Denominated in SOL on the Solana host and in the
            chain's **native asset** on the EVM host.
        anti_mev:
          type: boolean
          default: false
          description: >-
            Submit the exit through an anti-MEV path. Optional; defaults to
            false.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your Bloom API key, e.g. `Authorization: Bearer blm_sol_live_…`. Create
        one in Bloom Manager → Manage API Keys.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.