Retrieve compressed token accounts owned by a specific address. RPC method guide with use cases, tips and examples.
getCompressedTokenAccountsByOwner RPC method retrieves all compressed token accounts owned by a specific public key. The method supports mint filtering to query specific tokens, cursor-based pagination for handling large result sets, and returns parsed token data with merkle context for verification.
You can test this method via the OpenAPI example or custom examples below.
Common Use Cases
owner (PublicKey, required): Base58-encoded public key of the account owner to query token accounts for.options (object, optional): Configuration object containing filtering and pagination parameters:
mint (PublicKey, optional): Base58-encoded mint address to filter results by specific tokencursor (string, optional): Pagination cursor from previous response for fetching next pagelimit (BN, optional): Maximum number of accounts to return (use bn() helper function)items (array): Array of compressed token account objects
compressedAccount (object): Compressed account data and merkle proof context
address (string): Compressed account address (if available)owner (string): Account owner public keylamports (number): Account lamportsdata (object): Account data informationhash (string): Account hash for merkle proof verificationparsed (object): Parsed token-specific information
mint (PublicKey): Token mint addressowner (PublicKey): Token account owneramount (BN): Token amount as BN object - use .toString() for exact valuedelegate (PublicKey | null): Delegate address if set, null otherwisestate (number): Account state (0=initialized, 1=frozen, etc.)tlv (Buffer | null): Type-Length-Value extension data if presentcursor (string | null): Pagination cursor for next batch, null if no more resultsamount field is a BN object - use .toString() for exact values or .toNumber() for small amountsstate field is a numeric enum (0=initialized, 1=frozen, etc.) not a stringbn() helper function for the limit parameter, not raw numbersDependencies & Setup
An ID to identify the request.
test-account The version of the JSON-RPC protocol.
2.0 The name of the method to invoke.
getCompressedTokenAccountsByOwner