Skip to main content
organizationId
string
required
Unique identifier for a given Organization.
address
string
required
The Ethereum address to query nonces for.
caip2
enum<string>
required
Enum options: eip155:1, eip155:11155111, eip155:8453, eip155:84532, eip155:137, eip155:80002, eip155:56, eip155:97
nonce
boolean
Whether to fetch the standard on-chain nonce.
gasStationNonce
boolean
Whether to fetch the gas station nonce used for sponsored transactions.
A successful response returns the following fields:
nonce
string
The standard on-chain nonce for the address, if requested.
gasStationNonce
string
The gas station nonce for sponsored transactions, if requested.
curl --request POST \
  --url https://api.turnkey.com/public/v1/query/get_nonces \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --header "X-Stamp: <string> (see Authorizations)" \
  --data '{
    "organizationId": "<string>",
    "address": "<string>",
    "caip2": "<eip155:1>",
    "nonce": "<boolean>",
    "gasStationNonce": "<boolean>"
}'
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().getNonces({
  organizationId: "<string> (Unique identifier for a given Organization.)",
  address: "<string> (The Ethereum address to query nonces for.)",
  caip2: "<eip155:1>" // CAIP-2 chain ID (e.g., 'eip155:1' for Ethereum mainnet).,
  nonce: true // Whether to fetch the standard on-chain nonce.,
  gasStationNonce: true // Whether to fetch the gas station nonce used for sponsored transactions.
});
{
  "nonce": "<string>",
  "gasStationNonce": "<string>"
}