> ## 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.

# getHistoricalTokenAccountBalances RPC Method

> Read the balance of up to 100 token accounts at any past slot or timestamp, with owner and mint. getHistoricalTokenAccountBalances RPC parameters and examples.

Get the balance of up to 100 token accounts at one point in the past. Each entry has the account's owner, mint, amount and decimals, plus the change that set that balance. It also works for token accounts that have since been closed.

* Pass token account addresses, not wallets, and exactly one of `slot` or `timestamp` (Unix seconds).
* The balance is the last one at or before that point. `lastBalanceChange.slot` and `timestamp` belong to that change, not to the point you asked for.
* `balances` keeps the order of `accounts`; an account with no known balance at that point is `null`.
* Amounts are token units only. The account's rent lamports are not included; use `getAccountInfo` with `slot` for the full account.
* A zero balance does not mean the account was closed.
* 1 to 100 accounts per request.

Cost: 2 credits per call, counted against General RPS.

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 gethistoricaltokenaccountbalances 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: getHistoricalTokenAccountBalances
      description: >-
        Read the balance of up to 100 token accounts at a past slot or
        timestamp, with owner, mint and the change that set each balance.
      operationId: gethistoricaltokenaccountbalances
      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:
                        - getHistoricalTokenAccountBalances
                      description: The name of the RPC method to invoke.
                      example: getHistoricalTokenAccountBalances
                      default: getHistoricalTokenAccountBalances
                params:
                  allOf:
                    - type: array
                      description: >-
                        A single configuration object with the token accounts
                        and one point in time.
                      default:
                        - accounts:
                            - CSBvQkExysKY55vCQbrrQYCTpdkeGbYNx3ir42SmdhyK
                          slot: 411108200
                      items:
                        type: object
                        description: Token accounts and the point in time to read them at.
                        required:
                          - accounts
                        properties:
                          accounts:
                            type: array
                            description: >-
                              Token account addresses to read, 1 to 100. Pass
                              token accounts, not wallet addresses.
                            minItems: 1
                            maxItems: 100
                            items:
                              type: string
                            example:
                              - CSBvQkExysKY55vCQbrrQYCTpdkeGbYNx3ir42SmdhyK
                          slot:
                            type: integer
                            description: >-
                              Read balances as of this slot. Set exactly one of
                              `slot` or `timestamp`.
                            example: 411108200
                          timestamp:
                            type: integer
                            description: >-
                              Read balances as of this time, in Unix seconds
                              (milliseconds are also accepted). Set exactly one
                              of `slot` or `timestamp`.
                            example: 1775359465
              required:
                - jsonrpc
                - id
                - method
                - params
            examples:
              bySlot:
                summary: Balances at a slot
                value:
                  jsonrpc: '2.0'
                  id: 1
                  method: getHistoricalTokenAccountBalances
                  params:
                    - accounts:
                        - CSBvQkExysKY55vCQbrrQYCTpdkeGbYNx3ir42SmdhyK
                        - BGocb4GEpbTFm8UFV2VsDSaBXHELPfAXrvd4vtt8QWrA
                      slot: 411108200
              byTimestamp:
                summary: Balances at a Unix timestamp
                value:
                  jsonrpc: '2.0'
                  id: 1
                  method: getHistoricalTokenAccountBalances
                  params:
                    - accounts:
                        - CSBvQkExysKY55vCQbrrQYCTpdkeGbYNx3ir42SmdhyK
                      timestamp: 1767225600
      responses:
        '200':
          description: Historical token account balances in request order.
          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: Balances in request order.
                        properties:
                          balances:
                            type: array
                            description: >-
                              One entry per requested account, in the same
                              order. `null` when no balance is known for that
                              account at that point.
                            items:
                              oneOf:
                                - type: 'null'
                                  description: >-
                                    No balance found for this account at or
                                    before the point.
                                - type: object
                                  description: Token balance of one token account.
                                  properties:
                                    account:
                                      type: string
                                      description: Token account address.
                                      example: >-
                                        CSBvQkExysKY55vCQbrrQYCTpdkeGbYNx3ir42SmdhyK
                                    owner:
                                      type: string
                                      description: Wallet that owns the token account.
                                      example: >-
                                        7xK1a6Ut1pCrH9CiMwdEqx7RyhqgUZRux692Sg4m1TTw
                                    mint:
                                      type: string
                                      description: Token mint address.
                                      example: >-
                                        EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                                    amount:
                                      type: object
                                      description: >-
                                        Token balance at the requested point.
                                        Token units only; the account's rent
                                        lamports are not included.
                                      properties:
                                        raw:
                                          type: string
                                          description: >-
                                            Amount in base units (lamports for SOL),
                                            as a decimal string.
                                          example: '1523847120'
                                        decimals:
                                          type: integer
                                          description: Decimals of the token (9 for SOL).
                                          example: 9
                                        uiAmount:
                                          type: number
                                          description: >-
                                            Amount with decimals applied, as a
                                            number.
                                          example: 1.52384712
                                        uiAmountString:
                                          type: string
                                          description: >-
                                            Amount with decimals applied, as a
                                            string.
                                          example: '1.52384712'
                                    lastBalanceChange:
                                      type: object
                                      description: >-
                                        The balance change that produced this
                                        balance: the last change at or before
                                        the requested point. Its slot and
                                        timestamp are those of the change, not
                                        the point you asked for.
                                      properties:
                                        slot:
                                          type: integer
                                          description: Slot of the change.
                                          example: 411107934
                                        timestamp:
                                          type: integer
                                          description: >-
                                            Block time of the change, in Unix
                                            seconds.
                                          example: 1775359359
                                        previousAmount:
                                          type: object
                                          description: >-
                                            Balance before the change. Omitted when
                                            it is not known.
                                          properties:
                                            raw:
                                              type: string
                                              description: >-
                                                Amount in base units (lamports for SOL),
                                                as a decimal string.
                                              example: '1523847120'
                                            decimals:
                                              type: integer
                                              description: Decimals of the token (9 for SOL).
                                              example: 9
                                            uiAmount:
                                              type: number
                                              description: >-
                                                Amount with decimals applied, as a
                                                number.
                                              example: 1.52384712
                                            uiAmountString:
                                              type: string
                                              description: >-
                                                Amount with decimals applied, as a
                                                string.
                                              example: '1.52384712'
                                        amount:
                                          type: object
                                          description: >-
                                            Balance after the change. Same as the
                                            top-level `amount`.
                                          properties:
                                            raw:
                                              type: string
                                              description: >-
                                                Amount in base units (lamports for SOL),
                                                as a decimal string.
                                              example: '1523847120'
                                            decimals:
                                              type: integer
                                              description: Decimals of the token (9 for SOL).
                                              example: 9
                                            uiAmount:
                                              type: number
                                              description: >-
                                                Amount with decimals applied, as a
                                                number.
                                              example: 1.52384712
                                            uiAmountString:
                                              type: string
                                              description: >-
                                                Amount with decimals applied, as a
                                                string.
                                              example: '1.52384712'
                                        delta:
                                          type: object
                                          description: >-
                                            Signed change (`amount` minus
                                            `previousAmount`). Omitted when
                                            `previousAmount` is not known.
                                          properties:
                                            raw:
                                              type: string
                                              description: >-
                                                Signed amount in base units, as a
                                                decimal string; starts with `-` when the
                                                balance went down.
                                              example: '-5000'
                                            decimals:
                                              type: integer
                                              description: Decimals of the token (9 for SOL).
                                              example: 9
                                            uiAmount:
                                              type: number
                                              description: >-
                                                Amount with decimals applied, as a
                                                number.
                                              example: -0.000005
                                            uiAmountString:
                                              type: string
                                              description: >-
                                                Amount with decimals applied, as a
                                                string.
                                              example: '-0.000005'
                          found:
                            type: integer
                            description: Number of non-null entries in `balances`.
                            example: 1
              examples:
                bySlot:
                  summary: Balances at a slot
                  value:
                    jsonrpc: '2.0'
                    id: 1
                    result:
                      balances:
                        - account: CSBvQkExysKY55vCQbrrQYCTpdkeGbYNx3ir42SmdhyK
                          owner: 7xK1a6Ut1pCrH9CiMwdEqx7RyhqgUZRux692Sg4m1TTw
                          mint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
                          amount:
                            raw: '2500000000'
                            decimals: 6
                            uiAmount: 2500
                            uiAmountString: '2500'
                          lastBalanceChange:
                            slot: 411106512
                            timestamp: 1775358702
                            previousAmount:
                              raw: '1250000000'
                              decimals: 6
                              uiAmount: 1250
                              uiAmountString: '1250'
                            amount:
                              raw: '2500000000'
                              decimals: 6
                              uiAmount: 2500
                              uiAmountString: '2500'
                            delta:
                              raw: '1250000000'
                              decimals: 6
                              uiAmount: 1250
                              uiAmountString: '1250'
                        - null
                      found: 1
        '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.