Skip to main content
Privy’s API provides abstractions for common actions taken by a wallet, including transfers, swaps, interactions with DeFi vaults, and more. These are called wallet action APIs. At a high-level, wallet action APIs abstract away the complexity of constructing blockchain transactions from scratch, managing blockchain state, and facilitating actions that may require multiple transactions or steps. Your service just integrates a simple API for wallet actions, and Privy handles the onchain complexity.

Taking actions with a wallet

To take an action (such as a swap) with a wallet in Privy, there are two high-level approaches.
IntegrationFunctionalityRecommended for
Low-level RPCCompute raw signatures and execute EVM and SVM JSON-RPC requests. Requires developers to construct their own transaction payloads and facilitate multi-transaction flows.Custom use cases and lower-level flows
Wallet action APIsExecute common onchain flows such as transfers, swaps, DeFi, and more via a simple, intuitive interface. Privy handles the onchain complexity.Most use cases
Generally, we recommend using the abstracted wallet action APIs, which are listed below.

Available actions

The current set of abstracted wallet actions APIs includes the endpoints below. All endpoints begin with the route /v1/wallets/{wallet_id}/, followed by the slug.
ActionSlugDescription
TransfertransferExecutes a transfer of stablecoins (USDC, USDT, USDB) or native tokens (ETH, SOL, POL).
SwapswapSwaps one asset for another via Uniswap.

Wallet action lifecycle

When your application executes a wallet action via one of the endpoints listed above, Privy creates a wallet action resource to model the action and returns it in the API response. In particular, your application can inspect the wallet action resource to get:
  • type: the type of the action ('swap', 'transfer', etc.)
  • status: the current status of the action
  • steps: the steps required to complete the full action, as actions may require multiple transactions in some cases. Within each step, your application can inspect details like transaction hashes, chain IDs, and more.
The steps field of the wallet actions resource is intended to offer lower-level information as to how an action was executed; to generally understand whether an action succeeded or failed, we recommend relying on status. You can fetch the wallet action resource for a given action via the REST API or subscribe to webhooks on wallet action status updates.

Gas management

By default, the wallet action APIs listed above will optimistically sponsor gas for transactions. Concretely, this means:
  1. If your application has enabled gas sponsorship and has sufficient gas credits, any transactions executed by the wallet action will be sponsored.
  2. If your application does not have gas sponsorship enabled, any actions executed by the wallet action will not be sponsored, and the wallet must pay for gas from its own native token balance.
  3. If your application has enabled gas sponsorship, but you pass sponsor: false in your request body, any transactions executed by the wallet action will not be sponsored.
Simply put, wallet actions APIs will attempt to sponsor gas wherever possible unless specified otherwise.