> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.omicx.one/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.omicx.one/_mcp/server.

# Gửi câu trả lời đánh giá

POST https://api.omicx.one/feedbacks/submit
Content-Type: application/json

**Không cần `X-Api-Key`** — xác thực bằng chính token lấy từ `url` ở [Tạo link đánh giá](/feedbacks/manage/issue-feedback-token). Chỉ được gửi **một lần**, trước khi hết hạn, kiểm tra theo đúng phiên bản bản mẫu của feedback đó. Chỉ đọc `token`, `rating` và `customComponents`.

Reference: https://developers.omicx.one/feedbacks/manage/submit-feedback

## Request

### Body (application/json)

This endpoint expects a FeedbackSubmitRequest.

- `token` (string, required)
- `rating` (FeedbackSubmitRequestRating, required)
- `customComponents` (list of FeedbackSubmitRequestCustomComponentsItems, optional)

## Response

### 200

Đã gửi — `{feedbackId, status: SUBMITTED, expiresAt, submittedAt}`.

- `feedbackId` (string, optional)
- `status` (enum, optional)
  - Allowed values: `SUBMITTED`
- `expiresAt` (long, optional)
- `submittedAt` (long, optional)

## Errors

### 400 Bad Request Error

`FEEDBACK_ANSWER_INVALID` — điểm ngoài thang, nhãn thuộc mức điểm khác, câu hỏi dạng SINGLE mà chọn 2 lựa chọn, thiếu câu trả lời bắt buộc, văn bản vượt giới hạn... Body sai định dạng cũng trả cùng sub-code với message cố định.

- `error` (ErrorResponseError, optional)

### 404 Not Found Error

`FEEDBACK_FORM_NOT_FOUND`.

- `error` (ErrorResponseError, optional)

### 409 Conflict Error

`CUSTOMER_FEEDBACK_ALREADY_CLOSED` — đã gửi trước đó hoặc đã hết hạn.

- `error` (ErrorResponseError, optional)

### 429 Too Many Requests Error

`RATE_LIMIT_EXCEEDED`.

- `error` (ErrorResponseError, optional)

### 502 Bad Gateway Error

`CUSTOMER_SERVICE_UNAVAILABLE`, kèm `Retry-After: 5` — hoặc một lỗi downstream khác; không bao giờ trả nguyên văn lỗi của customer-service.

- `error` (ErrorResponseError, optional)

### 503 Service Unavailable Error

`SERVICE_OVERLOADED` — quá nhiều lượt gọi đánh giá cùng lúc, kèm `Retry-After: 2`.

- `error` (ErrorResponseError, optional)

## Types

### FeedbackSubmitRequestRating

- `score` (integer, required)
- `selectedOptions` (list of string, optional) — Nhãn (label) các lựa chọn follow-up của đúng mức điểm đã chọn.

### FeedbackSubmitRequestCustomComponentsItems

- `componentId` (string, required)
- `value` (FeedbackSubmitRequestCustomComponentsItemsValue, optional) — Chuỗi cho câu hỏi dạng văn bản, mảng option id cho câu hỏi dạng lựa chọn.

### ErrorResponseError

- `code` (string, optional) — Nhóm lỗi (dạng máy đọc được), ổn định theo từng HTTP status.
- `subCode` (string, optional, nullable) — Mã cụ thể, ổn định — dùng để phân nhánh xử lý / dịch i18n. Hãy xử lý logic dựa trên `subCode`, không dựa vào chuỗi `message`.
- `message` (string, optional) — Mô tả cho con người đọc (dùng để debug), không nên dịch trực tiếp.
- `timestamp` (long, optional) — Epoch millis.
- `path` (string, optional) — Đường dẫn request đầy đủ.
- `traceId` (string, optional, nullable)
- `details` (list of ErrorResponseErrorDetailsItems, optional, nullable)

### FeedbackSubmitRequestCustomComponentsItemsValue

Chuỗi cho câu hỏi dạng văn bản, mảng option id cho câu hỏi dạng lựa chọn.

- string
- list of string

### ErrorResponseErrorDetailsItems

