> ## Documentation Index
> Fetch the complete documentation index at: https://docs.solanatracker.io/llms.txt
> Use this file to discover all available pages before exploring further.

# getTokenAccountsByDelegateV2 RPC Method

> Page through every token account that approved a delegate, with a cursor, exact totals, changedSince and excludeZero. getTokenAccountsByDelegateV2 RPC parameters and examples.

Page through every token account that approved an address as its delegate with **getTokenAccountsByDelegateV2**. Powered by **Ridge DB**. It takes the same arguments as [getTokenAccountsByDelegate](https://docs.solanatracker.io/solana-rpc/http/gettokenaccountsbydelegate.md), plus paging options, so a delegate approved by thousands of accounts loads in pages instead of one huge reply.

* Pass exactly one of `mint` or `programId`. `programId` must be the SPL Token or Token-2022 program.
* `limit` is 1 to 10,000 per page (default 1,000). Pass `nextCursor` back as `cursor`, with the same filter and options, until `hasMore` is false.
* Every page includes `totalCount`, the exact number of matching accounts.
* `excludeZero` skips empty accounts and returns the largest balances first. Without it, accounts come back in address order.
* `changedSince` returns only accounts changed after that slot.
* Without `encoding`, account data comes back as base64.

Costs 1 credit per call and counts against the getProgramAccounts RPS limit.

Request setup and error handling: [RPC quickstart](https://docs.solanatracker.io/solana-rpc/quickstart.md). Billing: [credits and limits](https://docs.solanatracker.io/solana-rpc/credits-and-rate-limits.md).


## OpenAPI

````yaml gettokenaccountsbydelegatev2 post /
openapi: 3.1.0
info:
  title: Solana RPC
  version: 1.0.0
  description: Solana RPC HTTP method reference.
servers:
  - url: https://rpc-mainnet.solanatracker.io
    description: Mainnet RPC endpoint
security: []
paths:
  /:
    post:
      summary: getTokenAccountsByDelegateV2
      description: >-
        Page through every token account that approved an address as its
        delegate, with a cursor, exact totalCount, changedSince and excludeZero.
        Takes the same arguments as getTokenAccountsByDelegate plus paging
        options.
      operationId: gettokenaccountsbydelegatev2
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  allOf:
                    - type: string
                      enum:
                        - '2.0'
                      description: The JSON-RPC protocol version.
                      example: '2.0'
                id:
                  allOf:
                    - type: string
                      description: A unique identifier for the request.
                      example: '1'
                method:
                  allOf:
                    - type: string
                      enum:
                        - getTokenAccountsByDelegateV2
                      description: The name of the RPC method to invoke.
                      example: getTokenAccountsByDelegateV2
                params:
                  allOf:
                    - type: array
                      description: >-
                        Parameters for paging through token accounts approved to
                        a delegate.
                      default:
                        - 4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T
                        - programId: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                        - encoding: jsonParsed
                          limit: 1000
                      items:
                        oneOf:
                          - type: string
                            description: >-
                              Delegate address to query, as a base-58 encoded
                              string. Returns token accounts that approved this
                              address as their delegate.
                            example: 4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T
                          - type: object
                            description: >-
                              Filter by mint or by token program. Pass exactly
                              one of `mint` or `programId`.
                            properties:
                              mint:
                                type: string
                                description: >-
                                  Token mint address. Only accounts for this
                                  mint are returned.
                                example: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                              programId:
                                type: string
                                description: >-
                                  Token program ID: the SPL Token program or the
                                  Token-2022 program. Other program IDs are
                                  rejected.
                                enum:
                                  - TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                                  - TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb
                                example: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                          - type: object
                            description: >-
                              Configuration object with pagination support and
                              optional fields.
                            properties:
                              commitment:
                                type: string
                                description: The commitment level for the request.
                                enum:
                                  - confirmed
                                  - finalized
                                  - processed
                                example: confirmed
                              minContextSlot:
                                type: integer
                                description: >-
                                  The minimum slot that the request can be
                                  evaluated at. Fails with error -32016 if the
                                  data is older.
                                example: 372900000
                              dataSlice:
                                type: object
                                description: Request a slice of the account's data.
                                properties:
                                  length:
                                    type: integer
                                    description: Number of bytes to return.
                                    example: 10
                                  offset:
                                    type: integer
                                    description: Byte offset from which to start reading.
                                    example: 0
                              encoding:
                                type: string
                                description: >-
                                  Encoding format for account data. Defaults to
                                  `base64`. `base58` only works for 128 bytes of
                                  data or less, so use it with `dataSlice`.
                                enum:
                                  - base58
                                  - base64
                                  - base64+zstd
                                  - jsonParsed
                                default: base64
                                example: jsonParsed
                              limit:
                                type: integer
                                description: >-
                                  Maximum number of token accounts per page.
                                  Defaults to 1,000. Values above 10,000 are
                                  capped at 10,000.
                                minimum: 1
                                maximum: 10000
                                default: 1000
                                example: 1000
                              cursor:
                                type: string
                                description: >-
                                  The `nextCursor` from the previous page. Keep
                                  the same delegate, filter and options while
                                  paging.
                                example: p2b9JXwduXpJn7Vz1DXuBLS4iZDxHNQ3pcmfR6f5rwi
                              changedSince:
                                type: integer
                                description: >-
                                  Only return token accounts last changed after
                                  this slot. Useful for incremental updates.
                                example: 372909702
                              excludeZero:
                                type: boolean
                                description: >-
                                  Skip accounts with a zero token balance. With
                                  `excludeZero`, accounts come back largest
                                  balance first; without it, in address order.
                                default: false
                                example: true
            examples:
              jsonParsedExample:
                summary: All delegated SPL Token accounts with a balance, jsonParsed
                value:
                  jsonrpc: '2.0'
                  id: 1
                  method: getTokenAccountsByDelegateV2
                  params:
                    - 4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T
                    - programId: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                    - encoding: jsonParsed
                      limit: 1000
                      excludeZero: true
              nextPageExample:
                summary: Next page for one mint, base64
                value:
                  jsonrpc: '2.0'
                  id: 1
                  method: getTokenAccountsByDelegateV2
                  params:
                    - 4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T
                    - mint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                    - encoding: base64
                      limit: 1000
                      cursor: p2b9JXwduXpJn7Vz1DXuBLS4iZDxHNQ3pcmfR6f5rwi
      responses:
        '200':
          description: Successfully retrieved a page of token accounts by delegate.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    allOf:
                      - type: string
                        enum:
                          - '2.0'
                        description: The JSON-RPC protocol version.
                        example: '2.0'
                  id:
                    allOf:
                      - type: string
                        description: Identifier matching the request.
                        example: '1'
                  result:
                    allOf:
                      - type: object
                        description: One page of token accounts approved to the delegate.
                        properties:
                          context:
                            type: object
                            description: Context of the response.
                            properties:
                              apiVersion:
                                type: string
                                description: API version.
                                example: 3.0.0
                              slot:
                                type: integer
                                description: Slot the data was read at.
                                example: 372910193
                          value:
                            type: object
                            description: The page and its navigation fields.
                            properties:
                              accounts:
                                type: array
                                description: Token accounts on this page.
                                items:
                                  type: object
                                  properties:
                                    pubkey:
                                      type: string
                                      description: >-
                                        Account Pubkey as a base-58 encoded
                                        string.
                                      example: >-
                                        28YTZEwqtMHWrhWcvv34se7pjS7wctgqzCPB3gReCFKp
                                    account:
                                      type: object
                                      description: Token account details.
                                      properties:
                                        lamports:
                                          type: integer
                                          description: >-
                                            Number of lamports assigned to the
                                            account.
                                          example: 1726080
                                        owner:
                                          type: string
                                          description: >-
                                            Pubkey of the program this account has
                                            been assigned to.
                                          example: >-
                                            TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                                        data:
                                          type: object
                                          description: >-
                                            Token state data associated with the
                                            account.
                                          properties:
                                            program:
                                              type: string
                                              description: Program name.
                                              example: spl-token
                                            parsed:
                                              type: object
                                              description: Parsed token data.
                                              properties:
                                                info:
                                                  type: object
                                                  description: Token account information.
                                                  properties:
                                                    tokenAmount:
                                                      type: object
                                                      description: Token amount details.
                                                      properties:
                                                        amount:
                                                          type: string
                                                          description: Raw balance without decimals.
                                                          example: '1'
                                                        decimals:
                                                          type: integer
                                                          description: Number of decimals.
                                                          example: 1
                                                        uiAmount:
                                                          type: number
                                                          description: Balance in user-friendly format.
                                                          example: 0.1
                                                        uiAmountString:
                                                          type: string
                                                          description: Balance as a string.
                                                          example: '0.1'
                                                    delegate:
                                                      type: string
                                                      description: >-
                                                        The Solana address that has been granted
                                                        delegate authorization to spend or
                                                        manage tokens.
                                                      example: >-
                                                        4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T
                                                    delegatedAmount:
                                                      type: object
                                                      description: >-
                                                        The amount of tokens the delegate has
                                                        been authorized to spend on behalf of
                                                        the owner.
                                                      properties:
                                                        amount:
                                                          type: string
                                                          description: Raw balance without decimals.
                                                          example: '1'
                                                        decimals:
                                                          type: integer
                                                          description: Number of decimals.
                                                          example: 1
                                                        uiAmount:
                                                          type: number
                                                          description: Balance in user-friendly format.
                                                          example: 0.1
                                                        uiAmountString:
                                                          type: string
                                                          description: Balance as a string.
                                                          example: '0.1'
                                                state:
                                                  type: string
                                                  description: Token account state.
                                                  example: initialized
                                                isNative:
                                                  type: boolean
                                                  description: >-
                                                    Indicates if the account holds native
                                                    SOL.
                                                  example: false
                                                mint:
                                                  type: string
                                                  description: Pubkey of the token mint.
                                                  example: >-
                                                    3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E
                                                owner:
                                                  type: string
                                                  description: Pubkey of the account owner.
                                                  example: >-
                                                    CnPoSPKXu7wJqxe59Fs72tkBeALovhsCxYeFwPCQH9TD
                                            space:
                                              type: integer
                                              description: Space allocated for the account.
                                              example: 165
                                        executable:
                                          type: boolean
                                          description: >-
                                            Indicates if the account contains a
                                            program.
                                          example: false
                                        rentEpoch:
                                          type: integer
                                          description: >-
                                            Epoch at which the account will next owe
                                            rent.
                                          example: 4
                                        space:
                                          type: integer
                                          description: Data size of the account.
                                          example: 165
                              hasMore:
                                type: boolean
                                description: True when more pages follow.
                                example: true
                              nextCursor:
                                type:
                                  - string
                                  - 'null'
                                description: >-
                                  Pass as `cursor` to fetch the next page. Null
                                  on the last page.
                                example: p2b9JXwduXpJn7Vz1DXuBLS4iZDxHNQ3pcmfR6f5rwi
                              totalCount:
                                type: integer
                                description: >-
                                  Exact number of accounts matching the
                                  delegate, filter, `excludeZero` and
                                  `changedSince`, across all pages.
                                example: 2841
              examples:
                jsonParsedExample:
                  summary: Page of delegated accounts, jsonParsed
                  value:
                    jsonrpc: '2.0'
                    id: 1
                    result:
                      context:
                        apiVersion: 3.0.0
                        slot: 372910193
                      value:
                        accounts:
                          - account:
                              data:
                                parsed:
                                  info:
                                    delegate: >-
                                      4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T
                                    delegatedAmount:
                                      amount: '250000000'
                                      decimals: 6
                                      uiAmount: 250
                                      uiAmountString: '250'
                                    isNative: false
                                    mint: >-
                                      EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                                    owner: >-
                                      CnPoSPKXu7wJqxe59Fs72tkBeALovhsCxYeFwPCQH9TD
                                    state: initialized
                                    tokenAmount:
                                      amount: '1482093115'
                                      decimals: 6
                                      uiAmount: 1482.093115
                                      uiAmountString: '1482.093115'
                                  type: account
                                program: spl-token
                                space: 165
                              executable: false
                              lamports: 2039280
                              owner: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                              rentEpoch: 18446744073709552000
                              space: 165
                            pubkey: 28YTZEwqtMHWrhWcvv34se7pjS7wctgqzCPB3gReCFKp
                        hasMore: true
                        nextCursor: 28YTZEwqtMHWrhWcvv34se7pjS7wctgqzCPB3gReCFKp
                        totalCount: 2841
        '400':
          description: Bad Request - Invalid request parameters or malformed request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    allOf:
                      - type: string
                        enum:
                          - '2.0'
                        description: The JSON-RPC protocol version.
                        example: '2.0'
                  error:
                    allOf:
                      - type: object
                        properties:
                          code:
                            type: integer
                            description: The error code.
                            example: -32602
                          message:
                            type: string
                            description: The error message.
                          data:
                            type: object
                            description: Additional data about the error.
                  id:
                    allOf:
                      - type: string
                        description: Identifier matching the request.
                        example: '1'
                refIdentifier: '#/components/schemas/ErrorResponse'
              examples:
                example:
                  value:
                    jsonrpc: '2.0'
                    error:
                      code: -32602
                      message: Invalid params
                    id: 1
        '401':
          description: Unauthorized - Invalid or missing API key.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    allOf:
                      - type: string
                        enum:
                          - '2.0'
                        description: The JSON-RPC protocol version.
                        example: '2.0'
                  error:
                    allOf:
                      - type: object
                        properties:
                          code:
                            type: integer
                            description: The error code.
                            example: -32602
                          message:
                            type: string
                            description: The error message.
                          data:
                            type: object
                            description: Additional data about the error.
                  id:
                    allOf:
                      - type: string
                        description: Identifier matching the request.
                        example: '1'
                refIdentifier: '#/components/schemas/ErrorResponse'
              examples:
                example:
                  value:
                    jsonrpc: '2.0'
                    error:
                      code: -32001
                      message: Unauthorized
                    id: 1
        '429':
          description: Too Many Requests - Rate limit exceeded.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    allOf:
                      - type: string
                        enum:
                          - '2.0'
                        description: The JSON-RPC protocol version.
                        example: '2.0'
                  error:
                    allOf:
                      - type: object
                        properties:
                          code:
                            type: integer
                            description: The error code.
                            example: -32602
                          message:
                            type: string
                            description: The error message.
                          data:
                            type: object
                            description: Additional data about the error.
                  id:
                    allOf:
                      - type: string
                        description: Identifier matching the request.
                        example: '1'
                refIdentifier: '#/components/schemas/ErrorResponse'
              examples:
                example:
                  value:
                    jsonrpc: '2.0'
                    error:
                      code: -32005
                      message: Too many requests
                    id: 1
        '500':
          description: Internal Server Error - An error occurred on the server.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    allOf:
                      - type: string
                        enum:
                          - '2.0'
                        description: The JSON-RPC protocol version.
                        example: '2.0'
                  error:
                    allOf:
                      - type: object
                        properties:
                          code:
                            type: integer
                            description: The error code.
                            example: -32602
                          message:
                            type: string
                            description: The error message.
                          data:
                            type: object
                            description: Additional data about the error.
                  id:
                    allOf:
                      - type: string
                        description: Identifier matching the request.
                        example: '1'
                refIdentifier: '#/components/schemas/ErrorResponse'
              examples:
                example:
                  value:
                    jsonrpc: '2.0'
                    error:
                      code: -32603
                      message: Internal error
                    id: 1
        '503':
          description: Service Unavailable - The service is temporarily unavailable.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    allOf:
                      - type: string
                        enum:
                          - '2.0'
                        description: The JSON-RPC protocol version.
                        example: '2.0'
                  error:
                    allOf:
                      - type: object
                        properties:
                          code:
                            type: integer
                            description: The error code.
                            example: -32602
                          message:
                            type: string
                            description: The error message.
                          data:
                            type: object
                            description: Additional data about the error.
                  id:
                    allOf:
                      - type: string
                        description: Identifier matching the request.
                        example: '1'
                refIdentifier: '#/components/schemas/ErrorResponse'
              examples:
                example:
                  value:
                    jsonrpc: '2.0'
                    error:
                      code: -32002
                      message: Service unavailable
                    id: 1
        '504':
          description: Gateway Timeout - The request timed out.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    allOf:
                      - type: string
                        enum:
                          - '2.0'
                        description: The JSON-RPC protocol version.
                        example: '2.0'
                  error:
                    allOf:
                      - type: object
                        properties:
                          code:
                            type: integer
                            description: The error code.
                            example: -32602
                          message:
                            type: string
                            description: The error message.
                          data:
                            type: object
                            description: Additional data about the error.
                  id:
                    allOf:
                      - type: string
                        description: Identifier matching the request.
                        example: '1'
                refIdentifier: '#/components/schemas/ErrorResponse'
              examples:
                example:
                  value:
                    jsonrpc: '2.0'
                    error:
                      code: -32003
                      message: Gateway timeout
                    id: 1
      security:
        - ApiKeyQuery: []
components:
  securitySchemes:
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api_key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.