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

# Duyệt quyền căn hộ

> BQL duyệt, từ chối hoặc thu hồi một liên kết căn hộ trong tòa nhà đang chọn.

Trường `reason` phải có nội dung khi `decision` là `reject`. Duyệt chỉ cập nhật liên kết và audit, không tạo hồ sơ cư dân hoặc membership. Xem [hướng dẫn thao tác](https://docs.taho.com.vn/operations/resident-miniapp.md).


## OpenAPI

````yaml openapi.json POST /admin/resident-miniapp/action
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:
  /admin/resident-miniapp/action:
    post:
      tags:
        - Admin Mini App
      summary: Duyệt, từ chối hoặc thu hồi quyền căn hộ
      description: >-
        Cần phiên admin, route /admin/resident-miniapp, tòa nhà và same-origin.
        Chỉ duyệt/từ chối pending hoặc thu hồi approved. Cập nhật liên kết và
        audit cùng transaction; không tạo cư dân/membership.
      operationId: reviewResidentAccess
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  oneOf:
                    - type: integer
                      minimum: 1
                    - type: string
                decision:
                  type: string
                  enum:
                    - approve
                    - reject
                    - revoke
                reason:
                  type: string
                  description: >-
                    Bắt buộc có nội dung khi reject; server trim và lấy tối đa
                    300 ký tự.
              required:
                - id
                - decision
              additionalProperties: true
      responses:
        '200':
          description: ID và trạng thái liên kết sau cập nhật.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                      status:
                        type: string
                        enum:
                          - approved
                          - rejected
                          - revoked
                    required:
                      - id
                      - status
                    additionalProperties: true
                required:
                  - success
                  - data
                additionalProperties: true
        '400':
          description: invalid-review, reason-required hoặc invalid-state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            forbidden-origin hoặc forbidden; handler cũng dùng forbidden khi
            thiếu phiên.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: link-not-found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: review-failed; JSON body hỏng đi qua catch lỗi chung.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - AdminBearer: []
        - AdminCookie: []
components:
  schemas:
    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
  securitySchemes:
    AdminBearer:
      type: http
      scheme: bearer
      description: Token phiên quản trị, vẫn phải qua route/action và active tower checks.
    AdminCookie:
      type: apiKey
      in: cookie
      name: taho_jwt

````

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