Cancel an Upkeep and Withdraw Funds
Cancelling an Upkeep and withdrawing its remaining LINK balance is a two-step onchain process: first you cancel the Upkeep, then—after a network-specific delay—you withdraw the funds. Only the Upkeep admin can perform these actions.
Prerequisites
- Your Upkeep ID. If you don't know it, see Find your Upkeep ID below.
- The Registry address for the network your Upkeep is on. Find it in the Supported Networks reference.
- A wallet you can sign transactions with using the Upkeep admin address. The examples below use Foundry's
castwith a raw private key, but you can substitute a keystore or Ledger. See Sending Transactions in the Foundry docs for the equivalent--accountor--ledgerflags.
Find your Upkeep ID
If you already know your Upkeep ID, skip to Cancel the Upkeep.
- Using the Automation App: Go to the Chainlink Automation App, connect the admin wallet, and open the Upkeep under My Upkeeps. The Upkeep ID is shown on the Upkeep's detail page.
- Using the lookup spreadsheet: If you no longer have access to the admin wallet's session or the Upkeep isn't showing in the app, look up your Upkeep ID by owner address in the Chainlink Automation Upkeep ID Registry.
Cancel the Upkeep
Call cancelUpkeep on the Registry contract, passing your Upkeep ID:
cast send KEEPER_REGISTRY_ADDRESS \
"cancelUpkeep(uint256)" \
UPKEEP_ID \
--rpc-url $CHAIN_RPC_URL \
--private-key $PRIVATE_KEY
Where:
KEEPER_REGISTRY_ADDRESSis the address of the Registry contract for your network.UPKEEP_IDis your numerical Upkeep ID.CHAIN_RPC_URLis the HTTP RPC URL for your network.
Wait for the cancellation delay
After the cancel transaction confirms, you must wait for a delay—measured in blocks and varying by network—before you can withdraw funds. Attempting to withdraw before the delay has passed will revert.
Withdraw the funds
Once the delay has passed, call withdrawFunds on the same Registry contract to send the remaining LINK balance to an address of your choice:
cast send KEEPER_REGISTRY_ADDRESS \
"withdrawFunds(uint256,address)" \
UPKEEP_ID \
TO_ADDRESS \
--rpc-url $CHAIN_RPC_URL \
--private-key $PRIVATE_KEY
Where:
KEEPER_REGISTRY_ADDRESSis the address of the Registry contract for your network.UPKEEP_IDis your numerical Upkeep ID.TO_ADDRESSis the wallet address that should receive the withdrawn LINK.CHAIN_RPC_URLis the HTTP RPC URL for your network.
Once this transaction confirms, the Upkeep's remaining LINK balance is transferred to TO_ADDRESS and the Upkeep is fully decommissioned.