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

# 列出银行账户 API：连接中的账户

> Didit 的列出账户端点可返回用户在某个连接中共享的全部账户，包括个人账户和企业账户。

Didit 的账户列表 endpoint（List Accounts）会返回用户在某个连接中共享的全部账户，包括个人账户和企业账户。
只要连接仍然存在，账户 ID 就保持不变，包括续期后。


## OpenAPI

````yaml zh/openapi-25.json GET /v3/bank/connections/{id}/accounts/
openapi: 3.0.0
info:
  version: 3.0.0
  title: Didit Verification API
  description: 身份验证 API。使用 x-api-key 请求头进行身份验证。
servers:
  - url: https://verification.didit.me
security: []
tags:
  - name: Bank Data
    description: >-
      银行数据服务涵盖银行链接、连接、账户、余额、交易、机构和覆盖范围。银行数据可用于沙盒应用。在宣布开放生产访问之前，生产应用的调用将返回
      `404`。沙盒环境不收费。使用 API
      密钥进行的调用，需要具备银行数据权限（`bank-data`）的密钥：读取操作需要读取权限，会更改数据的操作需要写入权限。账户核验是例外，它需要会话的写入权限或完全访问权限，而不需要银行数据权限。银行数据不属于完全访问权限的一部分：完全访问密钥会被拒绝，调用返回
      `403
      bank_data_access_denied`，直到您创建具备该权限的密钥为止。原始银行数据（账户、余额、交易以及变更流）同样会拒绝不携带 API
      密钥的请求。


      除账户核验外，`/v3/bank/` 下的每个拒绝响应都具有相同的 JSON
      结构（`code`、`message`、`request_id`、`field`、`next_action`、`retry_after`）。不是操作的路径、不是
      UUID 的 ID 或未知的子资源，对于所有方法都返回 `404 not_found`；任何意外错误都返回 `500 internal_error`
      及 `request_id`。在银行数据不可用时，每个操作都返回平台标准的 `404`，与访问未知路由时完全相同。
