API 参考文档 v1
获取 API Key 获取 Key

PATCH /v1/strategy-tasks/{id}

修改策略任务

请求体按 JSON Merge Patch 合并进已有 spec,不含 id;数组整体替换。携带 If-Match,合并后整体校验。仅改名可在运行中进行,其余修改要求任务暂停且引擎已同步。修改 FOMO 绑定请使用旧配置接口。需要 copytrade:write scope。

所需 Scope: copytrade:write

路径参数

字段类型必填说明
idstring✓Strategy task ID.

请求头

字段类型必填说明
If-Matchstring✓Current ETag from a prior read or write; required for optimistic concurrency.

请求体 application/merge-patch+json

字段类型必填约束说明
labelsarray<string>maxItems: 10Caller-defined task labels. Up to 10 labels of 1–24 characters. Whitespace is trimmed and duplicates are removed.

响应

200 — Committed

字段类型必填约束说明
dataobject✓Response payload.
data.labelsarray<string>default: []The caller's task labels. Empty if none are set.
data.task_idstring✓Strategy task ID.
data.namestring✓Task display name.
data.chainstring✓Execution chain.
data.statusenum ("active" | "paused" | "deleted")✓Requested task state; engine reports synchronization separately. deleted appears only in the DELETE response.
data.versionnumber✓Current version, also returned as the ETag.
data.specobject✓Stored apm.task/2 specification, including the server-assigned id.
data.engineobject | null✓Engine synchronization state, or null when absent.
data.engine.applied_versionnumber | null✓Last acknowledged version, or null before the first acknowledgement.
data.engine.sync_statestring✓Engine synchronization state: syncing, synced or failed.
data.engine.error_codestringEngine rejection code, when present.
data.engine.warning_codestringThe 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_atstring✓Engine state update time in RFC 3339 UTC.
data.run_stateobject✓Effective task runtime state.
data.run_state.stateenum ("running" | "buy_paused" | "stopped")✓Effective runtime state: running, buy_paused or stopped.
data.run_state.reasonstring | 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_pausedobject | null✓Buy pause for this run, or null.
data.buy_paused.rule_idstring✓Rule that paused buying.
data.buy_paused.observedobject✓Observed values that triggered the pause.
data.buy_paused.atstring✓Buy pause time in RFC 3339 UTC.
data.funding_low_sincestring | null✓Start of the low-funding interval in RFC 3339 UTC, or null.
data.deactivation_close_positionboolean✓Whether the latest pause or delete requested closing positions.
data.created_atstring✓Creation time in RFC 3339 UTC.
data.updated_atstring✓Last update time in RFC 3339 UTC.
metaobject✓Request id, plus paging fields when this operation is a list.
meta.request_idstring✓Id of this request. Also sent as the X-Request-Id response header.
meta.persistenceenum ("committed")✓The write has been committed to storage.
warningsarray<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

字段类型必填说明
errorobject✓Why the request failed.
error.codestring✓Stable machine-readable error code.
error.messagestring✓Human-readable explanation of the error.
error.totalnumberNumber of distinct blacklisted wallets the account would have on this chain after saving.
error.limitnumberMaximum distinct blacklisted wallets per account on this chain.
error.detailsarray<object>Only present when at least one field-level validation issue exists.
error.details[].fieldstring✓Request field this issue refers to, or a dotted path such as buy.amount.
error.details[].reasonstring✓Why that field was rejected.
error.details[].codestringStable 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.
metaobject✓Request id for this failure.
meta.request_idstring✓Id of this request. Also sent as the X-Request-Id response header.

401 — unauthorized (missing/invalid/revoked/expired Bearer token)

字段类型必填说明
errorobject✓Why the request failed.
error.codestring✓Stable machine-readable error code.
error.messagestring✓Human-readable explanation of the error.
error.totalnumberNumber of distinct blacklisted wallets the account would have on this chain after saving.
error.limitnumberMaximum distinct blacklisted wallets per account on this chain.
error.detailsarray<object>Only present when at least one field-level validation issue exists.
error.details[].fieldstring✓Request field this issue refers to, or a dotted path such as buy.amount.
error.details[].reasonstring✓Why that field was rejected.
error.details[].codestringStable 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.
metaobject✓Request id for this failure.
meta.request_idstring✓Id of this request. Also sent as the X-Request-Id response header.

403 — insufficient_scope / ip_not_allowed

字段类型必填说明
errorobject✓Why the request failed.
error.codestring✓Stable machine-readable error code.
error.messagestring✓Human-readable explanation of the error.
error.totalnumberNumber of distinct blacklisted wallets the account would have on this chain after saving.
error.limitnumberMaximum distinct blacklisted wallets per account on this chain.
error.detailsarray<object>Only present when at least one field-level validation issue exists.
error.details[].fieldstring✓Request field this issue refers to, or a dotted path such as buy.amount.
error.details[].reasonstring✓Why that field was rejected.
error.details[].codestringStable 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.
metaobject✓Request id for this failure.
meta.request_idstring✓Id of this request. Also sent as the X-Request-Id response header.

