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

# Gửi thao tác cư dân

> Gửi thông tin liên kết căn hộ hoặc tạo yêu cầu theo quyền cư dân.

`request_access` đặt liên kết về `pending`, không tự duyệt. `create_request` có nhánh `feedback` và `service` ở backend; giao diện hiện chỉ gửi ý kiến. Các trường dịch vụ phụ thuộc loại yêu cầu; schema `values` không thay thế validation nghiệp vụ đó.

Không có khóa chống lặp cho tạo ý kiến trong luồng này. Xem [Duyệt truy cập Mini App](https://docs.taho.com.vn/operations/resident-miniapp.md).


## OpenAPI

````yaml openapi.json POST /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:
    post:
      tags:
        - Mini App
      summary: Gửi liên kết hoặc yêu cầu cư dân
      description: >-
        request_access upsert liên kết pending. create_request yêu cầu quyền căn
        approved, tạo bản ghi trực tiếp; không có khóa idempotency. Giao diện
        Mini App hiện chỉ gửi feedback.
      operationId: submitResidentAction
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  properties:
                    intent:
                      type: string
                      enum:
                        - request_access
                    towerId:
                      type: string
                    apartmentCode:
                      type: string
                      description: Mã căn active trong tòa nhà.
                    relationshipCode:
                      type: string
                      enum:
                        - owner
                        - co_owner
                        - tenant
                        - spouse
                        - child
                        - parent
                        - sibling
                        - former_owner
                        - authorized
                        - other
                  required:
                    - intent
                    - towerId
                    - apartmentCode
                    - relationshipCode
                  additionalProperties: true
                - type: object
                  properties:
                    intent:
                      type: string
                      enum:
                        - create_request
                    apartmentId:
                      oneOf:
                        - type: integer
                          minimum: 1
                        - type: string
                    requestType:
                      type: string
                      enum:
                        - feedback
                        - service
                    values:
                      type: object
                      properties:
                        title:
                          type: string
                          description: >-
                            Feedback yêu cầu tiêu đề; server trim và giới hạn
                            nội dung.
                        content:
                          type: string
                          description: >-
                            Feedback yêu cầu nội dung. Service cần các trường
                            riêng theo loại yêu cầu.
                      additionalProperties: true
                  required:
                    - intent
                    - apartmentId
                    - requestType
                    - values
                  additionalProperties: true
      responses:
        '201':
          description: Liên kết pending hoặc ID yêu cầu vừa tạo.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  data:
                    oneOf:
                      - type: object
                        properties:
                          status:
                            type: string
                            enum:
                              - pending
                        required:
                          - status
                        additionalProperties: true
                      - type: object
                        properties:
                          id:
                            type: string
                        required:
                          - id
                        additionalProperties: true
                required:
                  - success
                  - data
                additionalProperties: true
        '400':
          description: >-
            invalid-intent, invalid-apartment, invalid-relationship,
            invalid-request hoặc invalid-request-type.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: unauthorized khi phiên không hợp lệ.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: forbidden khi tạo yêu cầu cho căn chưa được duyệt.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: resident-portal-failed; JSON body hỏng cũng đi qua catch lỗi chung.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - ResidentBearer: []
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:
    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.