# Auto Buy

> Run buy strategies on a launched token from the launch's wallets.

Auto Buy buys the launch's token from its wallets following one or more strategies: replication of external sells, timed buys and a market-cap ladder. A session is either planned (saved as `Planned` and started with the launch) or run on a token that is already live, and it ends on its time or spend budget. Sessions last at most 30 days.

Amounts are raw units sent as integers or integer strings; market caps are micro-USD and ratios basis points. The web app polls the status endpoint every 5 seconds.

On an EVM multi-launch container, the session endpoints answer `400` (`multi-launch container: sessions run on the winner launch once it resolves`); call them on the winning launch instead.

Base URL: `https://api-mig.proxima.tools`

## Endpoints

- `POST /launch/autobuy/plan/{launch_id}`: Plan an Auto Buy session
- `POST /launch/autobuy/run/{launch_id}`: Start an Auto Buy session
- `POST /launch/autobuy/update/{launch_id}`: Update an Auto Buy session
- `GET /launch/autobuy/status/{launch_id}`: Retrieve Auto Buy status
- `POST /launch/autobuy/cancel/{launch_id}`: Cancel an Auto Buy session
- `POST /launch/autobuy/pause/{launch_id}`: Pause an Auto Buy session
- `POST /launch/autobuy/resume/{launch_id}`: Resume an Auto Buy session
- `POST /launch/autobuy/discard/{launch_id}`: Discard an Auto Buy session

## The Auto buy status object

The launch's Auto Buy session as the API sends it. Solana launches report totals under `auto_buy_*` and progress under `modes`; EVM launches report totals under plain names and progress under `engine`.

- `status` (enum): Session state. Possible values: `None`, `Planned`, `Running`, `Paused`, `Completed`, `Cancelled`, `Failed`.
- `info` (object): Session details. Absent when `status` is `None`.
  - `params` (object): The session parameters as stored: the body of the last plan, run or update call.
  - `started_at` (integer | null): Unix timestamp (seconds) the session started.
  - `ended_at` (integer | null): Unix timestamp (seconds) the session ended.
  - `status_reason` (string | null): Why the session ended or failed, when known.
  - `auto_buy_native_spent` (integer): Solana: amount spent by the session, raw units.
  - `auto_buy_usd_spent` (integer): Solana: USD spent, micro-USD.
  - `auto_buy_token_bought` (integer): Solana: tokens bought, raw units.
  - `modes` (array<object>): Solana: progress per mode.
    - `id` (enum): Mode. Possible values: `replication`, `timed`, `mcap_ladder`.
    - `accumulated` (integer): Replication only: amount accumulated toward the next trade, summed over layers.
    - `layers` (array<object>): Progress per layer.
      - `id` (string): Layer ID: `ab_4217_l0` for timed and replication layers, `ab_4217_0` for market-cap ladder steps. Pass it as `layer_id` to cancel, pause or resume one layer.
      - `state` (enum): Layer state. The client also accepts lowercase values. Possible values: `Active`, `Paused`, `Exhausted`.
      - `token_sold` (integer): Tokens this layer has bought, raw units. The field keeps this name on both sides.
      - `sol_spent` (integer): Native or quote amount this layer has traded, raw units.
  - `token_bought` (string): EVM: tokens bought, raw units, as a decimal string.
  - `native_spent` (string): EVM: native spent, wei, as a decimal string.
  - `usd_spent` (integer): EVM: USD spent, micro-USD.
  - `engine` (object | null): EVM: live engine snapshot.
    - `cached_mcap_usd` (number): Market cap the engine last read, USD.
    - `swapback_layers` (array<object>): Replication layers.
      - `id` (string): Layer ID.
      - `state` (string): Layer state.
      - `accumulated` (integer | string): Amount accumulated toward the next trade.
      - `native_spent` (integer | string): Native spent by the layer, wei.
      - `token_bought` (integer | string): Tokens bought by the layer, raw units.
    - `timed_layers` (array<object>): Timed layers.
      - `id` (string): Layer ID.
      - `state` (string): Layer state.
      - `accumulated` (integer | string): Amount accumulated toward the next trade.
      - `native_spent` (integer | string): Native spent by the layer, wei.
      - `token_bought` (integer | string): Tokens bought by the layer, raw units.
    - `mcap_levels` (array<object>): Ladder steps: the layer fields plus `target_mcap_usd` and `buy_amount`.

```json
{
  "status": "Running",
  "info": {
    "params": {
      "modes": [
        {
          "SwapBack": {
            "whitelist": [],
            "layers": [
              {
                "replication_factor": 5000,
                "trigger_condition": {
                  "type": "MinSol",
                  "value": 100000000
                },
                "min_sol_per_swap": "10000000",
                "min_mcap": 0,
                "max_mcap": 250000000000
              }
            ]
          }
        },
        {
          "McapLadder": [
            {
              "target_mcap": 80000000000,
              "buy_amount": "500000000"
            },
            {
              "target_mcap": 60000000000,
              "buy_amount": "1000000000"
            }
          ]
        }
      ],
      "end_condition": {
        "time": 86400,
        "amount": "5000000000"
      },
      "slippage": 500,
      "wallet_pubkeys": [
        "3pGh8WcR5vTn2YkLz9QmXbE7aDs4FjU6wHrN1tKyPqVe",
        "6rVb2NqT8xK4mWc9HsZpG7eYjD3uLfA5tRnE1kQwXzMh"
      ]
    },
    "started_at": 1793655010,
    "ended_at": null,
    "status_reason": null,
    "auto_buy_native_spent": 1240000000,
    "auto_buy_usd_spent": 232480000,
    "auto_buy_token_bought": 6150000000000,
    "modes": [
      {
        "id": "replication",
        "accumulated": 4200000,
        "layers": [
          {
            "id": "ab_4217_l0",
            "state": "Active",
            "token_sold": 3900000000000,
            "sol_spent": 740000000
          }
        ]
      },
      {
        "id": "mcap_ladder",
        "layers": [
          {
            "id": "ab_4217_0",
            "state": "Exhausted",
            "token_sold": 2250000000000,
            "sol_spent": 500000000
          },
          {
            "id": "ab_4217_1",
            "state": "Active",
            "token_sold": 0,
            "sol_spent": 0
          }
        ]
      }
    ]
  }
}
```

## The Auto buy mode object

One Auto Buy strategy. Exactly one key is set: `SwapBack` (replication), `TimedExactIn` (timed) or `McapLadder` (market-cap ladder). The replication and timed modes take either single-layer fields or `layers`; a session takes at most 5 replication and 5 timed layers.

