Ir al contenido principal

Delete or close strategy – Earn API

Actualizado el
Jul 31, 2026

Resumen

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.

Parámetros

ParameterLocationTipoObligatorioDescripción
idpathcadenaStrategy 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.

CampoTipoObligatorioDescripción
siweobjetoA Sign-In-With-Ethereum proof binding the wallet to (action, payload, issuedAt, expirationTime).
siwe.messagecadenaSIWE message for action `strategy.delete`, including the payload hash and strategy path resource.
siwe.signaturecadenaWallet signature over `siwe.message`.
txHashcadenaNoClose tx hash (legacy envelope).
finalValueUsdcnúmeroNoOn-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.
perChainobjetoNoPer-chain close data keyed by chain id (string).
perChain.<chainId>.txHashcadenaNoClose transaction hash for the chain.
perChain.<chainId>.finalValueUsdcnúmeroNoFinal chain value in decimal US dollars.
perChain.<chainId>.feeUsdcnúmeroNoChain 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>"
}
}'

Respuesta

CampoTipoObligatorioDescripción
successbooleanoAlways true on a 2xx.
acciónstring (deleted | closed)`deleted` for a pre-deposit hard delete; `closed` for a post-deposit DB close.

Example response

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

HTTP responses

EstadoDescripción
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.