PATCH /v1/strategy-tasks/{id}
Update a strategy task
Merge the body into the stored spec without id, then validate the result. Arrays replace wholesale. Top-level labels replace the task labels. Labels-only patches keep the version and engine state. Name edits are also allowed while active; other edits require a paused, synced task. For a repeating trailing ladder, set repeat: true and do.sell.amount to bps_of_remaining on each trailing exit rule. Give each tier a distinct activation gain and omit stages and goto. Callout entries (social_mention) accept five token condition leaves besides the social signal leaves and me.holding: token.market_cap_usd (gte / lte / between, decimal USD string), token.buy_tax_bps and token.sell_tax_bps (lte, integer bps 0-10000; 10000 means no cap), token.age_sec (gte / lte / between, seconds) and token.address (in / nin, 1-200 token addresses; nin is a blacklist). Market cap and both fee caps bound the buy order and must be direct children of the root "all" on every chain, otherwise presend_leaf_not_top_level; age and address are judged when the post arrives and may be nested. A limit-order entry cannot carry token.market_cap_usd (unsupported_leaf). Without token.buy_tax_bps the default 2500 bps buy fee cap applies. On BSC and Robinhood the on-chain market cap ceiling allows about 30% above the maximum. A token with no known launch time fails a token.age_sec condition. X and Pump.fun limit buys accept signal_price with an integer offset_bps from -9900 to 100000 excluding zero, or a fixed price_usd. Limit expiry is 60-604800 seconds from placement. Both sources accept integer do.buy.delay_ms from 0 to 86400000; omitted or 0 means no delay, and values above the ceiling return unsupported_delay. Signal-time conditions are evaluated on arrival. When the delay elapses, routing and pre-send checks run before sending a market buy or placing a limit. A delayed signal_price limit uses the mark captured at signal time when available. Otherwise, and for an immediate limit, it uses the mark when the buy route is selected, falling back to the route quote. If no price is available, the signal is skipped with signal_price_unknown. Both social sources accept token.dex (in / nin with DEX identity strings) and, on Solana, token.quote_class (in with a list of classes) as direct children of the root all. The main pool on the selected buy route, the pool that directly trades the token, determines these conditions before a market buy is sent or a limit is placed; conversion hops before it, such as through USDC, do not count. Solana social buys can set exec.buy.fee.slippage_sol to a decimal string of at least 0.1 SOL with at most nine decimals. The route-based floor replaces percentage buy slippage, including when a limit triggers. Wallet-copy buy entries accept signal.block_gap (lte or lt, nonnegative blocks, Solana slots). It uses the pre-send estimate; an unknown local head rejects with signal_block_gap_unknown. Pump.fun callout entries use one social_mention source {platform: "pump_fun", source_id: "home_new"} (the pump.fun new-callout feed) and cannot mix with other sources. They run on solana, bsc and robinhood, live mode only (mode "paper" returns unsupported_action), with market and limit buys. Every entry must reach a non-empty "only follow these callers" list through the root all: signal.author in [...], 1-200 items; otherwise validation_error with details[].code pump_callers_required. List items are {"handle": "<pump.fun username>"} or {"user_id": "<lowercase UUID>", "handle": "..."}. On save the server looks each handle-only item up on pump.fun and stores its user ID and current handle; the executor matches user IDs only, so a later rename does not change who is followed. An unknown handle returns details[].code pump_caller_not_found and a failed lookup pump_caller_lookup_failed (retry later); both list the handles in details[].reason and nothing is saved. There is no separate caller lookup endpoint: a create or update is the lookup. Pump.fun-only caller conditions: signal.author nin (exclude callers), caller.cost_basis_usd (gte / lte / between, USD the caller spent on the token), caller.followers (gte), caller.callouts (gte / lte / between, total callouts), caller.verified (is true), caller.has_x (is true), caller.holding_usd (gte / lte / between, the caller's position in USD when looked up, may be 0), and signal.caller_rank (is / lte / gte / between with within_sec 60-604800: the caller's rank among distinct callers of this token in the window; is 1 means the first caller). signal.first_call and the token conditions above also apply; signal.text does not. Caller conditions other than caller.cost_basis_usd wait about 0.1 s for the caller profile; callouts whose caller cannot be found do not pass them. Signal records carry signal_source, signal_author (handle at the time, display only), signal_author_id, signal_token and signal_posted_at_ms when the signal recorded them. Forward wallet_trade buys accept token.prior_buyers nin with 1–200 wallet addresses and required within_sec of 60–43200 seconds in whole minutes. Reverse buys return unsupported_leaf. Each list checks purchases already seen at the time of this leader buy, including add-ons. For each listed wallet, the task looks back over the window you set or the last 5,000 distinct tokens it bought, whichever comes first. When a listed wallet and the leader buy almost at the same time, the task may occasionally copy the leader’s buy because it has not yet seen the listed wallet’s purchase or cannot tell which came first. To sell after a listed earlier purchase is confirmed, include pos.late_prior_buyer is true in a position rule with a sell action. This automatic exit is sent at maximum slippage and uses the task's sell settings for fees, tip and gas. Every token.prior_buyers condition must be required by the buy (only all on its path). The native API adds no rule. Across all running and paused tasks on the same chain, an account may list up to 5000 distinct wallets. Exceeding this limit returns 400 prior_buyers_wallet_limit with total and limit. Requires the copytrade:write scope.
Required scope:copytrade:write Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
id | string | ✓ | Strategy task ID. |
Headers
| Field | Type | Required | Description |
|---|---|---|---|
If-Match | string | ✓ | Current ETag from a prior read or write; required for optimistic concurrency. |
Request body application/merge-patch+json
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
labels | array<string> | maxItems: 10 | Caller-defined task labels. Up to 10 labels of 1–24 characters. Whitespace is trimmed and duplicates are removed. |
Responses
200 — Committed
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
data | object | ✓ | Response payload. | |
data.labels | array<string> | default: [] | The caller's task labels. Empty if none are set. | |
data.task_id | string | ✓ | Strategy task ID. | |
data.name | string | ✓ | Task display name. | |
data.chain | string | ✓ | Execution chain. | |
data.status | enum ("active" | "paused" | "deleted") | ✓ | Requested task state; engine reports synchronization separately. deleted appears only in the DELETE response. | |
data.version | number | ✓ | Current version, also returned as the ETag. | |
data.spec | object | ✓ | Stored apm.task/2 specification, including the server-assigned id. | |
data.engine | object | null | ✓ | Engine synchronization state, or null when absent. | |
data.engine.applied_version | number | null | ✓ | Last acknowledged version, or null before the first acknowledgement. | |
data.engine.sync_state | string | ✓ | Engine synchronization state: syncing, synced or failed. | |
data.engine.error_code | string | Engine rejection code, when present. | ||
data.engine.warning_code | string | The config has taken effect. prior_buyers_unavailable means listed wallet history is still loading. prior_buyers_fast_unavailable means updates for some listed wallets are delayed. The task may miss purchases those wallets make just before the leader buys. This warning does not reject buys. prior_buyers_over_limit means the account exceeds the wallet limit on this chain. Purchases by wallets beyond the limit are not checked. prior_buyers_history_truncated means a listed wallet bought more than 5,000 distinct tokens inside the window. Only its most recent 5,000 are checked. The task keeps running. | ||
data.engine.updated_at | string | ✓ | Engine state update time in RFC 3339 UTC. | |
data.run_state | object | ✓ | Effective task runtime state. | |
data.run_state.state | enum ("running" | "buy_paused" | "stopped") | ✓ | Effective runtime state: running, buy_paused or stopped. | |
data.run_state.reason | string | null | ✓ | Known buy-pause reasons: account, loss_streak, creator_limit, leader_token_limit, follow_count, buy_fail_streak, funding_low. Buys pause while sells and exits continue. For run-bound pauses, reopen to start a new run: follow, loss and creator counts reset; leader distinct-token counts persist, so raise the limit or disable that filter before reopening. Known stop reasons: low_balance, inactivity, loss_streak, creator_limit. Null means no recorded reason or user stop; unknown reasons are preserved. | |
data.buy_paused | object | null | ✓ | Buy pause for this run, or null. | |
data.buy_paused.rule_id | string | ✓ | Rule that paused buying. | |
data.buy_paused.observed | object | ✓ | Observed values that triggered the pause. | |
data.buy_paused.at | string | ✓ | Buy pause time in RFC 3339 UTC. | |
data.funding_low_since | string | null | ✓ | Start of the low-funding interval in RFC 3339 UTC, or null. | |
data.deactivation_close_position | boolean | ✓ | Whether the latest pause or delete requested closing positions. | |
data.created_at | string | ✓ | Creation time in RFC 3339 UTC. | |
data.updated_at | string | ✓ | Last update time in RFC 3339 UTC. | |
meta | object | ✓ | Request id, plus paging fields when this operation is a list. | |
meta.request_id | string | ✓ | Id of this request. Also sent as the X-Request-Id response header. | |
meta.persistence | enum ("committed") | ✓ | The write has been committed to storage. | |
warnings | array<object | object> | ✓ | Advisory fees from the saved configuration. The write succeeded. No confirmation or retry is needed. Empty when no threshold is exceeded. |
400 — validation_error / unsupported_chain_feature / wallet_unavailable
| Field | Type | Required | Description |
|---|---|---|---|
error | object | ✓ | Why the request failed. |
error.code | string | ✓ | Stable machine-readable error code. |
error.message | string | ✓ | Human-readable explanation of the error. |
error.total | number | Number of distinct blacklisted wallets the account would have on this chain after saving. | |
error.limit | number | Maximum distinct blacklisted wallets per account on this chain. | |
error.details | array<object> | Only present when at least one field-level validation issue exists. | |
error.details[].field | string | ✓ | Request field this issue refers to, or a dotted path such as buy.amount. |
error.details[].reason | string | ✓ | Why that field was rejected. |
error.details[].code | string | Stable machine-readable reason for a strategy spec issue, for example unsupported_leaf or pump_callers_required. Present only on strategy spec validation errors; reason may change. | |
meta | object | ✓ | Request id for this failure. |
meta.request_id | string | ✓ | Id of this request. Also sent as the X-Request-Id response header. |
401 — unauthorized (missing/invalid/revoked/expired Bearer token)
| Field | Type | Required | Description |
|---|---|---|---|
error | object | ✓ | Why the request failed. |
error.code | string | ✓ | Stable machine-readable error code. |
error.message | string | ✓ | Human-readable explanation of the error. |
error.total | number | Number of distinct blacklisted wallets the account would have on this chain after saving. | |
error.limit | number | Maximum distinct blacklisted wallets per account on this chain. | |
error.details | array<object> | Only present when at least one field-level validation issue exists. | |
error.details[].field | string | ✓ | Request field this issue refers to, or a dotted path such as buy.amount. |
error.details[].reason | string | ✓ | Why that field was rejected. |
error.details[].code | string | Stable machine-readable reason for a strategy spec issue, for example unsupported_leaf or pump_callers_required. Present only on strategy spec validation errors; reason may change. | |
meta | object | ✓ | Request id for this failure. |
meta.request_id | string | ✓ | Id of this request. Also sent as the X-Request-Id response header. |
403 — insufficient_scope / ip_not_allowed
| Field | Type | Required | Description |
|---|---|---|---|
error | object | ✓ | Why the request failed. |
error.code | string | ✓ | Stable machine-readable error code. |
error.message | string | ✓ | Human-readable explanation of the error. |
error.total | number | Number of distinct blacklisted wallets the account would have on this chain after saving. | |
error.limit | number | Maximum distinct blacklisted wallets per account on this chain. | |
error.details | array<object> | Only present when at least one field-level validation issue exists. | |
error.details[].field | string | ✓ | Request field this issue refers to, or a dotted path such as buy.amount. |
error.details[].reason | string | ✓ | Why that field was rejected. |
error.details[].code | string | Stable machine-readable reason for a strategy spec issue, for example unsupported_leaf or pump_callers_required. Present only on strategy spec validation errors; reason may change. | |
meta | object | ✓ | Request id for this failure. |
meta.request_id | string | ✓ | Id of this request. Also sent as the X-Request-Id response header. |
404 — not_found
| Field | Type | Required | Description |
|---|---|---|---|
error | object | ✓ | Why the request failed. |
error.code | string | ✓ | Stable machine-readable error code. |
error.message | string | ✓ | Human-readable explanation of the error. |
error.total | number | Number of distinct blacklisted wallets the account would have on this chain after saving. | |
error.limit | number | Maximum distinct blacklisted wallets per account on this chain. | |
error.details | array<object> | Only present when at least one field-level validation issue exists. | |
error.details[].field | string | ✓ | Request field this issue refers to, or a dotted path such as buy.amount. |
error.details[].reason | string | ✓ | Why that field was rejected. |
error.details[].code | string | Stable machine-readable reason for a strategy spec issue, for example unsupported_leaf or pump_callers_required. Present only on strategy spec validation errors; reason may change. | |
meta | object | ✓ | Request id for this failure. |
meta.request_id | string | ✓ | Id of this request. Also sent as the X-Request-Id response header. |
409 — not_paused / invalid_state / idempotency_conflict
| Field | Type | Required | Description |
|---|---|---|---|
error | object | ✓ | Why the request failed. |
error.code | string | ✓ | Stable machine-readable error code. |
error.message | string | ✓ | Human-readable explanation of the error. |
error.total | number | Number of distinct blacklisted wallets the account would have on this chain after saving. | |
error.limit | number | Maximum distinct blacklisted wallets per account on this chain. | |
error.details | array<object> | Only present when at least one field-level validation issue exists. | |
error.details[].field | string | ✓ | Request field this issue refers to, or a dotted path such as buy.amount. |
error.details[].reason | string | ✓ | Why that field was rejected. |
error.details[].code | string | Stable machine-readable reason for a strategy spec issue, for example unsupported_leaf or pump_callers_required. Present only on strategy spec validation errors; reason may change. | |
meta | object | ✓ | Request id for this failure. |
meta.request_id | string | ✓ | Id of this request. Also sent as the X-Request-Id response header. |
412 — version_conflict
| Field | Type | Required | Description |
|---|---|---|---|
error | object | ✓ | Why the request failed. |
error.code | string | ✓ | Stable machine-readable error code. |
error.message | string | ✓ | Human-readable explanation of the error. |
error.total | number | Number of distinct blacklisted wallets the account would have on this chain after saving. | |
error.limit | number | Maximum distinct blacklisted wallets per account on this chain. | |
error.details | array<object> | Only present when at least one field-level validation issue exists. | |
error.details[].field | string | ✓ | Request field this issue refers to, or a dotted path such as buy.amount. |
error.details[].reason | string | ✓ | Why that field was rejected. |
error.details[].code | string | Stable machine-readable reason for a strategy spec issue, for example unsupported_leaf or pump_callers_required. Present only on strategy spec validation errors; reason may change. | |
meta | object | ✓ | Request id for this failure. |
meta.request_id | string | ✓ | Id of this request. Also sent as the X-Request-Id response header. |
428 — precondition_required
| Field | Type | Required | Description |
|---|---|---|---|
error | object | ✓ | Why the request failed. |
error.code | string | ✓ | Stable machine-readable error code. |
error.message | string | ✓ | Human-readable explanation of the error. |
error.total | number | Number of distinct blacklisted wallets the account would have on this chain after saving. | |
error.limit | number | Maximum distinct blacklisted wallets per account on this chain. | |
error.details | array<object> | Only present when at least one field-level validation issue exists. | |
error.details[].field | string | ✓ | Request field this issue refers to, or a dotted path such as buy.amount. |
error.details[].reason | string | ✓ | Why that field was rejected. |
error.details[].code | string | Stable machine-readable reason for a strategy spec issue, for example unsupported_leaf or pump_callers_required. Present only on strategy spec validation errors; reason may change. | |
meta | object | ✓ | Request id for this failure. |
meta.request_id | string | ✓ | Id of this request. Also sent as the X-Request-Id response header. |
429 — rate_limited (Retry-After response header set)
| Field | Type | Required | Description |
|---|---|---|---|
error | object | ✓ | Why the request failed. |
error.code | string | ✓ | Stable machine-readable error code. |
error.message | string | ✓ | Human-readable explanation of the error. |
error.total | number | Number of distinct blacklisted wallets the account would have on this chain after saving. | |
error.limit | number | Maximum distinct blacklisted wallets per account on this chain. | |
error.details | array<object> | Only present when at least one field-level validation issue exists. | |
error.details[].field | string | ✓ | Request field this issue refers to, or a dotted path such as buy.amount. |
error.details[].reason | string | ✓ | Why that field was rejected. |
error.details[].code | string | Stable machine-readable reason for a strategy spec issue, for example unsupported_leaf or pump_callers_required. Present only on strategy spec validation errors; reason may change. | |
meta | object | ✓ | Request id for this failure. |
meta.request_id | string | ✓ | Id of this request. Also sent as the X-Request-Id response header. |
500 — internal_error
| Field | Type | Required | Description |
|---|---|---|---|
error | object | ✓ | Why the request failed. |
error.code | string | ✓ | Stable machine-readable error code. |
error.message | string | ✓ | Human-readable explanation of the error. |
error.total | number | Number of distinct blacklisted wallets the account would have on this chain after saving. | |
error.limit | number | Maximum distinct blacklisted wallets per account on this chain. | |
error.details | array<object> | Only present when at least one field-level validation issue exists. | |
error.details[].field | string | ✓ | Request field this issue refers to, or a dotted path such as buy.amount. |
error.details[].reason | string | ✓ | Why that field was rejected. |
error.details[].code | string | Stable machine-readable reason for a strategy spec issue, for example unsupported_leaf or pump_callers_required. Present only on strategy spec validation errors; reason may change. | |
meta | object | ✓ | Request id for this failure. |
meta.request_id | string | ✓ | Id of this request. Also sent as the X-Request-Id response header. |
curl -X PATCH "https://api.apm.fun/v1/strategy-tasks/cfg_8f2a1c9b" \
-H "Authorization: Bearer apm_live_<prefix>.<secret>" \
-H "If-Match: "3"" \
-H "Content-Type: application/merge-patch+json" \
-d '{
"labels": [
"string"
]
}' {
"data": {
"labels": [],
"task_id": "cfg_8f2a1c9b",
"name": "string",
"chain": "string",
"status": "active",
"version": 0,
"spec": {},
"engine": {
"applied_version": null,
"sync_state": "string",
"error_code": "string",
"warning_code": "string",
"updated_at": "string"
},
"run_state": {
"state": "running",
"reason": null
},
"buy_paused": {
"rule_id": "cfg_8f2a1c9b",
"observed": {},
"at": "string"
},
"funding_low_since": null,
"deactivation_close_position": true,
"created_at": "string",
"updated_at": "string"
},
"meta": {
"request_id": "cfg_8f2a1c9b",
"persistence": "committed"
},
"warnings": [
{
"code": "high_fee",
"path": "string",
"side": "buy",
"item": "priority_fee",
"amount": "0.05",
"threshold": "string",
"unit": "SOL"
}
]
}