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

# Token Balances by Owner

> Get all SPL token balances for a wallet owner at a specific timestamp



## OpenAPI

````yaml GET /api/v1/customer/solana/token-balances/account-owner/{account_owner}
openapi: 3.1.0
info:
  title: SonarX Solana API - Balances
  description: >-
    Query SOL and SPL token balances for Solana accounts. Supports both
    historical point-in-time queries and current real-time balances.
  version: 1.0.0
servers:
  - url: https://api-gateway.sonarx.com
    description: Production API
security:
  - apiKey: []
tags:
  - name: Historical Balances
    description: Query historical balances at specific timestamps
  - name: 1-Second Balances
    description: Query SOL balances at 1-second resolution (2026+ data)
  - name: Current Balances
    description: Query current real-time balances from Solana RPC
paths:
  /api/v1/customer/solana/token-balances/account-owner/{account_owner}:
    get:
      tags:
        - Historical Balances
      summary: Token Balances by Owner
      description: >-
        Get all SPL token balances for a Solana wallet owner at a specific
        historical timestamp.
      operationId: getTokenBalancesByOwner
      parameters:
        - name: account_owner
          in: path
          description: The Solana wallet owner address (base58 encoded, 32-44 characters)
          required: true
          schema:
            type: string
            example: 4G1mhdPXaUUf2yvCHnZSejDCpPxS7ymPzjYHNfzJqdE9
        - name: datetime_filter
          in: query
          description: >-
            Datetime at 10-minute intervals with timezone. Format:
            YYYY-MM-DDTHH:MM:SSZ or YYYY-MM-DDTHH:MM:SS+00:00. Minutes must be
            00, 10, 20, 30, 40, or 50, and seconds must be 00. Note: Cannot be
            within the last hour of current UTC time due to data processing lag.
          required: true
          schema:
            type: string
            pattern: >-
              ^\d{4}-\d{2}-\d{2}T\d{2}:(00|10|20|30|40|50):00(Z|[+-]\d{2}:\d{2})$
            example: '2024-06-01T12:00:00Z'
        - name: offset
          in: query
          description: Number of results to skip for pagination (0-indexed)
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: limit
          in: query
          description: 'Number of results per page (minimum: 1, maximum: 1000)'
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 1000
            default: 10
        - name: include_metadata
          in: query
          description: >-
            Include token name and symbol metadata in the response. When true,
            populates token_name and token_symbol fields from the token
            registry. This may add slight latency due to additional lookups.
          required: false
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: Token balances for the wallet owner
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenBalancesByOwnerResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    TokenBalancesByOwnerResponse:
      type: object
      properties:
        offset:
          type: integer
          description: Number of results skipped
        limit:
          type: integer
          description: Results per page
        result:
          type: array
          items:
            $ref: '#/components/schemas/TokenBalance'
        count:
          type: integer
          description: Number of records returned
      example:
        offset: 0
        limit: 10
        result:
          - as_of_datetime: '2024-06-01 12:00:00.000'
            account_owner: 4G1mhdPXaUUf2yvCHnZSejDCpPxS7ymPzjYHNfzJqdE9
            token_address: 6kFRCohSxmsXyMYV2uax57BQo224rPaBAf2CpqgduWRn
            token_account: 35hadxsTpn1xxovQReWeD5jskRdYWBjBEo1tD4pqgTh3
            balance: 86000119
            balance_source: 86000119
            datetime_last_updated: '2024-04-08 07:59:49.000'
            block_slot_last_updated: 258979466
          - as_of_datetime: '2024-06-01 12:00:00.000'
            account_owner: 4G1mhdPXaUUf2yvCHnZSejDCpPxS7ymPzjYHNfzJqdE9
            token_address: orcaEKTdK7LKz57vaAYr9QeNsVEPfiu6QeMU1kektZE
            token_account: 12QCfo5SdFuyC9P5oioken91gCYK5vnRbXaDVuV5KLpZ
            balance: 12.956933
            balance_source: 12956933
            datetime_last_updated: '2024-04-20 13:04:30.000'
            block_slot_last_updated: 261237308
        count: 2
    TokenBalance:
      type: object
      properties:
        as_of_datetime:
          type: string
          description: The datetime of the balance snapshot
        account_owner:
          type: string
          description: The wallet owner address
        token_address:
          type: string
          description: The SPL token mint address
        token_account:
          type: string
          description: The associated token account address
        token_name:
          type: string
          nullable: true
          description: Token name (only if include_metadata=true)
        token_symbol:
          type: string
          nullable: true
          description: Token symbol (only if include_metadata=true)
        balance:
          type: number
          description: >-
            The token balance in human-readable format (converted using token
            decimals)
        balance_source:
          type: integer
          description: >-
            Raw balance in smallest units (lamports for SOL, raw token units for
            SPL tokens) before decimal conversion
        datetime_last_updated:
          type: string
          description: When this balance was last updated
        block_slot_last_updated:
          type: integer
          description: The block slot when this balance was last updated
      example:
        as_of_datetime: '2024-06-01 12:00:00.000'
        account_owner: 4G1mhdPXaUUf2yvCHnZSejDCpPxS7ymPzjYHNfzJqdE9
        token_address: 6kFRCohSxmsXyMYV2uax57BQo224rPaBAf2CpqgduWRn
        token_account: 35hadxsTpn1xxovQReWeD5jskRdYWBjBEo1tD4pqgTh3
        balance: 86000119
        balance_source: 86000119
        datetime_last_updated: '2024-04-08 07:59:49.000'
        block_slot_last_updated: 258979466
    ErrorResponse:
      type: object
      properties:
        detail:
          type: string
      required:
        - detail
  responses:
    BadRequest:
      description: Bad Request - Invalid parameters provided
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            datetime_too_recent:
              summary: Datetime filter too recent
              value:
                detail: >-
                  datetime_filter cannot exceed 2024-06-01T11:00. Data is only
                  available up to this time.
            invalid_datetime_format:
              summary: Invalid datetime format
              value:
                detail: >-
                  datetime_filter must include timezone (e.g.,
                  2024-01-15T10:30:00Z or 2024-01-15T10:30:00+00:00)
            invalid_seconds:
              summary: Invalid seconds value
              value:
                detail: >-
                  datetime_filter seconds must be 00. Received UTC time:
                  2024-06-01T12:00:30
            invalid_token_account:
              summary: Invalid token account
              value:
                detail: >-
                  ABC123 is not a valid token account: account does not exist on
                  Solana or has no data
    Unauthorized:
      description: Unauthorized - Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missing_key:
              summary: Missing API key
              value:
                detail: API key is required
            invalid_key:
              summary: Invalid API key
              value:
                detail: Invalid API key
    NotFound:
      description: Not Found - Resource does not exist
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            account_not_found:
              summary: Account not found
              value:
                detail: No balance data found for the specified account
    InternalError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            server_error:
              summary: Server error
              value:
                detail: An unexpected error occurred
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: apikey
      description: API key for authentication

````