curl --request POST \
--url https://api.turnkey.com/public/v1/submit/earn_withdraw \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header "X-Stamp: <string> (see Authorizations)" \
--data '{
"type": "ACTIVITY_TYPE_EARN_WITHDRAW",
"timestampMs": "<string> (e.g. 1746736509954)",
"organizationId": "<string> (Your Organization ID)",
"parameters": {
"wrapperAddress": "<string>",
"signWith": "<string>",
"caip2": "<eip155:1>",
"sponsor": "<boolean>",
"amountValue": "<string>"
}
}'
import { Turnkey } from "@turnkey/sdk-server";
const turnkeyClient = new Turnkey({
apiBaseUrl: "https://api.turnkey.com",
apiPublicKey: process.env.API_PUBLIC_KEY!,
apiPrivateKey: process.env.API_PRIVATE_KEY!,
defaultOrganizationId: process.env.ORGANIZATION_ID!,
});
const response = await turnkeyClient.apiClient().earnWithdraw({
wrapperAddress: "<string> (Address of the deployed Earn wrapper holding the position to withdraw from, from ListEarnPositions. Must be one of the org's deployed wrappers.)",
signWith: "<string> (A Wallet account address or Private Key address to withdraw to and sign with. Must be an on-chain address; Private Key identifiers are not supported.)",
caip2: "<eip155:1>" // CAIP-2 chain ID the vault lives on (e.g., 'eip155:8453' for Base).,
sponsor: true // Whether to sponsor this transaction via Gas Station.,
amountValue: "<string> (The amount of the underlying asset to withdraw, in raw on-chain units. Pass 'MAX' to withdraw the entire position.)"
});
{
"activity": {
"id": "<activity-id>",
"status": "ACTIVITY_STATUS_COMPLETED",
"type": "ACTIVITY_TYPE_EARN_WITHDRAW",
"organizationId": "<organization-id>",
"timestampMs": "<timestamp> (e.g. 1746736509954)",
"result": {
"activity": {
"id": "<string>",
"organizationId": "<string>",
"status": "<string>",
"type": "<string>",
"intent": {
"earnWithdrawIntent": {
"wrapperAddress": "<string>",
"signWith": "<string>",
"caip2": "<eip155:1>",
"sponsor": "<boolean>",
"amountValue": "<string>"
}
},
"result": {
"earnWithdrawResult": {
"withdrawRequestId": "<string>"
}
},
"votes": "<array>",
"fingerprint": "<string>",
"canApprove": "<boolean>",
"canReject": "<boolean>",
"createdAt": "<string>",
"updatedAt": "<string>"
}
}
}
}
Activities
Withdraw from Earn vault
Withdraw assets or redeem shares from an enabled yield vault.
curl --request POST \
--url https://api.turnkey.com/public/v1/submit/earn_withdraw \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header "X-Stamp: <string> (see Authorizations)" \
--data '{
"type": "ACTIVITY_TYPE_EARN_WITHDRAW",
"timestampMs": "<string> (e.g. 1746736509954)",
"organizationId": "<string> (Your Organization ID)",
"parameters": {
"wrapperAddress": "<string>",
"signWith": "<string>",
"caip2": "<eip155:1>",
"sponsor": "<boolean>",
"amountValue": "<string>"
}
}'
import { Turnkey } from "@turnkey/sdk-server";
const turnkeyClient = new Turnkey({
apiBaseUrl: "https://api.turnkey.com",
apiPublicKey: process.env.API_PUBLIC_KEY!,
apiPrivateKey: process.env.API_PRIVATE_KEY!,
defaultOrganizationId: process.env.ORGANIZATION_ID!,
});
const response = await turnkeyClient.apiClient().earnWithdraw({
wrapperAddress: "<string> (Address of the deployed Earn wrapper holding the position to withdraw from, from ListEarnPositions. Must be one of the org's deployed wrappers.)",
signWith: "<string> (A Wallet account address or Private Key address to withdraw to and sign with. Must be an on-chain address; Private Key identifiers are not supported.)",
caip2: "<eip155:1>" // CAIP-2 chain ID the vault lives on (e.g., 'eip155:8453' for Base).,
sponsor: true // Whether to sponsor this transaction via Gas Station.,
amountValue: "<string> (The amount of the underlying asset to withdraw, in raw on-chain units. Pass 'MAX' to withdraw the entire position.)"
});
{
"activity": {
"id": "<activity-id>",
"status": "ACTIVITY_STATUS_COMPLETED",
"type": "ACTIVITY_TYPE_EARN_WITHDRAW",
"organizationId": "<organization-id>",
"timestampMs": "<timestamp> (e.g. 1746736509954)",
"result": {
"activity": {
"id": "<string>",
"organizationId": "<string>",
"status": "<string>",
"type": "<string>",
"intent": {
"earnWithdrawIntent": {
"wrapperAddress": "<string>",
"signWith": "<string>",
"caip2": "<eip155:1>",
"sponsor": "<boolean>",
"amountValue": "<string>"
}
},
"result": {
"earnWithdrawResult": {
"withdrawRequestId": "<string>"
}
},
"votes": "<array>",
"fingerprint": "<string>",
"canApprove": "<boolean>",
"canReject": "<boolean>",
"createdAt": "<string>",
"updatedAt": "<string>"
}
}
}
}
A successful response returns the following fields:
Was this page helpful?