> 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 URL đánh giá](/feedbacks/get-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à `content`.

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

## Request

### Body (application/json)

This endpoint expects a FeedbackSubmitRequest.

- `token` (string, required)
- `rating` (FeedbackRating, required)
- `content` (FeedbackContent, optional)

## Response

### 200

Đánh giá vừa được gửi.

- `feedbackId` (string, optional)
- `templateId` (string, optional)
- `customerId` (string, optional, nullable) — uid khách hàng; `null` nếu là feedback của cuộc gọi/ticket không gắn khách hàng.
- `entityType` (enum, optional) — Đối tượng được đánh giá.
  - Allowed values: `CUSTOMER`, `CALL`, `TICKET`
- `callId` (string, optional, nullable)
- `ticketId` (string, optional, nullable)
- `source` (enum, optional) — Kênh tạo feedback — luôn là `API` với feedback tạo qua đối tác.
  - Allowed values: `API`
- `status` (enum, optional)
  - Allowed values: `PENDING`, `EXPIRED`, `SUBMITTED`
- `submittedAt` (long, optional, nullable)
- `rating` (FeedbackRating, optional, nullable)
- `content` (FeedbackContent, optional, nullable)

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

### FeedbackRating

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

### FeedbackContent

- string
- list of string

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

### ErrorResponseErrorDetailsItems

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

## Examples

**Request**

```json
{
  "token": "dxRmbpYPaYkPof1je02U",
  "rating": {
    "score": 2,
    "selectedOptions": [
      "Hỗ trợ chậm"
    ]
  },
  "content": {
    "comment": "Cần nhanh hơn",
    "nhieuluachon": [
      "asd",
      "123"
    ]
  }
}
```

**Response**

```json
{
  "feedbackId": "string",
  "templateId": "string",
  "customerId": "string",
  "entityType": "CUSTOMER",
  "callId": "string",
  "ticketId": "string",
  "source": "API",
  "status": "PENDING",
  "submittedAt": 1,
  "rating": {
    "score": 1,
    "selectedOptions": [
      "string"
    ]
  },
  "content": {}
}
```

**SDK Code**

```python Gửi đánh giá 2 sao kèm góp ý
import requests

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

payload = {
    "token": "dxRmbpYPaYkPof1je02U",
    "rating": {
        "score": 2,
        "selectedOptions": ["Hỗ trợ chậm"]
    },
    "content": {
        "comment": "Cần nhanh hơn",
        "nhieuluachon": ["asd", "123"]
    }
}
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 góp ý
const url = 'https://api.omicx.one/feedbacks/submit';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"token":"dxRmbpYPaYkPof1je02U","rating":{"score":2,"selectedOptions":["Hỗ trợ chậm"]},"content":{"comment":"Cần nhanh hơn","nhieuluachon":["asd","123"]}}'
};

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 góp ý
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"token\": \"dxRmbpYPaYkPof1je02U\",\n  \"rating\": {\n    \"score\": 2,\n    \"selectedOptions\": [\n      \"Hỗ trợ chậm\"\n    ]\n  },\n  \"content\": {\n    \"comment\": \"Cần nhanh hơn\",\n    \"nhieuluachon\": [\n      \"asd\",\n      \"123\"\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 góp ý
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\": \"dxRmbpYPaYkPof1je02U\",\n  \"rating\": {\n    \"score\": 2,\n    \"selectedOptions\": [\n      \"Hỗ trợ chậm\"\n    ]\n  },\n  \"content\": {\n    \"comment\": \"Cần nhanh hơn\",\n    \"nhieuluachon\": [\n      \"asd\",\n      \"123\"\n    ]\n  }\n}"

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

```java Gửi đánh giá 2 sao kèm góp ý
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\": \"dxRmbpYPaYkPof1je02U\",\n  \"rating\": {\n    \"score\": 2,\n    \"selectedOptions\": [\n      \"Hỗ trợ chậm\"\n    ]\n  },\n  \"content\": {\n    \"comment\": \"Cần nhanh hơn\",\n    \"nhieuluachon\": [\n      \"asd\",\n      \"123\"\n    ]\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

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

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

```csharp Gửi đánh giá 2 sao kèm góp ý
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\": \"dxRmbpYPaYkPof1je02U\",\n  \"rating\": {\n    \"score\": 2,\n    \"selectedOptions\": [\n      \"Hỗ trợ chậm\"\n    ]\n  },\n  \"content\": {\n    \"comment\": \"Cần nhanh hơn\",\n    \"nhieuluachon\": [\n      \"asd\",\n      \"123\"\n    ]\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Gửi đánh giá 2 sao kèm góp ý
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "token": "dxRmbpYPaYkPof1je02U",
  "rating": [
    "score": 2,
    "selectedOptions": ["Hỗ trợ chậm"]
  ],
  "content": [
    "comment": "Cần nhanh hơn",
    "nhieuluachon": ["asd", "123"]
  ]
] 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()
```