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

# Đọc portal cư dân

> Đọc trạng thái liên kết hoặc dữ liệu của căn hộ được duyệt.

`apartmentId` không khớp không mặc định gây 403: source chọn liên kết được duyệt đầu tiên. API trả tối đa 24 bảng kê và cộng nợ từ tập này. Xem [Mini App](https://docs.taho.com.vn/mini-app/index.md) và [giới hạn hiện tại](https://docs.taho.com.vn/reference/release-status.md).

Endpoint có `OPTIONS` trả 204; header CORS chỉ được thêm cho origin Zalo được source cho phép.


## OpenAPI

````yaml openapi.json GET /api/resident/portal
openapi: 3.0.3
info:
  title: 'Taho: Mini App và AI'
  version: source-review-2026-10-07
  description: >-
    Đặc tả biên soạn trong docs từ handler và service hiện tại. Không phải
    endpoint Swagger do application phục vụ; không xác nhận kết nối provider
    hoặc UAT.
servers: []
security: []
tags:
  - name: Mini App
  - name: Admin Mini App
  - name: AI
paths:
  /api/resident/portal:
    get:
      tags:
        - Mini App
      summary: Đọc portal cư dân
      description: >-
        Production yêu cầu token cư dân. Ngoài production, request không có
        Authorization có thể dùng định danh preview. ID căn không khớp sẽ chọn
        liên kết approved đầu tiên. API chỉ đọc dữ liệu; tổng nợ được cộng từ
        tập bảng kê giới hạn.
      operationId: readResidentPortal
      parameters:
        - name: apartmentId
          in: query
          required: false
          schema:
            type: string
          description: >-
            ID căn hộ trong liên kết approved; thiếu hoặc không khớp sẽ dùng căn
            được duyệt đầu tiên.
      responses:
        '200':
          description: Trạng thái liên kết hoặc dữ liệu portal đã được duyệt.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    $ref: '#/components/schemas/Portal'
                required:
                  - success
                  - data
                additionalProperties: true
        '401':
          description: unauthorized khi token không hợp lệ hoặc production thiếu token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: resident-portal-failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - ResidentBearer: []
components:
  schemas:
    Portal:
      oneOf:
        - type: object
          properties:
            state:
              type: string
              enum:
                - link
                - pending
                - rejected
            identity:
              $ref: '#/components/schemas/Identity'
            links:
              type: array
              items:
                $ref: '#/components/schemas/Link'
            towers:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                  name:
                    type: string
                additionalProperties: true
          required:
            - state
            - identity
            - links
            - towers
          additionalProperties: true
        - type: object
          properties:
            state:
              type: string
              enum:
                - approved
            identity:
              $ref: '#/components/schemas/Identity'
            links:
              type: array
              items:
                $ref: '#/components/schemas/Link'
            currentAccess:
              $ref: '#/components/schemas/Link'
            resident:
              type: object
              properties:
                id:
                  type: string
                name:
                  type: string
                phone:
                  type: string
              additionalProperties: true
            summary:
              type: object
              properties:
                debt:
                  type: string
                  description: Tổng nợ từ tối đa 24 bảng kê trả về.
                openRequests:
                  type: integer
                unreadNotices:
                  type: integer
                  description: >-
                    Số thông báo trả về; không phải trạng thái đã đọc theo
                    account.
              additionalProperties: true
            notices:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                  title:
                    type: string
                  category:
                    type: string
                  author:
                    type: string
                  createdAt:
                    type: string
                additionalProperties: true
            bills:
              type: array
              items:
                $ref: '#/components/schemas/Bill'
            receipts:
              type: array
              items:
                $ref: '#/components/schemas/Receipt'
            requests:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                  type:
                    type: string
                  title:
                    type: string
                  status:
                    type: string
                  createdAt:
                    type: string
                additionalProperties: true
            handbook:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                  title:
                    type: string
                  category:
                    type: string
                  partner:
                    type: string
                additionalProperties: true
          required:
            - state
            - identity
            - links
            - currentAccess
            - summary
            - bills
            - receipts
            - requests
          additionalProperties: true
    Error:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            details: {}
          required:
            - code
            - message
          additionalProperties: true
      required:
        - success
        - error
      additionalProperties: true
    Identity:
      type: object
      properties:
        zaloUserId:
          type: string
        displayName:
          type: string
        verifiedPhone:
          type: string
          description: Luồng xác minh hiện trả chuỗi rỗng.
      required:
        - zaloUserId
        - displayName
        - verifiedPhone
      additionalProperties: true
    Link:
      type: object
      properties:
        id:
          type: string
        status:
          type: string
          enum:
            - pending
            - approved
            - rejected
            - revoked
        relationshipCode:
          type: string
        rejectionReason:
          type: string
        tower:
          type: object
          properties:
            id:
              type: string
            name:
              type: string
          additionalProperties: true
        apartment:
          type: object
          properties:
            id:
              type: string
            code:
              type: string
            name:
              type: string
          additionalProperties: true
      additionalProperties: true
    Bill:
      type: object
      properties:
        id:
          type: string
        code:
          type: string
        cycle:
          type: string
        amount:
          type: string
          description: Số tiền được serialize thành chuỗi.
        paid:
          type: string
        debt:
          type: string
        status:
          type: string
        dueDate:
          type: string
        lines:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              serviceName:
                type: string
              amount:
                type: string
              paid:
                type: string
              debt:
                type: string
            additionalProperties: true
      additionalProperties: true
    Receipt:
      type: object
      properties:
        id:
          type: string
        code:
          type: string
        amount:
          type: string
        method:
          type: string
        status:
          type: string
        accountingDate:
          type: string
        description:
          type: string
      additionalProperties: true
  securitySchemes:
    ResidentBearer:
      type: http
      scheme: bearer
      description: >-
        Token phiên cư dân Taho sau khi xác minh Zalo; không phải Zalo access
        token.

````

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