Skip to main content
The following functionality exists for wallets reconstituted server-side. More on Privy architecture here
Your app can see the Privy gas credits charged for sponsored gas in two ways:
  • Per transaction: each sponsored transaction and wallet action step reports the gas credits charged for it.
  • Across wallets: the GET /v1/apps/gas_spend endpoint totals the gas credits charged across a set of wallets over a given time range.
This is useful for tracking gas credit consumption per wallet, reconciling costs, and building internal usage dashboards.

Per transaction

Sponsored transactions include gas_credits_charged, the gas credits charged as a value and currency pair. The field is returned by: The field may be null on reads made immediately after confirmation. Its value is always "0" on sponsored testnet transactions.
Response
Transaction webhooks don’t include gas_credits_charged, and the field on wallet action webhook steps may still be null when the webhook fires. Fetch the transaction or wallet action directly for up-to-date gas data.

Across wallets

The total covers both RPC transactions and wallet actions.

Request

Send a GET request to https://api.privy.io/v1/apps/gas_spend with the following query parameters:
string[]
required
Array of wallet IDs to query. Must contain between 1 and 100 IDs.
number
required
Start of the time range in milliseconds (inclusive).
number
required
End of the time range in milliseconds (exclusive). The range between start_timestamp and end_timestamp must not exceed 30 days.

Response

string
Total Privy gas credits charged in USD, as a decimal string (e.g. "12.345678").
string
The currency of the value. Always "usd".

Example

Response

Errors