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

PATCH /v1/wallets/{wallet}/auto-balance

修改 Solana 钱包自动平衡设置

需要 copytrade:write 权限。只更新提供的字段。开启后可能触发真实兑换。金额用最小单位的十进制字符串,比例用整数基点。并发冲突或结果未知时请先重新读取设置。

所需 Scope: copytrade:write

路径参数

字段类型必填说明
walletstring✓Solana wallet address owned by the caller.

请求体 application/json

字段类型必填约束说明
enabledbooleanWhether auto-balance is enabled for this wallet. Defaults to false.
modeenum ("fixed" | "ratio")Fixed balances or target USDC share. Defaults to fixed.
sol_floorstringpattern: ^\d{1,20}$SOL reserve floor, in lamports. Defaults to 100000000.
sol_minstringpattern: ^\d{1,20}$SOL refill threshold, in lamports. Defaults to 100000000.
sol_refillstringpattern: ^\d{1,20}$SOL refill target, in lamports. Defaults to 200000000.
usdc_targetstringpattern: ^\d{1,20}$Fixed USDC balance target, in millionths of a USDC. Defaults to 0.
usdc_ratio_bpsintegermin: 100, max: 9000Target USDC share in basis points. Defaults to 3000.
band_bpsintegermin: 100, max: 5000Allowed deviation from the target share in basis points. Defaults to 1000.
max_loss_bpsintegermin: 50, max: 300Maximum loss against the reference price in basis points, including pool fees. Defaults to 100.

响应

200 — OK

字段类型必填说明
dataobject✓Response payload.
data.ruleobject✓Current auto-balance settings for this wallet; defaults when never set.
data.rule.enabledboolean✓Whether auto-balance is enabled for this wallet. Defaults to false.
data.rule.modeenum ("fixed" | "ratio")✓Fixed balances or target USDC share. Defaults to fixed.
data.rule.sol_floorstring✓SOL reserve floor, in lamports. Defaults to 100000000.
data.rule.sol_minstring✓SOL refill threshold, in lamports. Defaults to 100000000.
data.rule.sol_refillstring✓SOL refill target, in lamports. Defaults to 200000000.
data.rule.usdc_targetstring✓Fixed USDC balance target, in millionths of a USDC. Defaults to 0.
data.rule.usdc_ratio_bpsinteger✓Target USDC share in basis points. Defaults to 3000.
data.rule.band_bpsinteger✓Allowed deviation from the target share in basis points. Defaults to 1000.
data.rule.max_loss_bpsinteger✓Maximum loss against the reference price in basis points, including pool fees. Defaults to 100.
data.versioninteger | null✓Settings version; null when never saved.
data.syncenum ("off" | "syncing" | "active" | "publish_failed")✓Whether the executor has applied the current version.
data.has_live_taskboolean✓Whether an enabled live Solana strategy task uses this wallet; auto-balance only runs when true.
data.sol_to_usdcenum ("off" | "syncing" | "not_effective" | "effective")✓SOL to USDC swaps only take effect when a live task on this wallet has USDC trading on.
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.

400 — Invalid settings or cursor

字段类型必填说明
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 — Wallet 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 — Settings changed concurrently

字段类型必填说明
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/wallets/cfg_8f2a1c9b/auto-balance" \
  -H "Authorization: Bearer apm_live_<prefix>.<secret>" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": true,
    "mode": "fixed",
    "sol_floor": "string",
    "sol_min": "string",
    "sol_refill": "string",
    "usdc_target": "string",
    "usdc_ratio_bps": 0,
    "band_bps": 0,
    "max_loss_bps": 0
  }'
响应示例 200
{
  "data": {
    "rule": {
      "enabled": true,
      "mode": "fixed",
      "sol_floor": "string",
      "sol_min": "string",
      "sol_refill": "string",
      "usdc_target": "string",
      "usdc_ratio_bps": 0,
      "band_bps": 0,
      "max_loss_bps": 0
    },
    "version": null,
    "sync": "off",
    "has_live_task": true,
    "sol_to_usdc": "off"
  },
  "meta": {
    "request_id": "cfg_8f2a1c9b"
  }
}