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

# getTokenAccountsByDelegate

> Trả về tất cả tài khoản SPL Token theo bên được ủy quyền đã phê duyệt.

## Tham số yêu cầu

<ParamField body="address" type="string" required>
  Địa chỉ Solana (khóa công khai) của bên được ủy quyền quản lý các tài khoản token.
</ParamField>

<ParamField body="mint" type="string">
  Địa chỉ mint token cụ thể để lọc các tài khoản được ủy quyền theo một loại token nhất định.
</ParamField>

<ParamField body="programId" type="string">
  ID chương trình token cụ thể (thường là chương trình SPL Token) để lọc các tài khoản được ủy quyền.
</ParamField>

<ParamField body="commitment" type="string">
  Mức cam kết cho yêu cầu.

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

<ParamField body="minContextSlot" type="number">
  Slot tối thiểu mà tại đó yêu cầu có thể được đánh giá.
</ParamField>

<ParamField body="dataSlice" type="object">
  Yêu cầu một phần dữ liệu của tài khoản.
</ParamField>

<ParamField body="dataSlice.length" type="number">
  Số byte cần trả về.
</ParamField>

<ParamField body="dataSlice.offset" type="number">
  Vị trí lệch theo byte để bắt đầu đọc.
</ParamField>

<ParamField body="encoding" type="string">
  Định dạng mã hóa cho dữ liệu tài khoản.

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


## OpenAPI

````yaml vi/openapi/rpc-http/getTokenAccountsByDelegate.yaml POST /
openapi: 3.1.0
info:
  title: Solana RPC API
  version: 1.0.0
  description: >-
    API Solana nâng cao để truy vấn các quyền ủy quyền token, cho phép ứng dụng
    truy xuất tất cả tài khoản token SPL đã cấp quyền cụ thể cho địa chỉ của bên
    thứ ba.
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://mainnet.helius-rpc.com
    description: Điểm cuối RPC Mainnet
  - url: https://devnet.helius-rpc.com
    description: Điểm cuối RPC Devnet