404 — not_found

字段类型必填说明
errorobject✓Why the request failed.
error.codestring✓Stable machine-readable error code.
error.messagestring✓Human-readable explanation of the error.
error.totalnumberNumber of distinct blacklisted wallets the account would have on this chain after saving.
error.limitnumberMaximum distinct blacklisted wallets per account on this chain.
error.detailsarray<object>Only present when at least one field-level validation issue exists.
error.details[].fieldstring✓Request field this issue refers to, or a dotted path such as buy.amount.
error.details[].reasonstring✓Why that field was rejected.
error.details[].codestringStable 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.
metaobject✓Request id for this failure.
meta.request_idstring✓Id of this request. Also sent as the X-Request-Id response header.

409 — not_paused / invalid_state / idempotency_conflict

字段类型必填说明
errorobject✓Why the request failed.
error.codestring✓Stable machine-readable error code.
error.messagestring✓Human-readable explanation of the error.
error.totalnumberNumber of distinct blacklisted wallets the account would have on this chain after saving.
error.limitnumberMaximum distinct blacklisted wallets per account on this chain.
error.detailsarray<object>Only present when at least one field-level validation issue exists.
error.details[].fieldstring✓Request field this issue refers to, or a dotted path such as buy.amount.
error.details[].reasonstring✓Why that field was rejected.
error.details[].codestringStable 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.
metaobject✓Request id for this failure.
meta.request_idstring✓Id of this request. Also sent as the X-Request-Id response header.

412 — version_conflict

字段类型必填说明
errorobject✓Why the request failed.
error.codestring✓Stable machine-readable error code.
error.messagestring✓Human-readable explanation of the error.
error.totalnumberNumber of distinct blacklisted wallets the account would have on this chain after saving.
error.limitnumberMaximum distinct blacklisted wallets per account on this chain.
error.detailsarray<object>Only present when at least one field-level validation issue exists.
error.details[].fieldstring✓Request field this issue refers to, or a dotted path such as buy.amount.
error.details[].reasonstring✓Why that field was rejected.
error.details[].codestringStable 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.
metaobject✓Request id for this failure.
meta.request_idstring✓Id of this request. Also sent as the X-Request-Id response header.

428 — precondition_required

字段类型必填说明
errorobject✓Why the request failed.
error.codestring✓Stable machine-readable error code.
error.messagestring✓Human-readable explanation of the error.
error.totalnumberNumber of distinct blacklisted wallets the account would have on this chain after saving.
error.limitnumberMaximum distinct blacklisted wallets per account on this chain.
error.detailsarray<object>Only present when at least one field-level validation issue exists.
error.details[].fieldstring✓Request field this issue refers to, or a dotted path such as buy.amount.
error.details[].reasonstring✓Why that field was rejected.
error.details[].codestringStable 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.
metaobject✓Request id for this failure.
meta.request_idstring✓Id of this request. Also sent as the X-Request-Id response header.

429 — rate_limited (Retry-After response header set)

字段类型必填说明
errorobject✓Why the request failed.
error.codestring✓Stable machine-readable error code.
error.messagestring✓Human-readable explanation of the error.
error.totalnumberNumber of distinct blacklisted wallets the account would have on this chain after saving.
error.limitnumberMaximum distinct blacklisted wallets per account on this chain.
error.detailsarray<object>Only present when at least one field-level validation issue exists.
error.details[].fieldstring✓Request field this issue refers to, or a dotted path such as buy.amount.
error.details[].reasonstring✓Why that field was rejected.
error.details[].codestringStable 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.
metaobject✓Request id for this failure.
meta.request_idstring✓Id of this request. Also sent as the X-Request-Id response header.

500 — internal_error

字段类型必填说明
errorobject✓Why the request failed.
error.codestring✓Stable machine-readable error code.
error.messagestring✓Human-readable explanation of the error.
error.totalnumberNumber of distinct blacklisted wallets the account would have on this chain after saving.
error.limitnumberMaximum distinct blacklisted wallets per account on this chain.
error.detailsarray<object>Only present when at least one field-level validation issue exists.
error.details[].fieldstring✓Request field this issue refers to, or a dotted path such as buy.amount.
error.details[].reasonstring✓Why that field was rejected.
error.details[].codestringStable 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.
metaobject✓Request id for this failure.
meta.request_idstring✓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"
    ]
  }'
响应示例 200
{
  "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"
    }
  ]
}