Authorizations
API Key
WebAuthn (Passkey)
Cryptographically signed (stamped) request to be passed in as a header. For more info, see
here.
Cryptographically signed (stamped) request to be passed in as a header. For more info, see
here.
Body
Unique identifier for a given Organization.
Response
A successful response returns the following fields:
The window duration (in minutes) for the organization or sub-organization.
The window limit (in USD) for the organization or sub-organization.
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>"
}