security: []
paths:
  /:
    post:
      tags:
        - RPC
      summary: getTokenAccountsByDelegate
      description: >
        Truy xuất tất cả tài khoản token SPL đã ủy quyền cho một địa chỉ Solana
        cụ thể.

        API mạnh mẽ này xác định tất cả tài khoản token đã cấp quyền chi tiêu
        hoặc quản lý

        cho ứng dụng, ví hoặc địa chỉ được ủy quyền khác của bên thứ ba. Đây là
        chức năng thiết yếu

        cho việc giám sát bảo mật, theo dõi ủy quyền và các ứng dụng cần xác
        định những

        tài khoản token mà chúng có quyền quản lý hoặc chi tiêu. Hỗ trợ lọc theo
        các

        loại token và cấp độ ủy quyền cụ thể, đồng thời cung cấp dữ liệu đã phân
        tích cú pháp để dễ dàng tích hợp.
      operationId: getTokenAccountsByDelegate
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                jsonrpc:
                  type: string
                  enum:
                    - '2.0'
                  description: Phiên bản giao thức JSON-RPC.
                  example: '2.0'
                  default: '2.0'
                id:
                  type: string
                  description: Mã định danh duy nhất cho yêu cầu.
                  example: '1'
                  default: '1'
                method:
                  type: string
                  enum:
                    - getTokenAccountsByDelegate
                  description: Tên của phương thức RPC cần gọi.
                  example: getTokenAccountsByDelegate
                  default: getTokenAccountsByDelegate
                params:
                  type: array
                  description: >-
                    Các tham số để truy vấn tài khoản token theo địa chỉ được ủy
                    quyền.
                  default:
                    - 4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T
                    - programId: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                    - encoding: jsonParsed
                  items:
                    oneOf:
                      - type: string
                        description: >-
                          Địa chỉ Solana (khóa công khai) của bên được ủy quyền
                          quản lý tài khoản token.
                        example: 4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T
                      - type: object
                        description: >-
                          Cấu hình bộ lọc để thu hẹp kết quả theo loại token
                          hoặc chương trình cụ thể.
                        properties:
                          mint:
                            type: string
                            description: >-
                              Địa chỉ mint token cụ thể để lọc các tài khoản
                              được ủy quyền theo một loại token nhất định.
                            example: 3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E
                          programId:
                            type: string
                            description: >-
                              ID chương trình token cụ thể (thường là chương
                              trình SPL Token) để lọc các tài khoản được ủy
                              quyền.
                            example: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                      - type: object
                        description: Đối tượng cấu hình.
                        properties:
                          commitment:
                            type: string
                            description: Mức độ cam kết cho yêu cầu.
                            enum:
                              - confirmed
                              - finalized
                              - processed
                            example: finalized
                          minContextSlot:
                            type: integer
                            description: >-
                              Slot tối thiểu mà tại đó yêu cầu có thể được đánh
                              giá.
                            example: 1000
                          dataSlice:
                            type: object
                            description: Yêu cầu một phần dữ liệu của tài khoản.
                            properties:
                              length:
                                type: integer
                                description: Số byte cần trả về.
                                example: 10
                              offset:
                                type: integer
                                description: Độ lệch byte để bắt đầu đọc.
                                example: 0
                          encoding:
                            type: string
                            description: Định dạng mã hóa cho dữ liệu Account.
                            enum:
                              - base58
                              - base64
                              - base64+zstd
                              - jsonParsed
                            example: jsonParsed
      responses:
        '200':
          description: >-
            Đã truy xuất thành công các tài khoản token theo địa chỉ được ủy
            quyền.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                    description: Phiên bản giao thức JSON-RPC.
                    enum:
                      - '2.0'
                    example: '2.0'
                  id:
                    type: string
                    description: Mã định danh khớp với yêu cầu.
                    example: '1'
                  result:
                    type: object
                    description: Ngữ cảnh và thông tin chi tiết về tài khoản.
                    properties:
                      context:
                        type: object
                        description: Ngữ cảnh của phản hồi.
                        properties:
                          slot:
                            type: integer
                            description: Slot nơi dữ liệu được truy xuất.
                            example: 1114
                      value:
                        type: array
                        description: Danh sách tài khoản token.
                        items:
                          type: object
                          properties:
                            pubkey:
                              type: string
                              description: >-
                                Pubkey của tài khoản dưới dạng chuỗi được mã hóa
                                base-58.
                              example: 28YTZEwqtMHWrhWcvv34se7pjS7wctgqzCPB3gReCFKp
                            account:
                              type: object
                              description: Thông tin chi tiết về tài khoản token.
                              properties:
                                lamports:
                                  type: integer
                                  description: Số lamport được gán cho tài khoản.
                                  example: 1726080
                                owner:
                                  type: string
                                  description: >-
                                    Pubkey của chương trình được gán cho tài
                                    khoản này.
                                  example: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                                data:
                                  type: object
                                  description: >-
                                    Dữ liệu trạng thái token liên kết với tài
                                    khoản.
                                  properties:
                                    program:
                                      type: string
                                      description: Tên chương trình.
                                      example: spl-token
                                    parsed:
                                      type: object
                                      description: Dữ liệu token đã phân tích cú pháp.
                                      properties:
                                        info:
                                          type: object
                                          description: Thông tin tài khoản token.
                                          properties:
                                            tokenAmount:
                                              type: object
                                              description: Thông tin chi tiết về số lượng token.
                                              properties:
                                                amount:
                                                  type: string
                                                  description: Số dư thô không tính phần thập phân.
                                                  example: '1'
                                                decimals:
                                                  type: integer
                                                  description: Số chữ số thập phân.
                                                  example: 1
                                                uiAmount:
                                                  type: number
                                                  description: >-
                                                    Số dư ở định dạng thân thiện với người
                                                    dùng.
                                                  example: 0.1
                                                uiAmountString:
                                                  type: string
                                                  description: Số dư dưới dạng chuỗi.
                                                  example: '0.1'
                                            delegate:
                                              type: string
                                              description: >-
                                                Địa chỉ Solana đã được cấp quyền ủy
                                                quyền để chi tiêu hoặc quản lý token.
                                              example: >-
                                                4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T
                                            delegatedAmount:
                                              type: object
                                              description: >-
                                                Số lượng token mà bên được ủy quyền được
                                                phép chi tiêu thay mặt chủ sở hữu.
                                              properties:
                                                amount:
                                                  type: string
                                                  description: Số dư thô không tính phần thập phân.
                                                  example: '1'
                                                decimals:
                                                  type: integer
                                                  description: Số chữ số thập phân.
                                                  example: 1
                                                uiAmount:
                                                  type: number
                                                  description: >-
                                                    Số dư ở định dạng thân thiện với người
                                                    dùng.
                                                  example: 0.1
                                                uiAmountString:
                                                  type: string
                                                  description: Số dư dưới dạng chuỗi.
                                                  example: '0.1'
                                        state:
                                          type: string
                                          description: Trạng thái tài khoản token.
                                          example: initialized
                                        isNative:
                                          type: boolean
                                          description: >-
                                            Cho biết tài khoản có nắm giữ SOL gốc
                                            hay không.
                                          example: false
                                        mint:
                                          type: string
                                          description: Pubkey của mint token.
                                          example: >-
                                            3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E
                                        owner:
                                          type: string
                                          description: Pubkey của chủ sở hữu tài khoản.
                                          example: >-
                                            CnPoSPKXu7wJqxe59Fs72tkBeALovhsCxYeFwPCQH9TD
                                    space:
                                      type: integer
                                      description: Dung lượng được cấp phát cho tài khoản.
                                      example: 165
                                executable:
                                  type: boolean
                                  description: >-
                                    Cho biết tài khoản có chứa chương trình hay
                                    không.
                                  example: false
                                rentEpoch:
                                  type: integer
                                  description: >-
                                    Epoch mà tại đó tài khoản sẽ phải trả phí
                                    thuê tiếp theo.
                                  example: 4
                                space:
                                  type: integer
                                  description: Kích thước dữ liệu của tài khoản.
                                  example: 165
              examples:
                response:
                  value:
                    jsonrpc: '2.0'
                    id: '1'
                    result:
                      context:
                        slot: 1114
                      value:
                        - pubkey: 28YTZEwqtMHWrhWcvv34se7pjS7wctgqzCPB3gReCFKp
                          account:
                            lamports: 1726080
                            owner: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
                            data:
                              program: spl-token
                              parsed:
                                info:
                                  tokenAmount:
                                    amount: '1'
                                    decimals: 1
                                    uiAmount: 0.1
                                    uiAmountString: '0.1'
                                  delegate: 4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T
                                  delegatedAmount:
                                    amount: '1'
                                    decimals: 1
                                    uiAmount: 0.1
                                    uiAmountString: '0.1'
                                  state: initialized
                                  isNative: false
                                  mint: 3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E
                                  owner: CnPoSPKXu7wJqxe59Fs72tkBeALovhsCxYeFwPCQH9TD
                                type: account
                              space: 165
                            executable: false
                            rentEpoch: 4
                            space: 165
        '400':
          description: >-
            Yêu cầu không hợp lệ - Tham số yêu cầu không hợp lệ hoặc yêu cầu có
            định dạng sai.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32602
                  message: Invalid params
                id: '1'
        '401':
          description: Không được phép - Khóa API không hợp lệ hoặc bị thiếu.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32001
                  message: Unauthorized
                id: '1'
        '429':
          description: Quá nhiều yêu cầu - Đã vượt quá giới hạn tốc độ.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32005
                  message: Too many requests
                id: '1'
        '500':
          description: Lỗi máy chủ nội bộ - Đã xảy ra lỗi trên máy chủ.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32603
                  message: Internal error
                id: '1'
        '503':
          description: Dịch vụ không khả dụng - Dịch vụ tạm thời không khả dụng.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32002
                  message: Service unavailable
                id: '1'
        '504':
          description: Hết thời gian chờ cổng kết nối - Yêu cầu đã hết thời gian chờ.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                jsonrpc: '2.0'
                error:
                  code: -32003
                  message: Gateway timeout
                id: '1'
      security:
        - ApiKeyQuery: []
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        jsonrpc:
          type: string
          description: Phiên bản giao thức JSON-RPC.
          enum:
            - '2.0'
          example: '2.0'
        error:
          type: object
          properties:
            code:
              type: integer
              description: Mã lỗi.
              example: -32602
            message:
              type: string
              description: Thông báo lỗi.
            data:
              type: object
              description: Dữ liệu bổ sung về lỗi.
        id:
          type: string
          description: Mã định danh khớp với yêu cầu.
          example: '1'
  securitySchemes:
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api-key
      description: >-
        Khóa API Helius của bạn. Bạn có thể nhận khóa miễn phí trong [bảng điều
        khiển](https://dashboard.helius.dev/api-keys).

````