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

# 查询子账户列表

> 返回账户的子账户。

**所需权限：** `SUBACCOUNT:READ` 或 `FULL_ACCESS`

> [!NOTE]
>
> 返回主账户的子账户，每个子账户都带有 `reference`，即您在 `X-Sub-Account` 请求头中用来对其进行操作的值。关于该请求头的行为和完整的错误表，参见[子账户](https://docs.brazilpix.com/cn.md#子账户)。


## OpenAPI

````yaml openapi.cn.json GET /sub-accounts
openapi: 3.0.0
info:
  title: Brazil Pix API
  description: Brazil Pix Payment API documentation
  version: '1.0'
  contact: {}
servers:
  - url: https://api.brazilpix.com/v2
security: []
paths:
  /sub-accounts:
    get:
      tags:
        - External API - Sub-accounts (Subcontas)
      summary: 查询子账户列表
      description: |-
        返回账户的子账户。

        **所需权限：** `SUBACCOUNT:READ` 或 `FULL_ACCESS`
      operationId: ExternalSubAccountsController_getAllSubAccounts
      responses:
        '200':
          description: 子账户列表
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetAllSubAccountsOutput'
        '401':
          description: Unauthorized - Authentication required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedErrorResponse'
        '403':
          description: Forbidden - Permission denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    GetAllSubAccountsOutput:
      type: object
      properties:
        data:
          description: 账户的子账户列表
          type: array
          items:
            $ref: '#/components/schemas/CreateSubAccountOutput'
      required:
        - data
    UnauthorizedErrorResponse:
      type: object
      properties:
        statusCode:
          type: number
          example: 401
        error:
          type: string
          example: Unauthorized
        message:
          type: string
          example: Authentication token is required
        details:
          type: object
        timestamp:
          type: string
          example: '2025-12-15T22:00:00.000Z'
        traceId:
          type: string
      required:
        - statusCode
        - error
        - message
        - timestamp
    ForbiddenErrorResponse:
      type: object
      properties:
        statusCode:
          type: number
          example: 403
        error:
          type: string
          example: Forbidden
        message:
          type: string
          example: You do not have permission to access this resource
        details:
          type: object
        timestamp:
          type: string
          example: '2025-12-15T22:00:00.000Z'
        traceId:
          type: string
      required:
        - statusCode
        - error
        - message
        - timestamp
    InternalServerErrorResponse:
      type: object
      properties:
        statusCode:
          type: number
          example: 500
        error:
          type: string
          example: InternalError
        message:
          type: string
          example: An unexpected error occurred
        details:
          type: object
        timestamp:
          type: string
          example: '2025-12-15T22:00:00.000Z'
        traceId:
          type: string
          example: 2771463d58840c8e116dc6dda1e1e5d0
      required:
        - statusCode
        - error
        - message
        - timestamp
    CreateSubAccountOutput:
      type: object
      properties:
        id:
          type: string
          description: 子账户 ID
          format: uuid
        reference:
          type: string
          description: 子账户的 reference
          example: loja-centro
        name:
          type: string
          description: 子账户名称
          example: Loja Centro
        status:
          type: string
          description: 子账户状态
          example: approved
        createdAt:
          type: string
          description: 创建时间
          format: date-time
      required:
        - id
        - reference
        - name
        - status
        - createdAt
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 通过 POST /auth（client_id + client_secret）获取的访问令牌。有效期 300 秒。

````

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