- `SwapBack` (object): Replication. Watches external sells of the token and accumulates `replication_factor` of each qualifying swap; a buy fires once the accumulated amount reaches `min_sol_per_swap`.
  - `replication_factor` (integer): Single-layer form: share to replicate, in basis points (10–100000).
  - `trigger_condition` (object): Single-layer form: which external swaps count. Same shape as in `layers`.
  - `min_sol_per_swap` (integer | string): Single-layer form: minimum size of one buy, raw quote units (lamports on SOL-quoted launches).
  - `whitelist` (array<string>): Payer addresses whose swaps are ignored. The launch's own wallets are always ignored.
  - `layers` (array<object>): Layered form: up to 5 replication layers.
    - `replication_factor` (integer): Share of each qualifying external swap to replicate, in basis points (`10000` = 100%). Accepted range 10–100000.
    - `trigger_condition` (object): Which external swaps count.
      - `type` (enum): `Rate`: each qualifying swap triggers with probability `value` / 10000 (10–10000). `MinSol`: only swaps of at least `value` native, raw units. `MinToken`: only swaps of at least `value` tokens, raw units. Possible values: `Rate`, `MinSol`, `MinToken`.
      - `value` (integer): Threshold for `type`.
    - `min_sol_per_swap` (integer | string): Minimum size of one buy, raw quote units (lamports on SOL-quoted launches).
    - `min_mcap` (integer): Lower market-cap bound of this layer, micro-USD. Layer ranges must not overlap.
    - `max_mcap` (integer): Upper market-cap bound of this layer, micro-USD.
    - `end_condition` (object): Per-layer budget and lifetime; falls back to the session's.
      - `amount` (integer | string): Budget of this layer, raw quote units.
      - `time` (integer): Lifetime of this layer, in seconds.
- `TimedExactIn` (object): Timed. Buys a random amount between `min_amount` and `max_amount` every `delay` milliseconds.
  - `min_amount` (integer | string): Single-layer form: smallest buy, raw quote units.
  - `max_amount` (integer | string): Single-layer form: largest buy, raw quote units.
  - `delay` (integer): Single-layer form: interval in milliseconds (1500–86400000).
  - `layers` (array<object>): Layered form: up to 5 timed layers.
    - `min_amount` (integer | string): Smallest buy, raw quote units.
    - `max_amount` (integer | string): Largest buy, raw quote units.
    - `delay` (integer): Interval in milliseconds (1500–86400000).
    - `min_mcap` (integer): Lower market-cap bound of this layer, micro-USD. Layer ranges must not overlap.
    - `max_mcap` (integer): Upper market-cap bound of this layer, micro-USD.
    - `end_condition` (object): Per-layer budget and lifetime; falls back to the session's.
      - `amount` (integer | string): Budget of this layer, raw quote units.
      - `time` (integer): Lifetime of this layer, in seconds.
- `McapLadder` (array<object>): Market-cap ladder. Each step buys once when the market cap reaches `target_mcap`. Targets must be strictly decreasing and amounts greater than 0.
  - `target_mcap` (integer): Market cap that fires the step, micro-USD.
  - `buy_amount` (integer | string): Quote to spend at this step, raw units.

```json
{
  "SwapBack": {
    "whitelist": [],
    "layers": [
      {
        "replication_factor": 5000,
        "trigger_condition": {
          "type": "MinSol",
          "value": 100000000
        },
        "min_sol_per_swap": "10000000",
        "min_mcap": 0,
        "max_mcap": 250000000000
      }
    ]
  }
}
```

### Plan an Auto Buy session

`POST /launch/autobuy/plan/{launch_id}`

Saves an Auto Buy session as `Planned` so that it starts with the launch. (Bearer JWT)

- Token: Upgraded session token, bound to a license.
- Read-only tokens: refused with `403 read_only_token`.
- Retry: Safe to retry. Planning again overwrites the parameters of the `Planned` session. Once the session runs, a repeat answers `409`.

Replaces a previously planned session. Refused while a session is running or paused. Buy ladder targets must be strictly decreasing, and layer market-cap ranges must not overlap.

#### Path parameters

- `launch_id` (string, required): Launch ID: the 15-digit chain-encoded ID. Its first three digits name the chain (`101` Solana, `201` BSC, `202` Base, `204` Ethereum).

#### Body parameters

