---
title: "Gửi phản hồi khảo sát (hoàn thành)"
method: POST
path: "/surveys/{surveyId}/responses"
tags: ["Surveys"]
---

# Gửi phản hồi khảo sát (hoàn thành)

`POST /surveys/{surveyId}/responses`

## Request

- Base URL: `https://api.fireant.vn`
- URL: `https://api.fireant.vn/surveys/{surveyId}/responses`
- Auth: none declared
- TypeScript: <https://skmtc.dev/fireant/apis/fireant-restful-api/docs/surveys/:surveyId/responses/post.ts> (a function with typed inputs; its response is checked against the schema)

Mỗi phần tử trong answers tương ứng một câu hỏi. Tùy loại câu hỏi:
SingleChoice/Dropdown/MultipleChoice: optionIds (+ otherText nếu chọn "Khác");
Text: text; Rating/Number/Slider: number; YesNo: boolValue; Date: date; DateRange: date + dateTo;
Matrix: matrix[] (rowOptionId + columnOptionId hoặc number); Ranking: rankedOptionIds;
FileUpload: fileUrls (từ endpoint files); Symbol: symbols.
Câu trả lời của câu hỏi bị ẩn bởi điều kiện rẽ nhánh sẽ bị bỏ qua. Bản nháp đang có (nếu có) được chuyển thành hoàn thành.

## Path parameters

- `surveyId` integer, required

## Request body

- FireAntApiModelsSurveysSurveyResponseRequest: Yêu cầu gửi phản hồi khảo sát
  - `anonymousId` string: Định danh khách ẩn danh (device id) - dùng khi khảo sát cho phép ẩn danh và chưa đăng nhập
  - `platform` string: Nền tảng: ios | android | web
  - `appVersion` string: Phiên bản ứng dụng
  - `durationSeconds` integer: Thời gian hoàn thành (giây)
  - `metadata` string: Dữ liệu bổ sung dạng JSON (tùy chọn)
  - `currentQuestionId` integer: Bản nháp: câu người dùng đang làm (để vẽ phễu rơi rớt)
  - `answers` FireAntApiModelsSurveysSurveyAnswerRequest[], required: Danh sách câu trả lời (câu hỏi bị ẩn bởi điều kiện rẽ nhánh sẽ bị bỏ qua)
    - `questionId` integer: ID câu hỏi
    - `optionIds` integer[]: Các lựa chọn được chọn
    - `otherText` string: Text nhập kèm khi chọn lựa chọn "Khác"
    - `text` string: Câu trả lời tự luận
    - `number` number, double: Giá trị số (Rating/Number/Slider)
    - `boolValue` boolean: Giá trị Có/Không
    - `date` string, date-time: Giá trị ngày (Date) hoặc ngày bắt đầu (DateRange)
    - `dateTo` string, date-time: DateRange: ngày kết thúc
    - `matrix` FireAntApiModelsSurveysSurveyMatrixCellRequest[]: Matrix: mỗi phần tử là một dòng đã trả lời
      - `rowOptionId` integer: optionId của dòng (optionGroup = Choice)
      - `columnOptionId` integer: optionId của cột (optionGroup = MatrixColumn) - dùng khi ma trận có cột rời
      - `number` number, double: Điểm trong minValue..maxValue - dùng khi ma trận là thang điểm
    - `rankedOptionIds` integer[]: Ranking: các optionId theo thứ tự ưu tiên (phần tử đầu = hạng 1)
    - `fileUrls` string[]: FileUpload: URL các tệp đã upload qua endpoint /surveys/{id}/files
    - `symbols` string[]: Symbol: các mã cổ phiếu (VD: ["VNM","FPT"])
    - `numberTo` number, double: Slider chọn khoảng: đầu cuối (number là đầu đầu)
    - `points` FireAntApiModelsSurveysSurveyPointRequest[]: Hotspot: các điểm chạm (tọa độ theo tỷ lệ ảnh 0..1)
      - `x` number, double: Tỷ lệ theo bề rộng (0 = mép trái, 1 = mép phải)
      - `y` number, double: Tỷ lệ theo chiều cao (0 = mép trên, 1 = mép dưới)
    - `blanks` FireAntApiModelsSurveysSurveyBlankAnswerRequest[]: FillInBlank: câu trả lời từng ô trống
      - `optionId` integer: optionId của ô trống (optionGroup = Blank)
      - `text` string: Ô dạng chữ / mã CK
      - `number` number, double: Ô dạng số
      - `choiceOptionId` integer: Ô dạng chọn: optionId của lựa chọn (optionGroup = BlankChoice, cha là ô trống)

## Response `201`

Ghi nhận thành công

- FireAntApiModelsSurveysSurveySubmitResult: Kết quả sau khi gửi phản hồi khảo sát
  - `responseId` integer: ID phản hồi vừa tạo
  - `surveyId` integer: ID khảo sát
  - `submittedDate` string, date-time: Thời điểm ghi nhận
  - `thankYouMessage` string: Lời cảm ơn cấu hình trên khảo sát
  - `showResults` boolean: Khảo sát cho phép xem kết quả tổng hợp
  - `outcome` FireAntApiModelsSurveysSurveyOutcome: Hành động được chọn cho một phản hồi cụ thể (đã thay placeholder). Client hiển thị nút; người dùng bấm mới chuyển.
    - `ruleId` integer: ID quy tắc đã khớp
    - `title` string: Tiêu đề (tùy chọn)
    - `description` string: Mô tả (tùy chọn)
    - `buttonLabel` string: Nhãn nút
    - `actionType` 1 | 2 | 3 | 4: Loại hành động (1 = Url, 2 = AppRoute, 3 = Survey, 4 = Symbol)
    - `actionValue` string: Giá trị đã thay placeholder: URL / JSON route / SurveyId / mã CK
    - `openInNewTab` boolean: Mở tab mới (Url trên web)

## Other responses

- `400`: Dữ liệu không hợp lệ / khảo sát không nhận phản hồi
- `401`: Khảo sát yêu cầu đăng nhập
- `403`: Không thuộc đối tượng khảo sát
- `404`: Khảo sát không tồn tại
- `409`: Đã trả lời khảo sát này

## Changes

- **2026-09-25** `a481789cd81c`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/fireant/apis/fireant-restful-api/changes/surveys/:surveyId/responses/post.md)

---

[API](https://skmtc.dev/fireant/apis/fireant-restful-api.md) - [All operations](https://skmtc.dev/fireant/apis/fireant-restful-api/llms.txt) - [OpenAPI document](https://skmtc.dev/fireant/apis/fireant-restful-api/revisions/c9b3aa855f95?raw)
