> ## Documentation Index
> Fetch the complete documentation index at: https://developers.circle.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Before reading these docs, install the relevant Circle Skill to get pre-loaded context — skills are LLM-optimized and cover architecture decisions, correct flows, and common pitfalls. In Claude Code: run /plugin marketplace add circlefin/skills then /plugin install circle-skills@circle. With Vercel Skills CLI: run npx skills add circlefin/skills. Available skills: use-usdc https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-usdc/SKILL.md (balances, transfers, approvals on EVM and Solana); EURC has no skill — see https://developers.circle.com/stablecoins/what-is-eurc.md; bridge-stablecoin https://github.com/circlefin/skills/blob/master/plugins/circle/skills/bridge-stablecoin/SKILL.md (crosschain transfers via CCTP, USDC, EURC, and third-party assets); use-arc https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-arc/SKILL.md (Arc chain config, contract deployment, USDC bridging — Arc docs: https://docs.arc.io/llms.txt); use-circle-wallets https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-circle-wallets/SKILL.md (choose wallet type); use-developer-controlled-wallets https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-developer-controlled-wallets/SKILL.md (custodial wallets for payouts and treasury); use-user-controlled-wallets https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-user-controlled-wallets/SKILL.md (embedded wallets with Web2 login); use-modular-wallets https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-modular-wallets/SKILL.md (smart contract wallets with passkeys and ERC-4337); use-gateway https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-gateway/SKILL.md (unified USDC balance, nanopayments); use-smart-contract-platform https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-smart-contract-platform/SKILL.md (deploy, interact, monitor contracts). Pair any skill with the Circle MCP server for live SDK signatures, contract addresses, and chain IDs: {"mcpServers":{"circle":{"url":"https://api.circle.com/v1/codegen/mcp"}}}.
> Read the product overview first. Each product has an overview explaining when and why to use it. Read it before quickstarts.
> Pick the right wallet type. Developer-controlled (you hold keys), user-controlled (end user holds keys via PIN/social login), or modular (smart contract wallets with passkeys). See https://developers.circle.com/wallets.md.
> Use CCTP V2 for crosschain transfers. CCTP natively transfers USDC and EURC via burn-and-mint, and supports permissionless wrapping of third-party assets via lock-and-mint. V1 is legacy; always use V2 unless V1 is specified or the chain requires it (Noble, Sui, and Aptos still require V1). Migration guide: https://developers.circle.com/cctp/migration-from-v1-to-v2.md.
> Use Bridge Kit for frontend bridging. Wraps CCTP with a simpler SDK for user-facing apps. Use CCTP directly for backend transfers.
> Gas Station vs Paymaster. Gas Station sponsors gas for Circle Wallet transactions. Paymaster lets users pay gas in USDC. Different use cases — read both overviews.
> Gateway Nanopayments for sub-cent payments. Gasless USDC micropayments down to $0.000001 via x402 and batched settlement. For pay-per-request APIs, AI agent payments, streaming.
> Look up USDC addresses per chain. Never hardcode — use https://developers.circle.com/stablecoins/usdc-contract-addresses.md.
> Prefer SDKs over raw API calls. Node.js and Python SDKs handle auth, retries, and errors.
> API key required. Bearer token in Authorization header. Testnet and mainnet use separate keys and may use different base URLs depending on the product.
> Set up webhooks when available. Most operations are async. Webhooks deliver transaction confirmations and state changes.
> When calling list endpoints, paginate using pageSize and pageAfter until no nextPageAfter cursor is returned—stopping at the first page silently misses records.
> Building an AI agent? Start with the Agent Stack—Circle CLI, agent wallets, and nanopayments built for autonomous use cases: https://developers.circle.com/agent-stack.md.

# How-to: Manage delegates for Gateway transfers

> Add or remove delegate accounts that can authorize Gateway transfers on behalf of a depositor.

