Prerequisites
The integration requires:- A Privy app ID and app secret.
- Swaps enabled for the Privy app.
- A source Privy wallet. Imported or previously exported wallets cannot receive automation attachments.
- An authorization signature when the source wallet has an owner.
1. Create the automation
Create an app-scoped automation withPOST /v1/wallet_automations.
See configure triggers and actions for supported triggers, filters, and actions.
The source asset alias below does not specify a chain. It matches supported USDC deployments in Privy’s asset registry. The destination includes a chain because every swap must have one destination.
The required owner_id controls changes to the shared automation definition. Set it to null for an app-managed definition. Set it to a key quorum ID to require that quorum’s authorization for updates and deletion.
- cURL
- Node SDK
- Python
id. New automation definitions are enabled by default. API responses contain canonical asset_address and caip2 values for the chain-specific aliases in this example.
See the create automation API reference for the complete schema.
2. Attach it to a wallet
An attachment enables the automation for one wallet. Only enabled automation definitions can be attached. In the swap example, the params indicate that itsdestination_address receives the output of every generated swap.
The destination address must be valid for the action’s destination chain. Attaching the same automation again updates its parameters without changing its matching priority.
- cURL
- Node SDK
- Python
Attaching an automation does not make it a general-purpose wallet signer. Privy authorizes each
execution against the attachment’s trigger, action, wallet, and destination.
3. Send a matching deposit
Send USDC to the source wallet on any chain. Privy detects the incoming transfer and evaluates enabled attachments from oldest to newest. Only the first matching automation creates a wallet action. Privy does not fall through to another matching automation if that action fails. Privy reads the current asset balance when the execution runs. Earlier funds held by the wallet can therefore be included in the swap. Attaching an automation does not process a balance already held by the wallet. Send a new matching deposit or reindex the asset to move that balance.4. Observe the execution
Subscribe towallet_automation.submitted to receive both the automation execution ID and the generated wallet action ID.
The app can also list executions for the source wallet:
- cURL
- Node SDK
- Python
wallet_action_id to track the final swap through the wallet action lifecycle.
Handle errors
Setup requests can fail when:- The app does not have swaps enabled.
- An asset alias, destination chain, or automation owner is invalid.
- The wallet-owner authorization signature is missing or does not cover the exact attach request.
- The destination address is invalid for the configured destination chain.
failure_reason and the generated wallet action when one exists. After correcting a pre-action failure, reindex the asset.
