跳至主要內容

Delete or close strategy – Earn API

更新於
Jul 31, 2026

概覽

Deletes a pre-deposit strategy; closes a funded strategy that needs no on-chain withdrawal (the fallback: "delete" target of POST .../calldata/withdraw). SignedRequest, action strategy.delete, empty signed payload ({}); the id rides in the path and the proof's - path: entry binds it.

Endpoint

DELETE https://earn-api.quicknode.dev/functions/v1/api/v1/strategies/{id}

Authorization

Include the published apikey header and a valid Sign-In with Ethereum (SIWE) proof in the request body. The SIWE message binds the wallet to this action, payload, and request path.

參數

參數Location類型Required說明
id路徑字串是的Strategy UUID.

Request body

A pre-deposit delete is usually just the siwe block (empty signed payload {}). A post-deposit close MAY carry final-value fields (all part of the signed payload): a legacy envelope (txHash, finalValueUsdc) or a per-chain map that must cover every active-position chain.

領域類型Required說明
siwe物件是的A Sign-In-With-Ethereum proof binding the wallet to (action, payload, issuedAt, expirationTime).
siwe.message字串是的SIWE message for action `strategy.delete`, including the payload hash and strategy path resource.
siwe.signature字串是的Wallet signature over `siwe.message`.
txHash字串Close tx hash (legacy envelope).
finalValueUsdc數字On-chain final value in decimal dollars (legacy envelope), covering the whole close. Withdrawal amounts already recorded from on-chain close events always take precedence: only the excess of this value above the recorded event total is counted (floored at zero) and stands in for the legs those events do not cover, so the recorded events win over a stale or lower total.
perChain物件Per-chain close data keyed by chain id (string).
perChain.<chainId>.txHash字串Close transaction hash for the chain.
perChain.<chainId>.finalValueUsdc數字Final chain value in decimal US dollars.
perChain.<chainId>.feeUsdc數字Chain close fee in decimal US dollars.

Example request

curl --request DELETE \
--url 'https://earn-api.quicknode.dev/functions/v1/api/v1/strategies/<STRATEGY_ID>' \
--header 'Accept: application/json' \
--header 'apikey: <EARN_PUBLIC_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"siwe": {
"message": "<SIWE_MESSAGE>",
"signature": "<SIGNATURE>"
}
}'

回應

領域類型Required說明
success布林值是的Always true on a 2xx.
動作string (deleted | closed)是的`deleted` for a pre-deposit hard delete; `closed` for a post-deposit DB close.

Example response

{
"success": true,
"action": "deleted"
}

HTTP responses

狀態說明
200Deletion or close result.
400Malformed request/SIWE, OR active positions remain on chains not covered by a per-chain close (`invalid_request`).
401SIWE verification failed. `code` is one of: `siwe_domain` (message domain not allowlisted), `siwe_action` (statement/action mismatch), `siwe_stale` (expired or validity window out of bounds), `siwe_payload` (payload hash or resource mismatch — canonicalization drift, a re-serialized body, or a `- path:` entry that does not match the request path), `siwe_chain` (bad chain id), `siwe_recover` (signature does not match the claimed address), `siwe_replay` (nonce already used — sign a fresh request).
404Resource not found.
429Rate limit exceeded. `Retry-After` (seconds) tells you when to retry. Reads, feedback, and push writes are keyed per IP; create/update/delete are keyed per wallet+IP; deposit/withdraw/claim calldata is keyed per strategy+IP.
500Internal server error.
503Signature verification could not reach the chain to validate a contract (ERC-1271) wallet. Transient — retry. Only occurs for smart-wallet signers.
OpenAPI source

This page is based on operation deleteStrategyEarn OpenAPI 3.1 specification.