> ## 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.

# Auto-orders

> Attach take-profit, stop-loss, trailing, time, and dev-sell exits to a swap.

An auto-order is an exit attached to a swap. When you buy a token, you can include
one or more auto-orders that sell automatically once a condition is met — a
take-profit, a stop-loss, a trailing stop, a time-based exit, or a dev-sell that
fires when the token creator sells.

Auto-orders are passed in the `auto_orders` array of a
[swap request](/api-reference/swap). Each order is evaluated after the parent
trade lands and sells part or all of your position when it triggers.

## Fields

| Field           | Type    | Required | Description                                                                                    |
| --------------- | ------- | -------- | ---------------------------------------------------------------------------------------------- |
| `target_type`   | string  | yes      | The trigger type — one of `percentage`, `fixed`, `fixed_add`, `trailing`, `time`, `dev_sell`.  |
| `target_value`  | number  | yes      | The trigger threshold. Its meaning depends on `target_type` (see below).                       |
| `amount`        | number  | yes      | Percentage of your position to sell when the order triggers. `100` = sell the entire position. |
| `slippage`      | number  | yes      | Slippage tolerance as a percentage (e.g. `10` = 10%).                                          |
| `priority_fee`  | number  | yes      | Priority fee — in SOL on Solana, in **gwei** on EVM.                                           |
| `processor_tip` | number  | no       | Processor tip — in SOL on Solana, in the chain's **native asset** on EVM.                      |
| `anti_mev`      | boolean | no       | Submit the exit through an anti-MEV path. Defaults to `false`.                                 |

All numeric fields are JSON numbers, not strings.

`priority_fee` and `processor_tip` are denominated per host, exactly as they are
on the parent swap — see [Fee denomination](/concepts/chains#fee-denomination).

## What `target_value` means

The same `target_value` field is interpreted differently for each `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.       |

<Note>
  To create an automatic dev-sell, set `target_type` to `dev_sell`. There is no
  separate flag — the trigger type is the only thing you set.
</Note>

## Limits

You can attach **up to 20 auto-orders** to a swap. Any beyond 20 are dropped.

| Field                         | Valid range                                                 |
| ----------------------------- | ----------------------------------------------------------- |
| `auto_orders` (count)         | up to 20 per swap                                           |
| `amount`                      | 1–100 (percentage of your position to sell)                 |
| `slippage`                    | percentage, e.g. `10` for 10%                               |
| `priority_fee`                | greater than 0 (SOL on Solana, gwei on EVM)                 |
| `processor_tip`               | 0 or greater, optional (SOL on Solana, native asset on EVM) |
| `target_value` for `dev_sell` | `0` (any dev sell) or `100` (full dev sell only)            |

## Examples

### Take-profit at +50%

Sell the entire position when the price is up 50% from entry:

```json theme={null}
{
  "target_type": "percentage",
  "target_value": 50,
  "amount": 100,
  "slippage": 15,
  "priority_fee": 0.001,
  "anti_mev": true
}
```

### Stop-loss at -20%

Sell the entire position when the price is down 20% from entry (a negative
`target_value` is a stop-loss):

```json theme={null}
{
  "target_type": "percentage",
  "target_value": -20,
  "amount": 100,
  "slippage": 15,
  "priority_fee": 0.001,
  "anti_mev": true
}
```

### Dev-sell

Exit when the token creator sells. `target_value: 0` triggers on any dev sell;
`100` triggers only on a full (whole-position) dev sell:

```json theme={null}
{
  "target_type": "dev_sell",
  "target_value": 0,
  "amount": 100,
  "slippage": 25,
  "priority_fee": 0.001,
  "anti_mev": false
}
```

## Attaching auto-orders to a swap

Add the orders to the `auto_orders` array of a buy. This example takes profit at
+50% and also exits if the creator sells:

```json theme={null}
{
  "address": "<TOKEN_MINT>",
  "side": "Buy",
  "wallets": [{ "address": "<YOUR_WALLET>", "amount": "0.1" }],
  "slippage": 10,
  "priority_fee": 0.001,
  "processor_tip": 0.0001,
  "anti_mev": true,
  "auto_tip": false,
  "auto_orders": [
    {
      "target_type": "percentage",
      "target_value": 50,
      "amount": 100,
      "slippage": 15,
      "priority_fee": 0.001,
      "anti_mev": true
    },
    {
      "target_type": "dev_sell",
      "target_value": 0,
      "amount": 100,
      "slippage": 25,
      "priority_fee": 0.001,
      "anti_mev": false
    }
  ]
}
```
