跳转至主要内容

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.

参数

ParameterLocation类型Required描述
idpath字符串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.

Field类型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>"
}
}'

回复

Field类型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 deleteStrategy in the Earn OpenAPI 3.1 specification.