Skip to main content
POST
/
public
/
v1
/
query
/
get_gas_usage

Authorizations

X-Stamp
string
required
Cryptographically signed (stamped) request to be passed in as a header. For more info, see here.

Body

organizationId
string
required
Unique identifier for a given Organization.

Response

A successful response returns the following fields:
windowDurationMinutes
number
required
The window duration (in minutes) for the organization or sub-organization.
windowLimitUsd
string
required
The window limit (in USD) for the organization or sub-organization.
usageUsd
string
required
The total gas usage (in USD) of all sponsored transactions processed over the last window_duration_minutes
curl --request POST \
  --url https://api.turnkey.com/public/v1/query/get_gas_usage \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --header "X-Stamp: <string> (see Authorizations)" \
  --data '{
    "organizationId": "<string>"
}'
import { Turnkey } from "@turnkey/sdk-server";

const turnkeyClient = new Turnkey({
  apiBaseUrl: "https://api.turnkey.com",
  apiPublicKey: process.env.API_PUBLIC_KEY!,
  apiPrivateKey: process.env.API_PRIVATE_KEY!,
  defaultOrganizationId: process.env.ORGANIZATION_ID!,
});

const response = await turnkeyClient.apiClient().getGasUsage({
  organizationId: "<string> (Unique identifier for a given Organization.)"
});
{
  "windowDurationMinutes": "<number>",
  "windowLimitUsd": "<string>",
  "usageUsd": "<string>"
}