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

# getAccountInfo

> 返回与提供的公钥账户相关的所有信息。

<Info>
  **新功能**：`getAccountInfo` 现在支持 `changedSinceSlot` 参数用于增量更新。当指定时，该方法仅返回在指定槽位或之后修改过的帐户。对于存在但自指定槽位以来未更改的帐户，响应将包含 `status: "unchanged"`。
</Info>

## 请求参数

<ParamField body="pubkey" type="string" required>
  要查询的帐户的公钥，作为 base-58 编码字符串。
</ParamField>

<ParamField body="commitment" type="string">
  查询的承诺级别。

  * `finalized`
  * `confirmed`
  * `processed`
</ParamField>

<ParamField body="encoding" type="string">
  帐户数据的编码格式。

  * `base58`
  * `base64`
  * `base64+zstd`
  * `jsonParsed`
</ParamField>

<ParamField body="dataSlice" type="object">
  请求帐户数据的切片。
</ParamField>

<ParamField body="dataSlice.offset" type="number">
  开始读取的字节偏移量。
</ParamField>

<ParamField body="dataSlice.length" type="number">
  要返回的字节数。
</ParamField>

<ParamField body="minContextSlot" type="number">
  请求可以评估的最小槽位。
</ParamField>

<ParamField body="changedSinceSlot" type="number">
  仅当帐户在此槽位号或之后被修改时才返回。如果帐户存在但自指定槽位以来未更改，响应将包含状态为 "unchanged"。
</ParamField>


## OpenAPI

````yaml zh/openapi/rpc-http/getAccountInfo.yaml POST /
openapi: 3.1.0
info:
  title: Solana RPC API
  version: 1.0.0
  description: 全面的Solana账户数据检索API，用于访问程序所有权、余额和链上数据，提供多种编码选项和可配置的承诺级别。
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://mainnet.helius-rpc.com
    description: 主网RPC端点
  - url: https://devnet.helius-rpc.com
    description: 开发网RPC端点
security: []
paths:
  /:
    post:
      tags:
        - RPC
      summary: getAccountInfo
      operationId: getAccountInfo
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - jsonrpc
                - id
                - method
                - params
              properties:
                jsonrpc:
                  type: string
                  description: JSON-RPC协议版本。
                  enum:
                    - '2.0'
                  default: '2.0'
                id:
                  type: string
                  description: 请求的唯一标识符。
                  example: '1'
                  default: '1'
                method:
                  type: string
                  description: 要调用的RPC方法名称。
                  enum:
                    - getAccountInfo
                  default: getAccountInfo
                params:
                  type: array
                  default:
                    - 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri
                  items:
                    oneOf:
                      - title: Pubkey
                        type: string
                        description: 要查询账户的公钥，作为base-58编码的字符串。
                        example: 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri
                      - title: Configuration Object
                        type: object
                        description: 配置对象。
                        properties:
                          commitment:
                            type: string
                            description: 查询的承诺级别。
                            enum:
                              - finalized
                              - confirmed
                              - processed
                            example: confirmed
                          encoding:
                            type: string
                            description: 账户数据的编码格式。
                            enum:
                              - base58
                              - base64
                              - base64+zstd
                              - jsonParsed
                            example: base58
                          dataSlice:
                            type: object
                            description: 请求账户数据的一个切片。
                            properties:
                              offset:
                                type: integer
                                description: 开始读取的字节偏移量。
                                example: 0
                              length:
                                type: integer
                                description: 要返回的字节数。
                                example: 64
                          minContextSlot:
                            type: integer
                            description: 请求可以评估的最小槽位。
                            example: 100000000
                          changedSinceSlot:
                            type: integer
                            description: >-
                              仅返回在此槽号之后被修改的账户。如果账户存在但自指定槽以来没有变化，响应将包含状态为"unchanged"。
                            example: 464175999
            example:
              jsonrpc: '2.0'
              id: 1
              method: getAccountInfo
              params:
                - 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri
                - encoding: base58
      responses:
        '200':
          description: 成功检索到账户信息。
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    description: JSON-RPC协议版本。
                    example: '2.0'
                  result:
                    type: object
                    properties:
                      context:
                        type: object
                        description: 请求的上下文。
                        properties:
                          apiVersion:
                            type: string
                            description: 请求的API版本。
                            example: 2.0.15
                          slot:
                            type: integer
                            description: 响应的槽号。
                            example: 341197053
                      value:
                        oneOf:
                          - type: object
                            description: 如果账户存在，则为账户数据。
                            properties:
                              lamports:
                                type: integer
                                description: 分配给此账户的lamports数量。
                                example: 88849814690250
                              owner:
                                type: string
                                description: 此账户分配到的程序的Base-58编码公钥。
                                example: '11111111111111111111111111111111'
                              data:
                                type: array
                                items:
                                  type: string
                                description: 与账户关联的数据，可以是编码的二进制数据或JSON格式。
                                example:
                                  - ''
                                  - base58
                              executable:
                                type: boolean
                                description: 指示账户是否包含程序。
                                example: false
                              rentEpoch:
                                type: integer
                                description: 此账户下次应付租金的纪元。
                                example: 18446744073709552000
                              space:
                                type: integer
                                description: 账户的数据大小。
                                example: 0
                          - type: object
                            description: 仅状态响应，当账户存在但自指定槽位以来未发生变化时。
                            properties:
                              status:
                                type: string
                                description: 指示账户自指定槽位以来未发生变化的状态。
                                enum:
                                  - unchanged
                                example: unchanged
                  id:
                    type: integer
                    description: 与请求ID匹配的唯一标识符。
                    example: 1
                  method:
                    type: string
                    description: 被调用的方法。
                    example: getAccountInfo
                  params:
                    type: array
                    description: 请求的参数。
                    items:
                      oneOf:
                        - type: string
                        - type: object
                          properties:
                            encoding:
                              type: string
              examples:
                response:
                  value:
                    jsonrpc: '2.0'
                    result:
                      context:
                        apiVersion: 2.0.15
                        slot: 341197053
                      value:
                        lamports: 88849814690250
                        owner: '11111111111111111111111111111111'
                        data:
                          - ''
                          - base58
                        executable: false
                        rentEpoch: 18446744073709552000
                        space: 0
                    id: 1
        '400':
          description: 错误请求 - 请求参数无效或请求格式错误。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32602
                  message: Invalid params
                id: '1'
        '401':
          description: 未授权 - API密钥无效或缺失。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32001
                  message: Unauthorized
                id: '1'
        '429':
          description: 请求过多 - 超出速率限制。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32005
                  message: 请求过多
                id: '1'
        '500':
          description: 内部服务器错误 - 服务器发生错误。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32603
                  message: 内部错误
                id: '1'
        '503':
          description: 服务不可用 - 服务暂时不可用。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32002
                  message: 服务不可用
                id: '1'
        '504':
          description: 网关超时 - 请求超时。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32003
                  message: 网关超时
                id: '1'
      security:
        - ApiKeyQuery: []
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        jsonrpc:
          type: string
          description: JSON-RPC协议版本。
          enum:
            - '2.0'
          default: '2.0'
        error:
          type: object
          properties:
            code:
              type: integer
              description: 错误代码。
            message:
              type: string
              description: 错误信息。
        id:
          type: string
          description: 请求的唯一标识符。
  securitySchemes:
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api-key
      description: 您的Helius API密钥。您可以在[仪表板](https://dashboard.helius.dev/api-keys)中免费获取一个。

````