Gateway lets you delegate your deposit so that another account can authorize
transfers on your behalf. Adding a delegate grants that account a full allowance
to sign burn intents for your deposited USDC, which is useful when you want a
separate account to initiate transfers, or when you'd rather sign with a
different account than the one that holds the deposit.

A delegate can be any account whose signatures Gateway accepts, such as an
Externally Owned Account (EOA) or a smart contract using
[ERC-1271](/gateway/references/erc-1271).

<Note>
  A smart contract account (SCA) can also authorize transfers directly through
  [ERC-1271](/gateway/references/erc-1271), without adding a delegate at all.
  See [How-to: Transfer USDC from a smart contract
  account](/gateway/howtos/transfer-with-erc-1271).
</Note>

This guide demonstrates how to add and remove delegates for Gateway transfers
using Circle [developer-controlled wallets](/wallets/dev-controlled).

## Prerequisites

Before you begin, ensure that you've:

* Installed [Node.js v22.6+](https://nodejs.org/)
* Created a [Circle Console](https://console.circle.com) account
* Obtained an API key and
  [registered your Entity Secret](/wallets/dev-controlled/register-entity-secret)
* Created two wallets via Circle developer-controlled wallets:
  * The depositor wallet holds your Gateway USDC deposits
  * The delegate wallet will sign burn intents on behalf of the depositor
* Deposited USDC into the Gateway Wallet from your depositor wallet
* Created a TypeScript project with the
  [Developer-Controlled Wallets SDK](/sdks/developer-controlled-wallets-nodejs-sdk)
  installed
* Set up a `.env` file with the following variables:

  ```text .env theme={null}
  CIRCLE_API_KEY={YOUR_API_KEY}
  CIRCLE_ENTITY_SECRET={YOUR_ENTITY_SECRET}
  DEPOSITOR_ADDRESS={YOUR_DEPOSITOR_WALLET_ADDRESS}
  DELEGATE_WALLET_ADDRESS={YOUR_DELEGATE_WALLET_ADDRESS}
  ```

## Add a delegate

Follow these steps to authorize a delegate to sign burn intents on behalf of
your depositor wallet.

### Step 1. Create the add delegate script

Create a new file called `add-delegate.ts` in the root of your project and add
the following code. This calls the
[`addDelegate()`](/gateway/references/contract-interfaces-and-events#adddelegate)
method on the Gateway Wallet contract on Arc Testnet.

```ts add-delegate.ts theme={null}
import { initiateDeveloperControlledWalletsClient } from "@circle-fin/developer-controlled-wallets";

const GATEWAY_WALLET = "0x0077777d7EBA4688BDeF3E311b846F25870A19B9";
const USDC_ADDRESS = "0x3600000000000000000000000000000000000000"; // Arc Testnet
const BLOCKCHAIN = "ARC-TESTNET";

const client = initiateDeveloperControlledWalletsClient({
  apiKey: process.env.CIRCLE_API_KEY!,
  entitySecret: process.env.CIRCLE_ENTITY_SECRET!,
});

async function waitForTx(txId: string) {
  while (true) {
    const { data } = await client.getTransaction({ id: txId });
    const state = data?.transaction?.state;
    if (["COMPLETE", "CONFIRMED"].includes(state!)) return;
    if (["FAILED", "DENIED", "CANCELLED"].includes(state!))
      throw new Error(`Failed: ${state}`);
    await new Promise((resolve) => setTimeout(resolve, 3000));
  }
}

async function main() {
  console.log(`\n=== Processing ${BLOCKCHAIN} ===`);
  console.log(`Adding delegate: ${process.env.DELEGATE_WALLET_ADDRESS}`);

  const tx = await client.createContractExecutionTransaction({
    walletAddress: process.env.DEPOSITOR_ADDRESS!,
    blockchain: BLOCKCHAIN,
    contractAddress: GATEWAY_WALLET,
    abiFunctionSignature: "addDelegate(address,address)",
    abiParameters: [USDC_ADDRESS, process.env.DELEGATE_WALLET_ADDRESS!],
    fee: { type: "level", config: { feeLevel: "MEDIUM" } },
  });

  await waitForTx(tx.data?.id!);
  console.log(`Done on ${BLOCKCHAIN}`);
}

main().catch((error) => {
  console.error("\nError:", error);
  process.exit(1);
});
```

### Step 2. Run the script

Run the script with the following command:

```shell theme={null}
node --env-file=.env add-delegate.ts
```

The script output shows "Done on \<SELECTED\_BLOCKCHAIN>" when the delegate is
successfully authorized. You can now use the delegate to sign burn intents on
behalf of your depositor wallet when making Gateway transfers.

### Step 3. Repeat for other blockchains

To add the delegate on additional blockchains where the depositor holds Gateway
deposits, repeat Steps 1-2 with different `BLOCKCHAIN` and `USDC_ADDRESS` values
for your target blockchains. Check the
[USDC contract addresses](/stablecoins/usdc-contract-addresses) for the correct
values.

<Note>
  The delegate authorization remains valid until explicitly removed with the
  [`removeDelegate()`](/gateway/references/contract-interfaces-and-events#removedelegate)
  method.
</Note>

## Remove a delegate

Follow these steps to revoke a delegate's authorization to sign burn intents on
behalf of your depositor wallet. After removing a delegate, note that:

* The delegate can no longer create new burn intents for the depositor wallet
* Burn intents that were already signed by the delegate remain valid and can
  still be executed onchain
* This ensures that burns may be executed safely even in the event of a
  revocation
* The Gateway API reflects revocations once they are finalized onchain

This behavior is by design to prevent race conditions where a valid burn intent
becomes unusable mid-flight.

### Step 1. Create the remove delegate script

Create a new file called `remove-delegate.ts` in the root of your project and
add the following code. This is nearly identical to the add delegate script, but
calls
[`removeDelegate()`](/gateway/references/contract-interfaces-and-events#removedelegate)
instead.

```ts remove-delegate.ts theme={null}
import { initiateDeveloperControlledWalletsClient } from "@circle-fin/developer-controlled-wallets";

const GATEWAY_WALLET = "0x0077777d7EBA4688BDeF3E311b846F25870A19B9";
const USDC_ADDRESS = "0x3600000000000000000000000000000000000000"; // Arc Testnet
const BLOCKCHAIN = "ARC-TESTNET";

const client = initiateDeveloperControlledWalletsClient({
  apiKey: process.env.CIRCLE_API_KEY!,
  entitySecret: process.env.CIRCLE_ENTITY_SECRET!,
});

async function waitForTx(txId: string) {
  while (true) {
    const { data } = await client.getTransaction({ id: txId });
    const state = data?.transaction?.state;
    if (["COMPLETE", "CONFIRMED"].includes(state!)) return;
    if (["FAILED", "DENIED", "CANCELLED"].includes(state!))
      throw new Error(`Failed: ${state}`);
    await new Promise((resolve) => setTimeout(resolve, 3000));
  }
}

async function main() {
  console.log(`\n=== Processing ${BLOCKCHAIN} ===`);
  console.log(`Removing delegate: ${process.env.DELEGATE_WALLET_ADDRESS}`);

  const tx = await client.createContractExecutionTransaction({
    walletAddress: process.env.DEPOSITOR_ADDRESS!,
    blockchain: BLOCKCHAIN,
    contractAddress: GATEWAY_WALLET,
    abiFunctionSignature: "removeDelegate(address,address)",
    abiParameters: [USDC_ADDRESS, process.env.DELEGATE_WALLET_ADDRESS!],
    fee: { type: "level", config: { feeLevel: "MEDIUM" } },
  });

  await waitForTx(tx.data?.id!);
  console.log(`Done on ${BLOCKCHAIN}`);
}

main().catch((error) => {
  console.error("\nError:", error);
  process.exit(1);
});
```

### Step 2. Run the script

Run the script with the following command:

```shell theme={null}
node --env-file=.env remove-delegate.ts
```
