Read X-Ray and apply a bid
INFO
Missing fee or forwarding data remains unavailable, not zero. The examples below are illustrative, not measurements of a real trade.
Applying a bid is read X-Ray → review the proposed fees → update your task.
It uses the existing task update API, not a new trading or apply-bid endpoint.
The update changes every later buy of that task until edited again. It does not
guarantee transaction position. MCP getBlockXray uses the same query, and the
same read-and-update sequence applies there.
1. Read a Solana transaction window
Set APM_API_TOKEN to your API Key and TARGET_TX to an indexed Solana trade’s
transaction hash. X-Ray accepts any existing read scope: copytrade:read,
sniper:read, portfolio:read or orders:read. The example’s task update also
needs the Copy Trade permissions described below. Send the key in the header to
the central API:
curl --fail-with-body --get 'https://api.apm.fun/v1/block-xray' \
-H "Authorization: Bearer $APM_API_TOKEN" \
--data-urlencode 'chain=solana' \
--data-urlencode "tx=$TARGET_TX" \
--data-urlencode 'before_blocks=1' \
--data-urlencode 'after_blocks=1' \
--data-urlencode 'scope=same_token_action' \
--data-urlencode 'include_failed=true'
Each side of the window accepts 0–8 blocks. Use same_token or
same_token_action to include failed rows; all and same_action do not return
them. Omitting include_failed returns successful trades only. In the same-side
scope, failed attempts with an unknown direction remain included.
Read the returned data.swaps. Choose another wallet’s successful buy with
available fee data. Do not use a failed row’s offered_tip: it was offered but
not charged. Successful-row tip and delivered_tip are distinct amounts.
For Solana, fee, priority_fee, tip, delivered_tip and offered_tip are
decimal integer strings in lamports: 1 SOL = 1,000,000,000 lamports.
compute_unit_price is micro-lamports per CU, not SOL. BSC / Robinhood use wei
for fee and gas_price, with compute_units representing gasUsed. Robinhood does
not support Apply bid; for BSC tips and total bids see “BSC tips and total bid” below.
Suppose the chosen row has this subset of fields:
{
"status": "success",
"action": "buy",
"priority_fee": "1000000",
"tip": "2500000",
"tip_forward": "forwarded",
"delivered_tip": "2000000"
}
Its in-transaction bid is 0.0035 SOL, while its delivered bid is
(1000000 + 2000000) / 1000000000 = 0.003 SOL. The default multiplier gives
0.003 × 1.05 = 0.00315 SOL, an increase of 0.00015 SOL, or 5%.
The multiplier is a caller choice, not an API default.
tip_forward appears only on token-scoped successful Solana rows:
none: the tip is zero; use the priority fee.direct: use priority fee plus the directly paid tip.forwarded: use priority fee plus the confirmeddelivered_tip.unseen: use priority fee plus the in-transactiontiponly as an explicitly labeled reference. Do not describe it as a confirmed delivered bid or include it in delivered-bid comparisons.
An absent tip_forward means the delivery status is unavailable. The sending
channel is not returned.
For your own queried order, data.mine.leader_address is the leader wallet that
order copied. It is omitted when the order has no recorded leader address.
Other users’ orders do not expose mine.
Do not add fee: it already includes priority fee. Missing fields are not zero.
Use integer or decimal arithmetic for fee calculations and convert lamports to SOL
before writing task fees. See the X-Ray guide for the
columns, subsidy labels, filters and truncated-list statistics.
2. Read the task and review the change
This worked example uses a writable Solana Copy Trade configuration already in
auto mode with percentage fees: buy_fee_auto: true,
gas.high_tip.enabled: false and buy_landing_fee_bps > 0. Its minimum is
0.002 SOL and its positive maximum is 0.003 SOL. Set CONFIG_ID to your config ID.
The task calls require copytrade:read and copytrade:write.
curl --fail-with-body --include \
"https://api.apm.fun/v1/copy-trade/configs/$CONFIG_ID" \
-H "Authorization: Bearer $APM_API_TOKEN"
If active, pause it through POST /v1/copy-trade/configs/{id}/pause with the
current If-Match. Read again until status: "paused",
engine.sync_state: "synced" and engine.buy_entry: "closed". Use the latest
ETag from that read. A read_only: true configuration cannot accept this update.
These are the existing task editing rules.
Review these proposed changes before writing:
- Minimum: 0.002 → 0.00315 SOL, +0.00115 SOL.
- Maximum: 0.003 → 0.00315 SOL, +0.00015 SOL, because the old cap is below the new minimum. An absent or zero cap would remain uncapped.
- Percentage, fee mode and sell fees: unchanged. The platform subsidy is still added on top where applicable; do not subtract it from 0.00315 SOL.
3. Update through the existing endpoint
Replace the illustrative ETag "7" below with the current quoted ETag. These
task amounts are decimal strings in SOL, not the lamports returned by X-Ray.
curl --fail-with-body --request PATCH \
"https://api.apm.fun/v1/copy-trade/configs/$CONFIG_ID" \
-H "Authorization: Bearer $APM_API_TOKEN" \
-H 'Content-Type: application/merge-patch+json' \
-H 'If-Match: "7"' \
--data '{
"buy_landing_fee_min": "0.00315",
"buy_landing_fee_max": "0.00315"
}'
Send only the fields being changed. No expected_version body field is needed
on this public endpoint; If-Match carries the version. A stale version returns
412 version_conflict: read again and review the updated proposal. After a
timeout, read back before deciding whether another write is needed.
Read GET /v1/copy-trade/configs/{id} again and verify both limits, the unchanged
percentage and sell fees, and engine synchronization. Resume only if you want the
task running, using POST .../{id}/resume and the latest ETag. The new fees then
apply to every later buy, not just the transaction used as the reference.
Other task modes
For a writable Sniper configuration, use /v1/sniper/configs/{id} with
sniper:read and sniper:write; the same fee fields and version rules apply.
Choose the write rule that matches the task’s existing mode:
- Auto, fixed total: update
gas.priority_feeandgas.landing_feeso their sum is the chosen total. The executor performs the actual route split. - Auto, percentage: update
buy_landing_fee_min, raising a lower positivebuy_landing_fee_maxin the same PATCH, as above. Keep the percentage. - Manual: multiply priority fee and the delivered tip separately; write the
selected lane’s values. For Tip not delivered (
tip_forward: unseen), explicitly use the in-transaction tip as the reference. With two lanes, preserve the other lane. Writinggas.priority_feealso changesgas.high_tip.priority_feeunless the request supplies the latter, so include its existing value to preserve it.
For strategy tasks, change the effective buy-fee override, or task-level fees if
there is no override, through the task’s existing versioned save. Preserve sell
fees field by field: when a sell field inherits a changed buy field, explicitly
save its previous effective value in the same update. On public config PATCHes,
use the corresponding sell.gas fields; omitting them can carry buy-fee changes
into inherited sell fees. Do not replace the whole task with the X-Ray row.
To change fees just for copy sells, set the corresponding fields in follow_sell.gas. Omitted fees inherit the sell settings, except that priority_fee also sets high_tip.priority_fee unless the same request gives its own. To keep the stored high-tip priority fee, send it again in that request.
BSC tips and total bid
Successful BSC rows carry these extra fields; amounts are decimal integer strings in wei (1 BNB = 10^18 wei):
builder: the block’s builder,48club,blockrazororother(no marker from either at the start of the block).tip: what this transaction paid to the block’s builder, inside a contract or as a direct transfer; reverted transfers do not count.bundle_tip,bundle_tip_tx,bundle_tx_count: tips paid by the other transactions of the same inferred bundle, the hash of the first one that paid, and the number of transactions in the bundle. A bundle is inferred from the same sender, adjacent positions in the block and consecutive nonces; the chain does not record bundles.bundle_tx_countappears only for more than one transaction; the other two only when another transaction paid a tip.bid: the total bid, summed over the bundle.blockrazor: gas fees + tips;48club: 90% of gas fees + tips (48club counts only transactions that were not in the public mempool; X-Ray treats all as private); omitted forother.
Tips are read from block traces at query time. When they cannot be read, the response carries
"tips_unavailable": true at the top level and the affected rows lack these fields; a missing
value is not zero. Failed rows never carry them. See the
X-Ray guide for how each figure is defined.
To apply a bid to a BSC task, multiply the other row’s bid by your chosen multiplier, convert
it to BNB and write it to the task’s gas.high_tip.landing_fee, with
gas.high_tip.enabled: true in the same request. Leave out gas.priority_fee so the gas price
keeps its value; your gas fee is paid on top of the tip. Without a separate sell, selling
inherits gas: to keep the sell tip, write sell.gas.high_tip.landing_fee with its effective
value from before the change in the same request. For example, with a bid of
"2000000000000000" (0.002 BNB), × 1.05 gives 0.0021 BNB, and the sell tip was 0.0005 BNB:
curl --fail-with-body --request PATCH \
"https://api.apm.fun/v1/copy-trade/configs/$CONFIG_ID" \
-H "Authorization: Bearer $APM_API_TOKEN" \
-H 'Content-Type: application/merge-patch+json' \
-H 'If-Match: "7"' \
--data '{
"gas": { "high_tip": { "enabled": true, "landing_fee": "0.0021" } },
"sell": { "gas": { "high_tip": { "landing_fee": "0.0005" } } }
}'
Pausing, the ETag and reading back after saving work as in the Solana steps above. For tasks
with amount tiers, each tier’s fees are in buy.tiers[] and must be changed per tier.
Query rate and availability
The X-Ray query has a 12 requests per minute per user limit in addition to
the gateway’s general quota. MCP does not increase that allowance. Respect
429 and Retry-After; this is an on-demand analysis query, not a higher-rate
real-time monitoring feed. Fee columns and failed rows only appear as their
source data becomes available. Missing failed rows do not prove no attempts
failed.