paths:
  /v3/bank/connections/{id}/accounts/:
    get:
      tags:
        - Bank Data
      summary: 列出连接的账户
      description: >-
        列出连接下的所有账户，按从旧到新排序，包含完整标识符和账户持有人。读取操作不计费。


        需要具备银行数据权限（`bank-data`）的 API
        密钥：此操作为读取权限。拥有完全访问权限的密钥不包含该权限：创建密钥时须单独授予，否则调用返回 `403
        bank_data_access_denied`。沙盒应用仅凭密钥即可读取其测试银行数据。不带 API
        密钥（使用客户端凭证）的请求在读取原始数据时同样会被拒绝，返回相同的 `403`。
      operationId: listBankAccounts
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: 连接 ID。
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            default: 100
            minimum: 1
            maximum: 500
          description: 每页条数，1 至 500。默认 100。
        - name: cursor
          in: query
          required: false
          schema:
            type: string
          description: 不透明游标，取自上一页的 `next_cursor`。
      responses:
        '200':
          description: 账户列表的一页。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BankAccountList'
              examples:
                Page:
                  summary: 两个企业账户
                  value:
                    items:
                      - id: a71f0c2e-5d38-4b96-a1c4-3e9f8d2b7a10
                        connection_id: 5e1d2a70-3b94-4c1f-8a6e-d2f07b9c1e35
                        name: Cuenta negocio
                        product: Cuenta corriente empresas
                        type: current
                        usage: business
                        currency: EUR
                        holder_name: EMPRESA DE EJEMPLO SL
                        holders:
                          - name: EMPRESA DE EJEMPLO SL
                            role: holder
                        identifiers:
                          iban: ES0000000000000000001332
                          bic: XXXXESBBXXX
                          account_number: null
                          sort_code: null
                          other: []
                        account_ref: ar_f3c1a85e9d27b640c8e1
                        account_ref_previous: null
                        status: open
                        scopes_granted:
                          - accounts
                          - balances
                          - transactions
                        sync:
                          last_synced_at: '2026-11-21T12:04:40Z'
                          status: ok
                          history_requested_from: '2025-11-21'
                          history_available_from: '2026-01-02'
                          pending_supported: true
                        history_coverage:
                          requested_from: '2025-11-21'
                          oldest_booking_date: '2026-01-02'
                          covered_ranges:
                            - from: '2026-01-02'
                              to: '2026-11-21'
                          missing_ranges:
                            - from: '2025-11-21'
                              to: '2026-01-01'
                          status: partial
                          extended_auth_used: false
                    next_cursor: null
        '400':
          description: 参数无效。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BankDataError'
              examples:
                Invalid cursor:
                  summary: 游标无效
                  value:
                    code: invalid_cursor
                    message: The cursor or page token is not valid.
                    request_id: 3f6a1c8e-92b5-4d07-a1e3-8c4b7f0d2e59
                    field: cursor
                    next_action: null
                    retry_after: null
                Invalid request:
                  summary: 请求无效
                  value:
                    code: invalid_request
                    message: The request is not valid.
                    request_id: 3f6a1c8e-92b5-4d07-a1e3-8c4b7f0d2e59
                    field: limit
                    next_action: null
                    retry_after: null
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/BankDataAccessDenied'
        '404':
          description: 该资源在此应用和环境中不存在。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BankDataError'
              examples:
                Not found:
                  summary: 未找到
                  value:
                    code: not_found
                    message: The resource does not exist.
                    request_id: 3f6a1c8e-92b5-4d07-a1e3-8c4b7f0d2e59
                    field: null
                    next_action: null
                    retry_after: null
        '409':
          description: 连接没有可读取的数据：已被删除，或保留期已结束（`connection_not_active`）。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BankDataError'
              examples:
                Not active:
                  summary: 未激活
                  value:
                    code: connection_not_active
                    message: This connection is not active.
                    request_id: 3f6a1c8e-92b5-4d07-a1e3-8c4b7f0d2e59
                    field: null
                    next_action: create_link
                    retry_after: null
        '429':
          $ref: '#/components/responses/RateLimitedRead'
        '500':
          $ref: '#/components/responses/BankDataInternalError'
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: curl
          source: >-
            curl
            'https://verification.didit.me/v3/bank/connections/5e1d2a70-3b94-4c1f-8a6e-d2f07b9c1e35/accounts/'
            \
              -H 'x-api-key: YOUR_API_KEY'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.bank.list_accounts(
                "11111111-2222-3333-4444-555555555555",
            )
            print(result)
        - lang: javascript
          label: Node.js
          source: >-
            import Didit from "@didit-protocol/sdk-node";


            // Reads DIDIT_API_KEY.

            const didit = new Didit();


            const result = await
            didit.bank.listAccounts("11111111-2222-3333-4444-555555555555");

            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.Bank.ListAccounts(ctx, \"11111111-2222-3333-4444-555555555555\", didit.BankListAccountsParams{})\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"%+v\\n\", result)"
        - lang: java
          label: Java
          source: >-
            import me.didit.Didit;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            var result =
            client.bank().listAccounts("11111111-2222-3333-4444-555555555555");

            System.out.println(result);
        - lang: php
          label: PHP
          source: >-
            <?php


            require 'vendor/autoload.php';


            use Didit\DiditClient;


            // Reads DIDIT_API_KEY.

            $didit = new DiditClient();


            $result =
            $didit->bank->listAccounts('11111111-2222-3333-4444-555555555555');

            print_r($result->toArray());
        - lang: ruby
          label: Ruby
          source: >-
            require "didit"


            # Reads DIDIT_API_KEY.

            didit = Didit::Client.new


            result =
            didit.bank.list_accounts("11111111-2222-3333-4444-555555555555")

            puts result.to_h
        - lang: csharp
          label: .NET
          source: >-
            using System;

            using System.Text.Json;

            using Didit;


            // Reads DIDIT_API_KEY.

            using var client = new DiditClient();


            var result = await
            client.Bank.ListAccountsAsync("11111111-2222-3333-4444-555555555555");

            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  schemas:
    BankAccountList:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/BankAccount'
        next_cursor:
          type: string
          nullable: true
      required:
        - items
        - next_cursor
    BankDataError:
      type: object
      description: 所有银行数据操作的错误响应体。每个字段始终存在。
      properties:
        code:
          type: string
          enum:
            - ongoing_access_not_available
            - segment_not_available
            - window_not_available
            - history_window_ambiguous
            - redirect_url_not_registered
            - link_origin_not_allowed
            - bank_data_access_denied
            - connection_not_active
            - consent_expired
            - renewal_not_needed
            - renewal_window_expired
            - access_removed
            - refresh_limit_reached
            - cursor_expired
            - page_expired
            - invalid_cursor
            - page_token_mismatch
            - contract_rate_missing
            - insufficient_credits
            - invalid_request
            - not_found
            - internal_error
          description: 机器可读的错误代码。请据此分支处理，切勿依据 `message`。
        message:
          type: string
          description: 面向开发者的通俗说明。措辞可能变化，请勿解析。
        request_id:
          type: string
          description: 本次请求的标识符。联系支持团队时请提供此标识符。
        field:
          type: string
          description: 需要更正的请求字段（如果错误与某个字段有关）。否则为 `null`。
          nullable: true
        next_action:
          type: string
          enum:
            - retry_later
            - renew_connection
            - create_link
            - restart_from_cursor
            - restart_read
            - top_up_balance
            - enable_bank_data_access
            - contact_support
            - null
          description: 下一步应执行的操作，便于客户端无需猜测即可执行。没有标准的下一步时为 `null`。
          nullable: true
        retry_after:
          type: integer
          description: 重试前需等待的秒数。仅在触发速率限制和出现临时错误时设置，否则为 `null`。
          nullable: true
      required:
        - code
        - message
        - request_id
        - field
        - next_action
        - retry_after
      example:
        code: ongoing_access_not_available
        message: >-
          This bank cannot keep access open. Use access one_time or choose
          another bank.
        request_id: 3f6a1c8e-92b5-4d07-a1e3-8c4b7f0d2e59
        field: institution_id
        next_action: create_link
        retry_after: null
    BankAccount:
      type: object
      description: 连接中的一个账户。
      properties:
        id:
          type: string
          description: 账户 ID。归属于该连接，只要连接存在便永不变更，续期后也不变。
          format: uuid
        connection_id:
          type: string
          format: uuid
        name:
          type: string
          nullable: true
        product:
          type: string
          description: 银行的产品名称。
          nullable: true
        type:
          type: string
          enum:
            - current
            - savings
            - card
            - loan
            - investment
            - other
        usage:
          type: string
          enum:
            - personal
            - business
            - unknown
        currency:
          type: string
          pattern: ^[A-Z]{3}$
          description: ISO 4217 货币代码。
        holder_name:
          type: string
          description: 银行提供时的账户持有人姓名。
          nullable: true
        holders:
          type: array
          items:
            $ref: '#/components/schemas/BankAccountHolder'
          description: 银行提供的持有人信息。所有权仅统计 `holder` 和 `joint_holder`。
        identifiers:
          $ref: '#/components/schemas/BankAccountIdentifiers'
        account_ref:
          type: string
          description: >-
            用于在同一应用和环境的不同连接之间识别同一银行账户：是对银行自身标识符计算的带密钥哈希值。银行未提供可靠标识符时为
            `null`。可用于识别您已知的银行账户。
          nullable: true
        account_ref_previous:
          type: string
          description: 之前的 `account_ref`，仅适用于已验证的别名，例如银行迁移的情况。
          nullable: true
        status:
          type: string
          enum:
            - open
            - closed
            - access_removed
          description: '`access_removed`：用户从同意中移除了该账户。该账户不再同步。'
        scopes_granted:
          type: array
          items:
            type: string
            enum:
              - accounts
              - balances
              - transactions
        sync:
          $ref: '#/components/schemas/BankAccountSync'
        history_coverage:
          $ref: '#/components/schemas/BankHistoryCoverage'
      required:
        - id
        - connection_id
        - name
        - product
        - type
        - usage
        - currency
        - holder_name
        - holders
        - identifiers
        - account_ref
        - account_ref_previous
        - status
        - scopes_granted
        - sync
        - history_coverage
    RateLimitBudgetError:
      type: object
      description: 仅在速率限制中间件预算拒绝时返回。其他 429 错误（包括幂等性冲突和端点特定上限）不保证返回这些元数据字段。
      required:
        - detail
        - reference
        - limit
        - remaining
        - reset
        - window_seconds
      properties:
        detail:
          type: string
          description: 已有的可读预算拒绝信息。
        reference:
          type: string
          pattern: ^RL-[0-9a-f]{32}$
          description: 不透明的支持参考编号：RL- 后跟 32 个小写 UUID 十六进制字符。
        limit:
          type: integer
          description: 超出限额的作用域对应的预算；与 X-RateLimit-Limit 相同。
        remaining:
          type: integer
          minimum: 0
          description: 剩余额度，下限为零；与 X-RateLimit-Remaining 相同。
        reset:
          type: integer
          format: int64
          description: 窗口重置时间，以 Unix 秒表示；与 X-RateLimit-Reset 相同。
        window_seconds:
          type: integer
          description: 固定窗口时长（秒），不是剩余等待时间。重试前请遵循 Retry-After。
      example:
        detail: >-
          Write request rate limit exceeded. You can make up to 300 requests per
          minute.
        reference: RL-00000000000040008000000000000001
        limit: 300
        remaining: 0
        reset: 1794358860
        window_seconds: 60
    BankAccountHolder:
      type: object
      properties:
        name:
          type: string
        role:
          type: string
          enum:
            - holder
            - joint_holder
            - representative
            - unknown
      required:
        - name
        - role
    BankAccountIdentifiers:
      type: object
      description: 完整标识符，仅在拥有银行数据权限时返回给服务端调用方。
      properties:
        iban:
          type: string
          description: 完整的 IBAN，大写且不含空格。
          nullable: true
        bic:
          type: string
          nullable: true
        account_number:
          type: string
          description: 本地账号，适用于没有 IBAN 的账户。
          nullable: true
        sort_code:
          type: string
          description: 本地银行代码，适用于没有 IBAN 的账户。
          nullable: true
        other:
          type: array
          items:
            type: object
            properties:
              scheme:
                type: string
              value:
                type: string
            required:
              - scheme
              - value
          description: 银行提供的其他任何标识符。
      required:
        - iban
        - bic
        - account_number
        - sort_code
        - other
    BankAccountSync:
      type: object
      properties:
        last_synced_at:
          type: string
          description: 该账户数据最后一次从银行获取的时间。
          format: date-time
          nullable: true
        status:
          type: string
          enum:
            - pending
            - ok
            - failed
        history_requested_from:
          type: string
          format: date
          nullable: true
        history_available_from:
          type: string
          description: 银行为该账户实际提供的最早入账日期。
          format: date
          nullable: true
        pending_supported:
          type: boolean
          description: 该银行是否返回待处理交易。
      required:
        - last_synced_at
        - status
        - history_requested_from
        - history_available_from
        - pending_supported
    BankHistoryCoverage:
      type: object
      description: 银行实际返回的您所请求的历史数据。
      properties:
        requested_from:
          type: string
          description: 请求的开始日期。
          format: date
          nullable: true
        oldest_booking_date:
          type: string
          description: 银行实际提供的最早入账日期。
          format: date
          nullable: true
        covered_ranges:
          type: array
          items:
            $ref: '#/components/schemas/BankDateRange'
        missing_ranges:
          type: array
          items:
            $ref: '#/components/schemas/BankDateRange'
        status:
          type: string
          enum:
            - complete
            - partial
            - empty
            - unavailable
            - unknown
          description: >-
            `partial`：银行提供的数据少于请求的范围。`empty`：银行确认了整个时间窗口，但其中没有交易。`unavailable`：银行未提供任何历史数据。`unknown`：尚未确定。
        extended_auth_used:
          type: boolean
          description: 当用户提供了部分银行在开放较早历史记录前要求的额外确认时，返回 `true`。
      required:
        - requested_from
        - oldest_booking_date
        - covered_ranges
        - missing_ranges
        - status
        - extended_auth_used
    BankDateRange:
      type: object
      properties:
        from:
          type: string
          format: date
        to:
          type: string
          format: date
      required:
        - from
        - to
  responses:
    Unauthorized:
      description: 未授权
      content:
        application/json:
          examples:
            Invalid API Key:
              summary: API 密钥无效
              value:
                detail: Invalid API Key.
    BankDataAccessDenied:
      description: >-
        API 密钥不具有银行数据权限（`bank-data`），或者，对于生产环境应用中的原始银行数据，应用设置“Bank data in the
        API”已关闭。银行数据不属于完全访问权限：完全访问权限的密钥、仅限其他资源的密钥，以及未使用 API
        密钥认证的请求（客户端凭证，访问原始数据时）均会被以此响应体拒绝，因此请创建密钥并显式授予该权限。此拒绝发生在任何查询之前，因此不能说明对象是否存在。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BankDataError'
          examples:
            Bank data not allowed:
              summary: 不允许访问银行数据
              value:
                code: bank_data_access_denied
                message: >-
                  Bank data calls need an API key that carries the Bank data
                  permission.
                request_id: 3f6a1c8e-92b5-4d07-a1e3-8c4b7f0d2e59
                field: null
                next_action: enable_bank_data_access
                retry_after: null
    RateLimitedRead:
      description: 中间件读取额度已超出。重试前请先遵守 Retry-After。
      headers:
        Retry-After:
          $ref: '#/components/headers/BudgetRetryAfter'
        X-RateLimit-Scope:
          $ref: '#/components/headers/BudgetXRateLimitScope'
        X-RateLimit-Limit:
          $ref: '#/components/headers/BudgetXRateLimitLimit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/BudgetXRateLimitRemaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/BudgetXRateLimitReset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitBudgetError'
          example:
            detail: >-
              GET request rate limit exceeded. You can make up to 600 requests
              per minute.
            reference: RL-00000000000040008000000000000001
            limit: 600
            remaining: 0
            reset: 1794358860
            window_seconds: 60
    BankDataInternalError:
      description: >-
        Didit 端出现了问题。`/v3/bank/` 下的任何意外错误都以银行错误格式返回，绝不返回 HTML 页面：请将 `request_id`
        提供给支持团队。
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BankDataError'
          examples:
            Internal error:
              summary: 意外错误
              value:
                code: internal_error
                message: >-
                  Something went wrong on our side. Quote the request_id to
                  support.
                request_id: 3f6a1c8e92b54d07a1e38c4b7f0d2e59
                field: null
                next_action: contact_support
                retry_after: null
  headers:
    BudgetRetryAfter:
      description: 需等待的秒数，向上取整到下一个时间窗口。出现在中间件预算拒绝响应中。
      schema:
        type: integer
    BudgetXRateLimitScope:
      description: 已超出预算的范围。出现在中间件预算拒绝响应中。
      schema:
        type: string
    BudgetXRateLimitLimit:
      description: 超出限额的作用域的预算；与请求体限制相同。出现在中间件预算拒绝响应中。
      schema:
        type: integer
    BudgetXRateLimitRemaining:
      description: 剩余额度，下限为零；与响应体中的 remaining 相同。仅出现在中间件额度拒绝的响应中。
      schema:
        type: integer
    BudgetXRateLimitReset:
      description: 以 Unix 秒表示的重置时间；与正文中的 reset 相同。出现在中间件预算拒绝响应中。
      schema:
        type: integer
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        您的应用 API 密钥，可在 Business Console 的开发者 -> API
        密钥中获取。主密钥拥有完全访问权限。命名密钥可以设置范围：可按资源设置无权限、只读或读写，可限定为部分工作流或已批准的会话，可限定为一组 IP
        地址，并可设置过期日期。401 表示密钥错误、已被撤销或已过期；403 表示未发送密钥、密钥无权访问该资源或执行该操作，或请求来自其 IP
        列表之外的地址；会话相关路由返回 404，表示该会话不在密钥的工作流或状态范围内。没有媒体访问权限的密钥会将图片、视频和 PDF 的 URL
        返回为 null；没有会话写入权限的密钥会将会话链接和令牌返回为 null。请参阅
        https://docs.didit.me/console/api-keys。

````

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