- `field` (string, optional)
- `message` (string, optional)
- `rejectedValue` (any, optional, nullable)

## Examples

**Request**

```json
{
  "token": "your-feedback-token",
  "rating": {
    "score": 2,
    "selectedOptions": [
      "Hỗ trợ chậm"
    ]
  },
  "customComponents": [
    {
      "componentId": "comment",
      "value": "Cần nhanh hơn"
    }
  ]
}
```

**Response**

```json
{
  "feedbackId": "string",
  "status": "SUBMITTED",
  "expiresAt": 1,
  "submittedAt": 1
}
```

**SDK Code**

```python Gửi đánh giá 2 sao kèm lý do
import requests

url = "https://api.omicx.one/feedbacks/submit"

payload = {
    "token": "your-feedback-token",
    "rating": {
        "score": 2,
        "selectedOptions": ["Hỗ trợ chậm"]
    },
    "customComponents": [
        {
            "componentId": "comment",
            "value": "Cần nhanh hơn"
        }
    ]
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Gửi đánh giá 2 sao kèm lý do
const url = 'https://api.omicx.one/feedbacks/submit';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"token":"your-feedback-token","rating":{"score":2,"selectedOptions":["Hỗ trợ chậm"]},"customComponents":[{"componentId":"comment","value":"Cần nhanh hơn"}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Gửi đánh giá 2 sao kèm lý do
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.omicx.one/feedbacks/submit"

	payload := strings.NewReader("{\n  \"token\": \"your-feedback-token\",\n  \"rating\": {\n    \"score\": 2,\n    \"selectedOptions\": [\n      \"Hỗ trợ chậm\"\n    ]\n  },\n  \"customComponents\": [\n    {\n      \"componentId\": \"comment\",\n      \"value\": \"Cần nhanh hơn\"\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Gửi đánh giá 2 sao kèm lý do
require 'uri'
require 'net/http'

url = URI("https://api.omicx.one/feedbacks/submit")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"token\": \"your-feedback-token\",\n  \"rating\": {\n    \"score\": 2,\n    \"selectedOptions\": [\n      \"Hỗ trợ chậm\"\n    ]\n  },\n  \"customComponents\": [\n    {\n      \"componentId\": \"comment\",\n      \"value\": \"Cần nhanh hơn\"\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java Gửi đánh giá 2 sao kèm lý do
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.omicx.one/feedbacks/submit")
  .header("Content-Type", "application/json")
  .body("{\n  \"token\": \"your-feedback-token\",\n  \"rating\": {\n    \"score\": 2,\n    \"selectedOptions\": [\n      \"Hỗ trợ chậm\"\n    ]\n  },\n  \"customComponents\": [\n    {\n      \"componentId\": \"comment\",\n      \"value\": \"Cần nhanh hơn\"\n    }\n  ]\n}")
  .asString();
```

```php Gửi đánh giá 2 sao kèm lý do
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.omicx.one/feedbacks/submit', [
  'body' => '{
  "token": "your-feedback-token",
  "rating": {
    "score": 2,
    "selectedOptions": [
      "Hỗ trợ chậm"
    ]
  },
  "customComponents": [
    {
      "componentId": "comment",
      "value": "Cần nhanh hơn"
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Gửi đánh giá 2 sao kèm lý do
using RestSharp;

var client = new RestClient("https://api.omicx.one/feedbacks/submit");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"token\": \"your-feedback-token\",\n  \"rating\": {\n    \"score\": 2,\n    \"selectedOptions\": [\n      \"Hỗ trợ chậm\"\n    ]\n  },\n  \"customComponents\": [\n    {\n      \"componentId\": \"comment\",\n      \"value\": \"Cần nhanh hơn\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Gửi đánh giá 2 sao kèm lý do
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "token": "your-feedback-token",
  "rating": [
    "score": 2,
    "selectedOptions": ["Hỗ trợ chậm"]
  ],
  "customComponents": [
    [
      "componentId": "comment",
      "value": "Cần nhanh hơn"
    ]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.omicx.one/feedbacks/submit")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```