- `mode` (object, optional): A single strategy, shaped like the [Auto buy mode](#object-auto-buy-mode) object. Send `mode` or `modes`.
- `modes` (array<object>, optional): Several strategies run together, each shaped like the [Auto buy mode](#object-auto-buy-mode) object. The web app sends this form.
- `end_condition` (object, required): Session-wide limits.
  - `time` (integer, required): Session duration in seconds; `0` uses the maximum of 30 days.
  - `amount` (integer | string, required): Quote the session may spend, raw units. `0` means no limit.
- `slippage` (integer, optional): Slippage tolerance in basis points, at most 10000. Defaults to 500 on Solana.
- `min_mcap` (integer | null, optional): Ignored: neither chain applies a session-wide lower bound, although the web app sends it when set. Set `min_mcap` on each layer instead.
- `max_mcap` (integer | null, optional): Ignored, like `min_mcap`. Set `max_mcap` on each layer instead.
- `start_delay` (integer, optional): Seconds to wait before the first trade, at most 30 days.
- `wallet_pubkeys` (array<string> | null, optional): Launch wallets that trade. Omit or send `null` for all of them; an empty array is rejected.

#### Returns 200 OK

Returns `ok` and a confirmation `message`.

- `ok` (boolean): Always `true` on success.
- `message` (string): Human-readable confirmation.

#### Errors

| Status | Code | Message | When | What to do |
| --- | --- | --- | --- | --- |
| 400 | `bad_request` | `invalid launch id format` | `launch_id` is not a chain-encoded launch ID. | Pass the 15-digit chain-encoded launch ID exactly as the API returned it. |
| 404 | `not_found` | `launch not found` | No launch with this ID belongs to the license in your token. | Check the launch ID and that your token is upgraded onto the license that owns the launch. |
| 400 | `bad_request` | `wallet_pubkeys cannot be empty` | Solana: `wallet_pubkeys` is an empty array. | Omit `wallet_pubkeys` to trade from every launch wallet. |
| 400 | `bad_request` | `Invalid pubkey` | Solana: an entry of `wallet_pubkeys` is not a valid address. | Send the base58 addresses of the launch's wallets. |
| 404 | `not_found` | `Wallet not found in launch` | Solana: an entry of `wallet_pubkeys` is not a wallet of this launch. | Send only addresses of the launch's own wallets, as listed by [Retrieve a launch](/reference/launches/#retrieve-launch). |
| 409 | `conflict` | `Task already running` | A session for this launch is `Running` or `Paused`. | Change the live session with [Update an Auto Buy session](/reference/auto-buy/#update-auto-buy), or cancel it with [Cancel an Auto Buy session](/reference/auto-buy/#cancel-auto-buy) before planning again. |
| 422 | `unprocessable` | `No wallets available` | No wallet is left to trade: the launch has no wallets, or (EVM) `wallet_pubkeys` is empty or names none of them. | Omit `wallet_pubkeys` to use every launch wallet, or add wallets with [Add wallets to a launch](/reference/launches/#add-launch-wallets). |
| 500 | `internal_error` | `No buying mode provided` | The parameters fail validation; `message` names the rule, e.g. `Invalid delay`, `Too many timed layers`, `Swapback layer mcap ranges must not overlap`, `Invalid levels array (must be decreasing mcap)` or `Slippage must be <= 10000 bps`. On a multi-launch container the same messages come back as `400 bad_request`. | Fix the parameter named in `message` within the limits listed on [Auto buy mode](/reference/auto-buy/#object-auto-buy-mode). |
| 400 | `bad_request` | `launch group plan can only be edited while draft` | `launch_id` is a multi-launch group container whose plan is no longer a draft. | Plan the session on the winning member launch instead. |
| 500 | `internal_error` | `No launch data saved` | Solana: the launch has no funder, holder or MEV wallets saved yet. | Finish the plan with [Update the launch plan](/reference/launches/#update-launch-plan) and [Set the launch funder](/reference/launches/#set-launch-funder), then retry. |
| 400 | `bad_request` | `No funder wallet configured` | EVM: the launch plan is incomplete; `message` names the missing part, e.g. `No launch method saved`, `No mev wallets saved`, `No holder wallets saved` or `No holder amounts saved`. | Finish the plan with [Update the launch plan](/reference/launches/#update-launch-plan) and [Set the launch funder](/reference/launches/#set-launch-funder), then retry. |
| 400 | `bad_request` | `invalid body: <path>: <cause>` | The body is not valid JSON, or a field is missing or has the wrong type. | Fix the field named in `message` and send the request again. |

#### Example request

```bash
curl -X POST "https://api-mig.proxima.tools/launch/autobuy/plan/101000000004217" \
  -H "Authorization: Bearer $PROXIMA_JWT" \
  -H "Content-Type: application/json" \
  -d '{
  "modes": [
    {
      "SwapBack": {
        "whitelist": [],
        "layers": [
          {
            "replication_factor": 5000,
            "trigger_condition": {
              "type": "MinSol",
              "value": 100000000
            },
            "min_sol_per_swap": "10000000",
            "min_mcap": 0,
            "max_mcap": 250000000000
          }
        ]
      }
    },
    {
      "McapLadder": [
        {
          "target_mcap": 80000000000,
          "buy_amount": "500000000"
        },
        {
          "target_mcap": 60000000000,
          "buy_amount": "1000000000"
        }
      ]
    }
  ],
  "end_condition": {
    "time": 86400,
    "amount": "5000000000"
  },
  "slippage": 500,
  "wallet_pubkeys": [
    "3pGh8WcR5vTn2YkLz9QmXbE7aDs4FjU6wHrN1tKyPqVe",
    "6rVb2NqT8xK4mWc9HsZpG7eYjD3uLfA5tRnE1kQwXzMh"
  ]
}'
```

#### Example response

```json
{
  "ok": true,
  "message": "Successfully planned auto buying task"
}
```

### Start an Auto Buy session

`POST /launch/autobuy/run/{launch_id}`

Starts an Auto Buy session right away on a launched token. (Bearer JWT)

- Token: Upgraded session token, bound to a license.
- Read-only tokens: refused with `403 read_only_token`.
- Retry: Check before retrying. Read [Retrieve Auto Buy status](/reference/auto-buy/#get-auto-buy-status) first: `Running` or `Paused` means the first call went through, and a repeat answers `409` while the session lasts.

Refused while a session is running or paused. If a session is `Planned` for the launch, it starts with the planned parameters and the body is ignored.

> Trades from the launch wallets until the session ends, is paused or is cancelled.

#### Path parameters

- `launch_id` (string, required): Launch ID: the 15-digit chain-encoded ID. Its first three digits name the chain (`101` Solana, `201` BSC, `202` Base, `204` Ethereum).

#### Body parameters

- `mode` (object, optional): A single strategy, shaped like the [Auto buy mode](#object-auto-buy-mode) object. Send `mode` or `modes`.
- `modes` (array<object>, optional): Several strategies run together, each shaped like the [Auto buy mode](#object-auto-buy-mode) object. The web app sends this form.
- `end_condition` (object, required): Session-wide limits.
  - `time` (integer, required): Session duration in seconds; `0` uses the maximum of 30 days.
  - `amount` (integer | string, required): Quote the session may spend, raw units. `0` means no limit.
- `slippage` (integer, optional): Slippage tolerance in basis points, at most 10000. Defaults to 500 on Solana.
- `min_mcap` (integer | null, optional): Ignored: neither chain applies a session-wide lower bound, although the web app sends it when set. Set `min_mcap` on each layer instead.
- `max_mcap` (integer | null, optional): Ignored, like `min_mcap`. Set `max_mcap` on each layer instead.
- `start_delay` (integer, optional): Seconds to wait before the first trade, at most 30 days.
- `wallet_pubkeys` (array<string> | null, optional): Launch wallets that trade. Omit or send `null` for all of them; an empty array is rejected.

#### Returns 200 OK

Returns `ok` and a confirmation `message`.

- `ok` (boolean): Always `true` on success.
- `message` (string): Human-readable confirmation.

#### Errors

| Status | Code | Message | When | What to do |
| --- | --- | --- | --- | --- |
| 400 | `bad_request` | `invalid launch id format` | `launch_id` is not a chain-encoded launch ID. | Pass the 15-digit chain-encoded launch ID exactly as the API returned it. |
| 404 | `not_found` | `launch not found` | No launch with this ID belongs to the license in your token. | Check the launch ID and that your token is upgraded onto the license that owns the launch. |
| 400 | `bad_request` | `wallet_pubkeys cannot be empty` | Solana: `wallet_pubkeys` is an empty array. | Omit `wallet_pubkeys` to trade from every launch wallet. |
| 400 | `bad_request` | `Invalid pubkey` | Solana: an entry of `wallet_pubkeys` is not a valid address. | Send the base58 addresses of the launch's wallets. |
| 404 | `not_found` | `Wallet not found in launch` | Solana: an entry of `wallet_pubkeys` is not a wallet of this launch. | Send only addresses of the launch's own wallets, as listed by [Retrieve a launch](/reference/launches/#retrieve-launch). |
| 400 | `bad_request` | `multi-launch container: not available here; use the winner launch once it resolves` | `launch_id` is a multi-launch group container; sessions run on the winning member launch. | Call it with the winning member's launch ID once the group resolves. |
| 500 | `internal_error` | `Token not launched` | Solana: the launch is still a draft. | Launch the token with [Launch a token](/reference/launch-execution/#launch) first, or save the session with [Plan an Auto Buy session](/reference/auto-buy/#plan-auto-buy) so it starts with the launch. |
| 400 | `bad_request` | `token not launched` | EVM: the launch is still a draft. Imported tokens are accepted. | Launch the token with [Launch a token](/reference/launch-execution/#launch) first, or save the session with [Plan an Auto Buy session](/reference/auto-buy/#plan-auto-buy) so it starts with the launch. |
| 409 | `conflict` | `Task already running` | A session for this launch is already `Running` or `Paused`. | Change the running session with [Update an Auto Buy session](/reference/auto-buy/#update-auto-buy) instead of starting another. |
| 400 | `bad_request` | `No wallets available for autobuy` | EVM: no wallet can trade, because `wallet_pubkeys` is an empty array or the launch holds no wallets. | Omit `wallet_pubkeys` to trade from every launch wallet. |
| 500 | `internal_error` | `wallet_pubkeys provided but none matched launch wallets` | EVM: none of `wallet_pubkeys` is a wallet of this launch. | Send only addresses of the launch's own wallets, as listed by [Retrieve a launch](/reference/launches/#retrieve-launch). |
| 500 | `internal_error` | `No buying mode provided` | The parameters fail validation; `message` names the rule, e.g. `Invalid delay`, `Too many timed layers`, `Swapback layer mcap ranges must not overlap`, `Invalid levels array (must be decreasing mcap)` or `Slippage must be <= 10000 bps`. When a session is `Planned`, its saved parameters are checked instead of the body. | Fix the parameter named in `message` within the limits listed on [Auto buy mode](/reference/auto-buy/#object-auto-buy-mode). |
| 500 | `internal_error` | `No launch data saved` | Solana: the launch has no funder, holder or MEV wallets saved yet. | Finish the plan with [Update the launch plan](/reference/launches/#update-launch-plan) and [Set the launch funder](/reference/launches/#set-launch-funder), then retry. |
| 400 | `bad_request` | `No funder wallet configured` | EVM: the launch plan is incomplete; `message` names the missing part, e.g. `No launch method saved`, `No mev wallets saved`, `No holder wallets saved` or `No holder amounts saved`. | Finish the plan with [Update the launch plan](/reference/launches/#update-launch-plan) and [Set the launch funder](/reference/launches/#set-launch-funder), then retry. |
| 500 | `internal_error` | `the launch quote carries no price` | Solana: the price of the launch's quote token is not known yet, so the engine cannot start. | Send the request again in a few seconds. |
| 422 | `venue_ungated` | `the launchpad holds no record of this token` | EVM: replication layers or market-cap bounds need a known pool for the token and none is recorded; `message` names what is missing. | Use timed layers without market-cap bounds, or retry once the pool is recorded. |
| 409 | `conflict` | `pace already trades this launch in this direction` | The launch trades on the pace engine, which already runs an Auto Buy session for it. | Change that session with [Update an Auto Buy session](/reference/auto-buy/#update-auto-buy) or cancel it with [Cancel an Auto Buy session](/reference/auto-buy/#cancel-auto-buy). |
| 422 | `unprocessable` | `a MinSol trigger is only valid when the launch's quote is native` | The launch's platform trades on the pace engine and a rule has no pace equivalent; `message` names it, e.g. a `Rate` trigger, a `MinSol` trigger on a non-native quote, or a replication layer with no amount to stop at. | Change the rule named in `message` and send the request again. |
| 503 | `pace_unavailable` | `the execution engine is unavailable, nothing was armed` | The launch's platform trades on the pace engine and pace could not be reached. | Send the request again after a short wait. |
| 400 | `bad_request` | `invalid body: <path>: <cause>` | The body is not valid JSON, or a field is missing or has the wrong type. | Fix the field named in `message` and send the request again. |

#### Example request

```bash
curl -X POST "https://api-mig.proxima.tools/launch/autobuy/run/101000000004217" \
  -H "Authorization: Bearer $PROXIMA_JWT" \
  -H "Content-Type: application/json" \
  -d '{
  "modes": [
    {
      "SwapBack": {
        "whitelist": [],
        "layers": [
          {
            "replication_factor": 5000,
            "trigger_condition": {
              "type": "MinSol",
              "value": 100000000
            },
            "min_sol_per_swap": "10000000",
            "min_mcap": 0,
            "max_mcap": 250000000000
          }
        ]
      }
    },
    {
      "McapLadder": [
        {
          "target_mcap": 80000000000,
          "buy_amount": "500000000"
        },
        {
          "target_mcap": 60000000000,
          "buy_amount": "1000000000"
        }
      ]
    }
  ],
  "end_condition": {
    "time": 86400,
    "amount": "5000000000"
  },
  "slippage": 500,
  "wallet_pubkeys": [
    "3pGh8WcR5vTn2YkLz9QmXbE7aDs4FjU6wHrN1tKyPqVe",
    "6rVb2NqT8xK4mWc9HsZpG7eYjD3uLfA5tRnE1kQwXzMh"
  ]
}'
```

#### Example response

```json
{
  "ok": true,
  "message": "Successfully started auto buying task"
}
```

### Update an Auto Buy session

`POST /launch/autobuy/update/{launch_id}`

Replaces the parameters of a planned, running or paused Auto Buy session. (Bearer JWT)

- Token: Upgraded session token, bound to a license.
- Read-only tokens: refused with `403 read_only_token`.
- Retry: Safe to retry. Layers are matched by ID and keep their progress, so sending the same parameters again changes nothing.

On a live session, layers whose IDs survive the update keep their progress.

> On Solana the response also carries `wallet_set_unchanged` and `wallets_added`, which the web app does not read. EVM answers with `ok` and `message` only.

#### Path parameters

- `launch_id` (string, required): Launch ID: the 15-digit chain-encoded ID. Its first three digits name the chain (`101` Solana, `201` BSC, `202` Base, `204` Ethereum).

#### Body parameters

- `mode` (object, optional): A single strategy, shaped like the [Auto buy mode](#object-auto-buy-mode) object. Send `mode` or `modes`.
- `modes` (array<object>, optional): Several strategies run together, each shaped like the [Auto buy mode](#object-auto-buy-mode) object. The web app sends this form.
- `end_condition` (object, required): Session-wide limits.
  - `time` (integer, required): Session duration in seconds; `0` uses the maximum of 30 days.
  - `amount` (integer | string, required): Quote the session may spend, raw units. `0` means no limit.
- `slippage` (integer, optional): Slippage tolerance in basis points, at most 10000. Defaults to 500 on Solana.
- `min_mcap` (integer | null, optional): Ignored: neither chain applies a session-wide lower bound, although the web app sends it when set. Set `min_mcap` on each layer instead.
- `max_mcap` (integer | null, optional): Ignored, like `min_mcap`. Set `max_mcap` on each layer instead.
- `start_delay` (integer, optional): Seconds to wait before the first trade, at most 30 days.
- `wallet_pubkeys` (array<string> | null, optional): Launch wallets that trade. Omit or send `null` for all of them; an empty array is rejected.

#### Returns 200 OK

Returns `ok` and a confirmation `message`.

- `ok` (boolean): Always `true` on success.
- `message` (string): Human-readable confirmation.

#### Errors

| Status | Code | Message | When | What to do |
| --- | --- | --- | --- | --- |
| 400 | `bad_request` | `invalid launch id format` | `launch_id` is not a chain-encoded launch ID. | Pass the 15-digit chain-encoded launch ID exactly as the API returned it. |
| 404 | `not_found` | `launch not found` | No launch with this ID belongs to the license in your token. | Check the launch ID and that your token is upgraded onto the license that owns the launch. |
| 400 | `bad_request` | `Invalid pubkey in wallet_pubkeys` | Solana: an entry of `wallet_pubkeys` is not a valid address. | Send the base58 addresses of the launch's wallets. |
| 404 | `not_found` | `No MM engine running for this launch` | Solana: the session is `Running` or `Paused` but its engine is gone, for example after a restart. | Cancel the session with [Cancel an Auto Buy session](/reference/auto-buy/#cancel-auto-buy) and start a new one with [Start an Auto Buy session](/reference/auto-buy/#run-auto-buy). |
| 409 | `conflict` | `Autobuy session is not running or planned` | The session is not `Planned`, `Running` or `Paused`. | Start a session with [Start an Auto Buy session](/reference/auto-buy/#run-auto-buy) or plan one with [Plan an Auto Buy session](/reference/auto-buy/#plan-auto-buy). |
| 400 | `bad_request` | `multi-launch container: sessions run on the winner launch once it resolves` | `launch_id` is a multi-launch group container; sessions run on the winning member launch. | Call it with the winning member's launch ID once the group resolves. |
| 404 | `not_found` | `No autobuy session found` | EVM: the launch has no session to update. | Start a session with [Start an Auto Buy session](/reference/auto-buy/#run-auto-buy) or plan one with [Plan an Auto Buy session](/reference/auto-buy/#plan-auto-buy). |
| 500 | `internal_error` | `No autobuy session found` | Solana: the launch has no session to update. | Start a session with [Start an Auto Buy session](/reference/auto-buy/#run-auto-buy) or plan one with [Plan an Auto Buy session](/reference/auto-buy/#plan-auto-buy). |
| 400 | `bad_request` | `No buying mode provided` | The parameters fail validation; `message` names the rule, e.g. `Invalid delay`, `Too many timed layers`, `Swapback layer mcap ranges must not overlap`, `Invalid levels array (must be decreasing mcap)` or `Slippage must be <= 10000 bps`. | Fix the parameter named in `message` within the limits listed on [Auto buy mode](/reference/auto-buy/#object-auto-buy-mode). |
| 400 | `bad_request` | `wallet_pubkeys contains wallets that cannot trade this launch` | Solana: an entry of `wallet_pubkeys` is not a wallet that can trade this launch. | Send only addresses of the launch's own wallets, as listed by [Retrieve a launch](/reference/launches/#retrieve-launch). |
| 400 | `bad_request` | `wallet_pubkeys provided but none matched launch wallets` | EVM: none of `wallet_pubkeys` is a wallet of this launch. | Send only addresses of the launch's own wallets, as listed by [Retrieve a launch](/reference/launches/#retrieve-launch). |
| 400 | `bad_request` | `No wallets available for autobuy` | EVM: `wallet_pubkeys` is an empty array. | Omit `wallet_pubkeys` to keep the current wallets. |
| 404 | `not_found` | `No engine running for this launch` | EVM: the session is `Running` or `Paused` but its engine is gone, for example after a restart. | Cancel the session with [Cancel an Auto Buy session](/reference/auto-buy/#cancel-auto-buy) and start a new one with [Start an Auto Buy session](/reference/auto-buy/#run-auto-buy). |
| 422 | `unprocessable` | `a MinSol trigger is only valid when the launch's quote is native` | The launch's platform trades on the pace engine and a rule has no pace equivalent; `message` names it, e.g. a `Rate` trigger, a `MinSol` trigger on a non-native quote, or a replication layer with no amount to stop at. | Change the rule named in `message` and send the request again. |
| 404 | `not_found` | `pace no longer trades this launch` | The launch trades on the pace engine and pace no longer runs a session for it. | Start a new session with [Start an Auto Buy session](/reference/auto-buy/#run-auto-buy). |
| 404 | `not_found` | `pace no longer holds this session` | The launch trades on the pace engine and pace no longer holds the session. | Start a new session with [Start an Auto Buy session](/reference/auto-buy/#run-auto-buy). |
| 409 | `conflict` | `pace already moved this session` | The launch trades on the pace engine and pace already moved the session to another state. | Read [Retrieve Auto Buy status](/reference/auto-buy/#get-auto-buy-status) for the current state before acting again. |
| 503 | `pace_unavailable` | `the execution engine is unavailable, nothing was armed` | The launch's platform trades on the pace engine and pace could not be reached. | Send the request again after a short wait. |
| 400 | `bad_request` | `invalid body: <path>: <cause>` | The body is not valid JSON, or a field is missing or has the wrong type. | Fix the field named in `message` and send the request again. |

#### Example request

```bash
curl -X POST "https://api-mig.proxima.tools/launch/autobuy/update/101000000004217" \
  -H "Authorization: Bearer $PROXIMA_JWT" \
  -H "Content-Type: application/json" \
  -d '{
  "modes": [
    {
      "SwapBack": {
        "whitelist": [],
        "layers": [
          {
            "replication_factor": 5000,
            "trigger_condition": {
              "type": "MinSol",
              "value": 100000000
            },
            "min_sol_per_swap": "10000000",
            "min_mcap": 0,
            "max_mcap": 250000000000
          }
        ]
      }
    },
    {
      "McapLadder": [
        {
          "target_mcap": 80000000000,
          "buy_amount": "500000000"
        },
        {
          "target_mcap": 60000000000,
          "buy_amount": "1000000000"
        }
      ]
    }
  ],
  "end_condition": {
    "time": 86400,
    "amount": "5000000000"
  },
  "slippage": 500,
  "wallet_pubkeys": [
    "3pGh8WcR5vTn2YkLz9QmXbE7aDs4FjU6wHrN1tKyPqVe",
    "6rVb2NqT8xK4mWc9HsZpG7eYjD3uLfA5tRnE1kQwXzMh"
  ]
}'
```

#### Example response

```json
{
  "ok": true,
  "message": "Auto buy params updated"
}
```

### Retrieve Auto Buy status

`GET /launch/autobuy/status/{launch_id}`

Returns the launch's Auto Buy session, its totals and per-layer progress. (Bearer JWT)

- Token: Upgraded session token, bound to a license.
- Read-only tokens: allowed.
- Retry: Safe to retry.

> The web client normalizes this payload (`normalizeAutoBuyStatus`): lowercase statuses become PascalCase, EVM totals are mapped onto the `auto_buy_*` names, `engine` layers become `modes`, and amounts are parsed to numbers.

#### Path parameters

- `launch_id` (string, required): Launch ID: the 15-digit chain-encoded ID. Its first three digits name the chain (`101` Solana, `201` BSC, `202` Base, `204` Ethereum).

#### Returns 200 OK

Returns an Auto buy status object.

- `status` (enum): Session state. Possible values: `None`, `Planned`, `Running`, `Paused`, `Completed`, `Cancelled`, `Failed`.
- `info` (object): Session details. Absent when `status` is `None`.
  - `params` (object): The session parameters as stored: the body of the last plan, run or update call.
  - `started_at` (integer | null): Unix timestamp (seconds) the session started.
  - `ended_at` (integer | null): Unix timestamp (seconds) the session ended.
  - `status_reason` (string | null): Why the session ended or failed, when known.
  - `auto_buy_native_spent` (integer): Solana: amount spent by the session, raw units.
  - `auto_buy_usd_spent` (integer): Solana: USD spent, micro-USD.
  - `auto_buy_token_bought` (integer): Solana: tokens bought, raw units.
  - `modes` (array<object>): Solana: progress per mode.
    - `id` (enum): Mode. Possible values: `replication`, `timed`, `mcap_ladder`.
    - `accumulated` (integer): Replication only: amount accumulated toward the next trade, summed over layers.
    - `layers` (array<object>): Progress per layer.
      - `id` (string): Layer ID: `ab_4217_l0` for timed and replication layers, `ab_4217_0` for market-cap ladder steps. Pass it as `layer_id` to cancel, pause or resume one layer.
      - `state` (enum): Layer state. The client also accepts lowercase values. Possible values: `Active`, `Paused`, `Exhausted`.
      - `token_sold` (integer): Tokens this layer has bought, raw units. The field keeps this name on both sides.
      - `sol_spent` (integer): Native or quote amount this layer has traded, raw units.
  - `token_bought` (string): EVM: tokens bought, raw units, as a decimal string.
  - `native_spent` (string): EVM: native spent, wei, as a decimal string.
  - `usd_spent` (integer): EVM: USD spent, micro-USD.
  - `engine` (object | null): EVM: live engine snapshot.
    - `cached_mcap_usd` (number): Market cap the engine last read, USD.
    - `swapback_layers` (array<object>): Replication layers.
      - `id` (string): Layer ID.
      - `state` (string): Layer state.
      - `accumulated` (integer | string): Amount accumulated toward the next trade.
      - `native_spent` (integer | string): Native spent by the layer, wei.
      - `token_bought` (integer | string): Tokens bought by the layer, raw units.
    - `timed_layers` (array<object>): Timed layers.
      - `id` (string): Layer ID.
      - `state` (string): Layer state.
      - `accumulated` (integer | string): Amount accumulated toward the next trade.
      - `native_spent` (integer | string): Native spent by the layer, wei.
      - `token_bought` (integer | string): Tokens bought by the layer, raw units.
    - `mcap_levels` (array<object>): Ladder steps: the layer fields plus `target_mcap_usd` and `buy_amount`.

#### Errors

| Status | Code | Message | When | What to do |
| --- | --- | --- | --- | --- |
| 400 | `bad_request` | `invalid launch id format` | `launch_id` is not a chain-encoded launch ID. | Pass the 15-digit chain-encoded launch ID exactly as the API returned it. |
| 404 | `not_found` | `launch not found` | No launch with this ID belongs to the license in your token. | Check the launch ID and that your token is upgraded onto the license that owns the launch. |
| 400 | `bad_request` | `multi-launch container: sessions run on the winner launch once it resolves` | `launch_id` is a multi-launch group container; sessions run on the winning member launch. | Call it with the winning member's launch ID once the group resolves. |

#### Example request

```bash
curl "https://api-mig.proxima.tools/launch/autobuy/status/101000000004217" \
  -H "Authorization: Bearer $PROXIMA_JWT"
```

#### Example response

```json
{
  "status": "Running",
  "info": {
    "params": {
      "modes": [
        {
          "SwapBack": {
            "whitelist": [],
            "layers": [
              {
                "replication_factor": 5000,
                "trigger_condition": {
                  "type": "MinSol",
                  "value": 100000000
                },
                "min_sol_per_swap": "10000000",
                "min_mcap": 0,
                "max_mcap": 250000000000
              }
            ]
          }
        },
        {
          "McapLadder": [
            {
              "target_mcap": 80000000000,
              "buy_amount": "500000000"
            },
            {
              "target_mcap": 60000000000,
              "buy_amount": "1000000000"
            }
          ]
        }
      ],
      "end_condition": {
        "time": 86400,
        "amount": "5000000000"
      },
      "slippage": 500,
      "wallet_pubkeys": [
        "3pGh8WcR5vTn2YkLz9QmXbE7aDs4FjU6wHrN1tKyPqVe",
        "6rVb2NqT8xK4mWc9HsZpG7eYjD3uLfA5tRnE1kQwXzMh"
      ]
    },
    "started_at": 1793655010,
    "ended_at": null,
    "status_reason": null,
    "auto_buy_native_spent": 1240000000,
    "auto_buy_usd_spent": 232480000,
    "auto_buy_token_bought": 6150000000000,
    "modes": [
      {
        "id": "replication",
        "accumulated": 4200000,
        "layers": [
          {
            "id": "ab_4217_l0",
            "state": "Active",
            "token_sold": 3900000000000,
            "sol_spent": 740000000
          }
        ]
      },
      {
        "id": "mcap_ladder",
        "layers": [
          {
            "id": "ab_4217_0",
            "state": "Exhausted",
            "token_sold": 2250000000000,
            "sol_spent": 500000000
          },
          {
            "id": "ab_4217_1",
            "state": "Active",
            "token_sold": 0,
            "sol_spent": 0
          }
        ]
      }
    ]
  }
}
```

### Cancel an Auto Buy session

`POST /launch/autobuy/cancel/{launch_id}`

Cancels the whole Auto Buy session, one mode, or one layer. (Bearer JWT)

- Token: Upgraded session token, bound to a license.
- Read-only tokens: refused with `403 read_only_token`.
- Retry: Safe to retry. A cancel with no body answers `200` in any state, so repeating it changes nothing.

Send `layer_id` or `mode` to cancel part of the session; send no body to cancel all of it.

#### Path parameters

- `launch_id` (string, required): Launch ID: the 15-digit chain-encoded ID. Its first three digits name the chain (`101` Solana, `201` BSC, `202` Base, `204` Ethereum).

#### Body parameters

- `layer_id` (string, optional): Target one layer, e.g. `ab_4217_l0` (from `modes[].layers[].id` in the status).
- `mode` (enum, optional): Target every layer of one mode. Possible values: `replication`, `timed`, `mcap_ladder`.

#### Returns 200 OK

Returns `ok` and a `message` (`Layer cancelled` when one layer was targeted).

- `ok` (boolean): Always `true` on success.
- `message` (string): Human-readable confirmation.

#### Errors

| Status | Code | Message | When | What to do |
| --- | --- | --- | --- | --- |
| 400 | `bad_request` | `invalid launch id format` | `launch_id` is not a chain-encoded launch ID. | Pass the 15-digit chain-encoded launch ID exactly as the API returned it. |
| 404 | `not_found` | `launch not found` | No launch with this ID belongs to the license in your token. | Check the launch ID and that your token is upgraded onto the license that owns the launch. |
| 400 | `bad_request` | `Invalid layer_id for this launch` | Solana: `layer_id` lacks the prefix of this launch's Auto Buy layer IDs. EVM accepts any value and changes nothing. | Pass a layer `id` from `modes[].layers[]` in [Retrieve Auto Buy status](/reference/auto-buy/#get-auto-buy-status). |
| 400 | `bad_request` | `Invalid mode: must be replication, timed, or mcap_ladder` | Solana: `mode` is not `replication`, `timed` or `mcap_ladder`, checked only while the engine runs. EVM accepts any value and changes nothing. | Send `replication`, `timed` or `mcap_ladder`. |
| 409 | `conflict` | `Autobuy session is not running` | `layer_id` or `mode` was sent and the session is not `Running`. A cancel with no body works in any state. | Send no body to cancel the whole session. |
| 400 | `bad_request` | `multi-launch container: sessions run on the winner launch once it resolves` | `launch_id` is a multi-launch group container; sessions run on the winning member launch. | Call it with the winning member's launch ID once the group resolves. |
| 404 | `not_found` | `No autobuy session found` | EVM: `layer_id` or `mode` was sent and the launch has no Auto Buy session. | Send no body to clear the session state. |
| 500 | `internal_error` | `No autobuy session found` | Solana: `layer_id` or `mode` was sent and the launch has no Auto Buy session. | Send no body to clear the session state. |
| 422 | `unprocessable` | `a launch on pace cancels whole sessions, not layers` | The launch trades on the pace engine, which cancels whole sessions only, and `layer_id` or `mode` was sent. | Send no `layer_id` or `mode` to cancel the whole session. |
| 503 | `pace_unavailable` | `the execution engine is unavailable, nothing was armed` | The launch's platform trades on the pace engine and pace could not be reached. | Send the request again after a short wait. |
| 400 | `bad_request` | `invalid body: <path>: <cause>` | The body is not valid JSON, or a field is missing or has the wrong type. | Fix the field named in `message` and send the request again. |

#### Example request

```bash
curl -X POST "https://api-mig.proxima.tools/launch/autobuy/cancel/101000000004217" \
  -H "Authorization: Bearer $PROXIMA_JWT" \
  -H "Content-Type: application/json" \
  -d '{
  "mode": "timed"
}'
```

#### Example response

```json
{
  "ok": true,
  "message": "Auto buy task successfully cancelled"
}
```

### Pause an Auto Buy session

`POST /launch/autobuy/pause/{launch_id}`

Pauses the whole Auto Buy session, one mode, or one layer. (Bearer JWT)

- Token: Upgraded session token, bound to a license.
- Read-only tokens: refused with `403 read_only_token`.
- Retry: Safe to retry. Once the session is `Paused`, a repeat answers `409` and changes nothing.

Send `layer_id` or `mode` to pause part of the session; the client sends `{}` to pause all of it.

#### Path parameters

- `launch_id` (string, required): Launch ID: the 15-digit chain-encoded ID. Its first three digits name the chain (`101` Solana, `201` BSC, `202` Base, `204` Ethereum).

#### Body parameters

- `layer_id` (string, optional): Target one layer, e.g. `ab_4217_l0` (from `modes[].layers[].id` in the status).
- `mode` (enum, optional): Target every layer of one mode. Possible values: `replication`, `timed`, `mcap_ladder`.

#### Returns 200 OK

Returns `ok` and a `message` (`Layer paused` when one layer was targeted).

- `ok` (boolean): Always `true` on success.
- `message` (string): Human-readable confirmation.

#### Errors

| Status | Code | Message | When | What to do |
| --- | --- | --- | --- | --- |
| 400 | `bad_request` | `invalid launch id format` | `launch_id` is not a chain-encoded launch ID. | Pass the 15-digit chain-encoded launch ID exactly as the API returned it. |
| 404 | `not_found` | `launch not found` | No launch with this ID belongs to the license in your token. | Check the launch ID and that your token is upgraded onto the license that owns the launch. |
| 400 | `bad_request` | `Invalid layer_id for this launch` | Solana: `layer_id` lacks the prefix of this launch's Auto Buy layer IDs. EVM accepts any value and changes nothing. | Pass a layer `id` from `modes[].layers[]` in [Retrieve Auto Buy status](/reference/auto-buy/#get-auto-buy-status). |
| 400 | `bad_request` | `Invalid mode: must be replication, timed, or mcap_ladder` | Solana: `mode` is not `replication`, `timed` or `mcap_ladder`. EVM accepts any value and changes nothing. | Send `replication`, `timed` or `mcap_ladder`. |
| 404 | `not_found` | `No MM engine running for this launch` | Solana: the session is `Running` or `Paused` but its engine is gone, for example after a restart. | Cancel the session with [Cancel an Auto Buy session](/reference/auto-buy/#cancel-auto-buy) and start a new one with [Start an Auto Buy session](/reference/auto-buy/#run-auto-buy). |
| 409 | `conflict` | `Autobuy session is not running` | The session is not `Running`, for example because it is already `Paused`. | Read [Retrieve Auto Buy status](/reference/auto-buy/#get-auto-buy-status), and resume a paused session with [Resume an Auto Buy session](/reference/auto-buy/#resume-auto-buy). |
| 400 | `bad_request` | `multi-launch container: sessions run on the winner launch once it resolves` | `launch_id` is a multi-launch group container; sessions run on the winning member launch. | Call it with the winning member's launch ID once the group resolves. |
| 404 | `not_found` | `No autobuy session found` | EVM: the launch has no session to pause. | Start a session with [Start an Auto Buy session](/reference/auto-buy/#run-auto-buy) or plan one with [Plan an Auto Buy session](/reference/auto-buy/#plan-auto-buy). |
| 500 | `internal_error` | `No autobuy session found` | Solana: the launch has no session to pause. | Start a session with [Start an Auto Buy session](/reference/auto-buy/#run-auto-buy) or plan one with [Plan an Auto Buy session](/reference/auto-buy/#plan-auto-buy). |
| 404 | `not_found` | `No engine running for this launch` | EVM: the session is `Running` or `Paused` but its engine is gone, for example after a restart. | Cancel the session with [Cancel an Auto Buy session](/reference/auto-buy/#cancel-auto-buy) and start a new one with [Start an Auto Buy session](/reference/auto-buy/#run-auto-buy). |
| 422 | `unprocessable` | `a launch on pace pauses whole sessions, not layers` | The launch trades on the pace engine, which pauses whole sessions only, and `layer_id` or `mode` was sent. | Send no `layer_id` or `mode` to pause the whole session. |
| 404 | `not_found` | `pace no longer holds this session` | The launch trades on the pace engine and pace no longer holds the session. | Start a new session with [Start an Auto Buy session](/reference/auto-buy/#run-auto-buy). |
| 409 | `conflict` | `pace already moved this session` | The launch trades on the pace engine and pace already moved the session to another state. | Read [Retrieve Auto Buy status](/reference/auto-buy/#get-auto-buy-status) for the current state before acting again. |
| 503 | `pace_unavailable` | `the execution engine is unavailable, nothing was armed` | The launch's platform trades on the pace engine and pace could not be reached. | Send the request again after a short wait. |
| 400 | `bad_request` | `invalid body: <path>: <cause>` | The body is not valid JSON, or a field is missing or has the wrong type. | Fix the field named in `message` and send the request again. |

#### Example request

```bash
curl -X POST "https://api-mig.proxima.tools/launch/autobuy/pause/101000000004217" \
  -H "Authorization: Bearer $PROXIMA_JWT" \
  -H "Content-Type: application/json" \
  -d '{
  "mode": "timed"
}'
```

#### Example response

```json
{
  "ok": true,
  "message": "Auto buy paused"
}
```

### Resume an Auto Buy session

`POST /launch/autobuy/resume/{launch_id}`

Resumes a paused Auto Buy session, mode, or layer. (Bearer JWT)

- Token: Upgraded session token, bound to a license.
- Read-only tokens: refused with `403 read_only_token`.
- Retry: Safe to retry. Resuming a session that already runs answers `200` and changes nothing.

Send `layer_id` or `mode` to resume part of the session; the client sends `{}` to resume all of it.

#### Path parameters

- `launch_id` (string, required): Launch ID: the 15-digit chain-encoded ID. Its first three digits name the chain (`101` Solana, `201` BSC, `202` Base, `204` Ethereum).

#### Body parameters

- `layer_id` (string, optional): Target one layer, e.g. `ab_4217_l0` (from `modes[].layers[].id` in the status).
- `mode` (enum, optional): Target every layer of one mode. Possible values: `replication`, `timed`, `mcap_ladder`.

#### Returns 200 OK

Returns `ok` and a `message` (`Layer resumed` when one layer was targeted).

- `ok` (boolean): Always `true` on success.
- `message` (string): Human-readable confirmation.

#### Errors

| Status | Code | Message | When | What to do |
| --- | --- | --- | --- | --- |
| 400 | `bad_request` | `invalid launch id format` | `launch_id` is not a chain-encoded launch ID. | Pass the 15-digit chain-encoded launch ID exactly as the API returned it. |
| 404 | `not_found` | `launch not found` | No launch with this ID belongs to the license in your token. | Check the launch ID and that your token is upgraded onto the license that owns the launch. |
| 400 | `bad_request` | `Invalid layer_id for this launch` | Solana: `layer_id` lacks the prefix of this launch's Auto Buy layer IDs. EVM accepts any value and changes nothing. | Pass a layer `id` from `modes[].layers[]` in [Retrieve Auto Buy status](/reference/auto-buy/#get-auto-buy-status). |
| 400 | `bad_request` | `Invalid mode: must be replication, timed, or mcap_ladder` | Solana: `mode` is not `replication`, `timed` or `mcap_ladder`. EVM accepts any value and changes nothing. | Send `replication`, `timed` or `mcap_ladder`. |
| 404 | `not_found` | `No MM engine running for this launch` | Solana: the session is `Running` or `Paused` but its engine is gone, for example after a restart. | Cancel the session with [Cancel an Auto Buy session](/reference/auto-buy/#cancel-auto-buy) and start a new one with [Start an Auto Buy session](/reference/auto-buy/#run-auto-buy). |
| 409 | `conflict` | `Autobuy session is not paused` | Solana: the session is neither `Paused` nor `Running`. | Start a new session with [Start an Auto Buy session](/reference/auto-buy/#run-auto-buy). |
| 400 | `bad_request` | `multi-launch container: sessions run on the winner launch once it resolves` | `launch_id` is a multi-launch group container; sessions run on the winning member launch. | Call it with the winning member's launch ID once the group resolves. |
| 409 | `conflict` | `Autobuy session is not running or paused` | EVM: the session is neither `Paused` nor `Running`. | Start a new session with [Start an Auto Buy session](/reference/auto-buy/#run-auto-buy). |
| 404 | `not_found` | `No autobuy session found` | EVM: the launch has no session to resume. | Start a session with [Start an Auto Buy session](/reference/auto-buy/#run-auto-buy) or plan one with [Plan an Auto Buy session](/reference/auto-buy/#plan-auto-buy). |
| 500 | `internal_error` | `No autobuy session found` | Solana: the launch has no session to resume. | Start a session with [Start an Auto Buy session](/reference/auto-buy/#run-auto-buy) or plan one with [Plan an Auto Buy session](/reference/auto-buy/#plan-auto-buy). |
| 404 | `not_found` | `No engine running for this launch` | EVM: the session is `Running` or `Paused` but its engine is gone, for example after a restart. | Cancel the session with [Cancel an Auto Buy session](/reference/auto-buy/#cancel-auto-buy) and start a new one with [Start an Auto Buy session](/reference/auto-buy/#run-auto-buy). |
| 422 | `unprocessable` | `a launch on pace resumes whole sessions, not layers` | The launch trades on the pace engine, which resumes whole sessions only, and `layer_id` or `mode` was sent. | Send no `layer_id` or `mode` to resume the whole session. |
| 404 | `not_found` | `pace no longer holds this session` | The launch trades on the pace engine and pace no longer holds the session. | Start a new session with [Start an Auto Buy session](/reference/auto-buy/#run-auto-buy). |
| 409 | `conflict` | `pace already moved this session` | The launch trades on the pace engine and pace already moved the session to another state. | Read [Retrieve Auto Buy status](/reference/auto-buy/#get-auto-buy-status) for the current state before acting again. |
| 503 | `pace_unavailable` | `the execution engine is unavailable, nothing was armed` | The launch's platform trades on the pace engine and pace could not be reached. | Send the request again after a short wait. |
| 400 | `bad_request` | `invalid body: <path>: <cause>` | The body is not valid JSON, or a field is missing or has the wrong type. | Fix the field named in `message` and send the request again. |

#### Example request

```bash
curl -X POST "https://api-mig.proxima.tools/launch/autobuy/resume/101000000004217" \
  -H "Authorization: Bearer $PROXIMA_JWT" \
  -H "Content-Type: application/json" \
  -d '{
  "layer_id": "ab_4217_l0"
}'
```

#### Example response

```json
{
  "ok": true,
  "message": "Auto buy resumed"
}
```

### Discard an Auto Buy session

`POST /launch/autobuy/discard/{launch_id}`

Clears a planned or finished Auto Buy session from the launch. (Bearer JWT)

- Token: Upgraded session token, bound to a license.
- Read-only tokens: refused with `403 read_only_token`.
- Retry: Safe to retry. Once the session state is cleared, a repeat answers `200` and changes nothing.

#### Path parameters

- `launch_id` (string, required): Launch ID: the 15-digit chain-encoded ID. Its first three digits name the chain (`101` Solana, `201` BSC, `202` Base, `204` Ethereum).

#### Returns 200 OK

Returns `ok` and a confirmation `message`.

- `ok` (boolean): Always `true` on success.
- `message` (string): Human-readable confirmation.

#### Errors

| Status | Code | Message | When | What to do |
| --- | --- | --- | --- | --- |
| 400 | `bad_request` | `invalid launch id format` | `launch_id` is not a chain-encoded launch ID. | Pass the 15-digit chain-encoded launch ID exactly as the API returned it. |
| 404 | `not_found` | `launch not found` | No launch with this ID belongs to the license in your token. | Check the launch ID and that your token is upgraded onto the license that owns the launch. |
| 409 | `conflict` | `Cannot discard running session` | Solana: the session is `Running` or `Paused`. EVM answers `200` and keeps the live session. | Stop the session with [Cancel an Auto Buy session](/reference/auto-buy/#cancel-auto-buy) first. |
| 400 | `bad_request` | `multi-launch container: sessions run on the winner launch once it resolves` | `launch_id` is a multi-launch group container; sessions run on the winning member launch. | Call it with the winning member's launch ID once the group resolves. |

#### Example request

```bash
curl -X POST "https://api-mig.proxima.tools/launch/autobuy/discard/101000000004217" \
  -H "Authorization: Bearer $PROXIMA_JWT"
```

#### Example response

```json
{
  "ok": true,
  "message": "Successfully discarded auto buy session status"
}
```
