> ## Documentation Index
> Fetch the complete documentation index at: https://api-docs.ollang.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Run QC Evaluation

> Run a standalone AI-powered QC evaluation on an order to assess translation quality across multiple criteria including accuracy, fluency, tone, and cultural fit.

Run a standalone QC (Quality Control) evaluation on an existing order. This endpoint triggers an AI-powered assessment of the translation quality, evaluating criteria such as accuracy, fluency, tone, and cultural fit. The evaluation runs asynchronously and you will be notified when it's completed.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api-integration.ollang.com/integration/orders/60b8d6f1e1b9b1d8c6c0d8e1/qc" \
    -H "X-Api-Key: <your-api-key>" \
    -H "Content-Type: application/json" \
    -d '{
      "accuracy": true,
      "fluency": true,
      "tone": true,
      "culturalFit": true,
      "customPrompt": "Please focus on technical terminology accuracy",
      "callbackUrl": "https://example.com/webhooks/qc-completed"
    }'
  ```

  ```javascript JavaScript theme={null}
  const orderId = "60b8d6f1e1b9b1d8c6c0d8e1";

  const response = await fetch(
    `https://api-integration.ollang.com/integration/orders/${orderId}/qc`,
    {
      method: "POST",
      headers: {
        "X-Api-Key": "<your-api-key>",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        accuracy: true,
        fluency: true,
        tone: true,
        culturalFit: true,
        customPrompt: "Please focus on technical terminology accuracy",
        callbackUrl: "https://example.com/webhooks/qc-completed",
      }),
    },
  );

  const result = await response.json();
  console.log(result);
  ```

  ```python Python theme={null}
  import requests

  order_id = "60b8d6f1e1b9b1d8c6c0d8e1"
  headers = {
      'X-Api-Key': '<your-api-key>',
      'Content-Type': 'application/json'
  }
  payload = {
      'accuracy': True,
      'fluency': True,
      'tone': True,
      'culturalFit': True,
      'customPrompt': 'Please focus on technical terminology accuracy',
      'callbackUrl': 'https://example.com/webhooks/qc-completed'
  }

  response = requests.post(
      f'https://api-integration.ollang.com/integration/orders/{order_id}/qc',
      headers=headers,
      json=payload
  )

  print(response.json())
  ```

  ```php PHP theme={null}
  $orderId = '60b8d6f1e1b9b1d8c6c0d8e1';

  $curl = curl_init();

  $payload = json_encode([
      'accuracy' => true,
      'fluency' => true,
      'tone' => true,
      'culturalFit' => true,
      'customPrompt' => 'Please focus on technical terminology accuracy',
      'callbackUrl' => 'https://example.com/webhooks/qc-completed'
  ]);

  curl_setopt_array($curl, array(
      CURLOPT_URL => 'https://api-integration.ollang.com/integration/orders/' . $orderId . '/qc',
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_POST => true,
      CURLOPT_POSTFIELDS => $payload,
      CURLOPT_HTTPHEADER => array(
          'X-Api-Key: <your-api-key>',
          'Content-Type: application/json'
      ),
  ));

  $response = curl_exec($curl);
  curl_close($curl);

  $result = json_decode($response, true);
  print_r($result);
  ```

  ```go Go theme={null}
  package main

  import (
      "bytes"
      "encoding/json"
      "fmt"
      "io"
      "net/http"
  )

  func main() {
      orderId := "60b8d6f1e1b9b1d8c6c0d8e1"
      url := fmt.Sprintf("https://api-integration.ollang.com/integration/orders/%s/qc", orderId)

      payload := map[string]interface{}{
          "accuracy":     true,
          "fluency":      true,
          "tone":         true,
          "culturalFit":  true,
          "customPrompt": "Please focus on technical terminology accuracy",
          "callbackUrl":  "https://example.com/webhooks/qc-completed",
      }
      jsonPayload, _ := json.Marshal(payload)

      req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonPayload))
      req.Header.Set("X-Api-Key", "<your-api-key>")
      req.Header.Set("Content-Type", "application/json")

      client := &http.Client{}
      resp, _ := client.Do(req)
      defer resp.Body.Close()

      body, _ := io.ReadAll(resp.Body)
      fmt.Println(string(body))
  }
  ```

  ```java Java theme={null}
  String orderId = "60b8d6f1e1b9b1d8c6c0d8e1";

  String payload = "{" +
      "\"accuracy\": true," +
      "\"fluency\": true," +
      "\"tone\": true," +
      "\"culturalFit\": true," +
      "\"customPrompt\": \"Please focus on technical terminology accuracy\"," +
      "\"callbackUrl\": \"https://example.com/webhooks/qc-completed\"" +
  "}";

  HttpResponse<String> response = Unirest.post("https://api-integration.ollang.com/integration/orders/" + orderId + "/qc")
    .header("X-Api-Key", "<your-api-key>")
    .header("Content-Type", "application/json")
    .body(payload)
    .asString();

  System.out.println(response.getBody());
  ```
</RequestExample>

## Authorizations

This endpoint requires API key authentication. Include your API key in the request header:

* **Header name**: `X-Api-Key`
* **Header value**: Your API key from the Ollang dashboard
* **Format**: `X-Api-Key: your-api-key-here`

You can obtain your API key from your [Ollang dashboard](https://lab.ollang.com).

## Path Parameters

<ParamField path="orderId" type="string" required>
  The unique identifier of the order for which you want to run the QC
  evaluation. The order must be in a completed or delivered state to be eligible
  for evaluation.
</ParamField>

## Request Body

<ParamField body="accuracy" type="boolean" default="true">
  Include accuracy evaluation in the QC assessment. This evaluates how
  accurately the translation conveys the meaning of the source content.
</ParamField>

<ParamField body="fluency" type="boolean" default="true">
  Include fluency evaluation in the QC assessment. This evaluates how naturally
  the translation reads in the target language.
</ParamField>

<ParamField body="tone" type="boolean" default="true">
  Include tone evaluation in the QC assessment. This evaluates whether the
  translation maintains the appropriate tone and style of the original content.
</ParamField>

<ParamField body="culturalFit" type="boolean" default="true">
  Include cultural fit evaluation in the QC assessment. This evaluates whether
  the translation is culturally appropriate for the target audience.
</ParamField>

<ParamField body="customPrompt" type="string">
  Optional custom prompt to guide the QC evaluation. Use this to provide
  specific instructions or focus areas for the AI evaluator, such as "Please
  focus on technical terminology accuracy" or "Pay attention to formal register
  consistency".
</ParamField>

<ParamField body="callbackUrl" type="string">
  Optional HTTPS URL to receive a POST request when the QC evaluation completes.
  Must be a valid HTTPS URL pointing to a publicly accessible host (private IPs
  and `localhost` are rejected). When provided, the evaluation results are sent
  to this URL as a JSON payload once processing finishes. See [Callback
  Payload](#callback-payload) below for the response format.
</ParamField>

## Response

<ResponseField name="success" type="boolean" required>
  Indicates whether the QC evaluation was started successfully.
</ResponseField>

<ResponseField name="message" type="string" required>
  A message describing the result of the request.
</ResponseField>

<ResponseField name="evalId" type="string" required>
  The unique identifier of the created evaluation. Use this ID to track the
  evaluation status and retrieve results.
</ResponseField>

<ResponseField name="creditsUsed" type="number" required>
  The number of AI credits consumed for this evaluation.
</ResponseField>

<ResponseField name="isProcessing" type="boolean">
  Indicates whether the evaluation is still being processed. When `true`, the
  evaluation is running asynchronously and results will be available later.
</ResponseField>

<ResponseField name="textSummary" type="string">
  A text summary of the evaluation results. This field is populated once the
  evaluation is complete.
</ResponseField>

<ResponseField name="scores" type="array">
  An array of evaluation scores for each criterion. Each score object contains:

  * `name`: The name of the evaluation criterion (e.g., "accuracy", "fluency") -
    `score`: The numerical score value - `details`: Additional details about the
    score
</ResponseField>

<ResponseField name="segmentEvals" type="array">
  Segment-by-segment evaluation results. Each segment evaluation contains: -
  `segmentId`: The identifier of the evaluated segment - `scores`: Array of
  scores for this specific segment - `comments`: Evaluator comments about this
  segment
</ResponseField>

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "message": "QC evaluation started. You will be notified when it's completed.",
    "evalId": "eval_abc123def456",
    "creditsUsed": 5,
    "isProcessing": true
  }
  ```

  ```json 400 theme={null}
  {
    "error": "Order not eligible for QC evaluation",
    "message": "Only completed or delivered orders can be evaluated",
    "code": "ORDER_NOT_ELIGIBLE"
  }
  ```

  ```json 404 theme={null}
  {
    "error": "Order not found",
    "message": "No order found with the provided orderId",
    "code": "ORDER_NOT_FOUND"
  }
  ```

  ```json 403 theme={null}
  {
    "error": "Access denied",
    "message": "You don't have permission to run QC evaluation for this order",
    "code": "ACCESS_DENIED"
  }
  ```

  ```json 401 theme={null}
  {
    "error": "Unauthorized",
    "message": "Invalid or missing API key",
    "code": "UNAUTHORIZED"
  }
  ```
</ResponseExample>

## Callback Payload

When a `callbackUrl` is provided, Ollang sends a `POST` request to the URL once the QC evaluation completes. The request has a `Content-Type: application/json` header and the following body:

<ResponseField name="orderId" type="string" required>
  The identifier of the order that was evaluated.
</ResponseField>

<ResponseField name="evalId" type="string" required>
  The unique identifier of the evaluation run.
</ResponseField>

<ResponseField name="status" type="string" required>
  The evaluation status. Will be `"completed"` on success.
</ResponseField>

<ResponseField name="textSummary" type="string" required>
  A human-readable summary of the evaluation results.
</ResponseField>

<ResponseField name="scores" type="array" required>
  An array of evaluation scores for each criterion. Each score object contains:

  * `name`: The name of the criterion (e.g., `"accuracy"`, `"fluency"`)
  * `score`: The numerical score value
  * `details`: Additional details about the score
</ResponseField>

<ResponseField name="segmentEvals" type="array" required>
  Segment-by-segment evaluation results. Each segment evaluation contains:

  * `segmentId`: The identifier of the evaluated segment
  * `scores`: Array of scores for this specific segment
  * `comments`: Evaluator comments about this segment
</ResponseField>

**Example callback payload:**

```json theme={null}
{
  "orderId": "60b8d6f1e1b9b1d8c6c0d8e1",
  "evalId": "eval_abc123def456",
  "status": "completed",
  "textSummary": "Overall translation quality is high with minor fluency issues in segments 3 and 7.",
  "scores": [
    { "name": "accuracy", "score": 92, "details": "..." },
    { "name": "fluency", "score": 85, "details": "..." },
    { "name": "tone", "score": 90, "details": "..." },
    { "name": "culturalFit", "score": 88, "details": "..." }
  ],
  "segmentEvals": [
    {
      "segmentId": "seg_001",
      "scores": [{ "name": "accuracy", "score": 95 }],
      "comments": "Accurate translation with natural phrasing."
    }
  ]
}
```

<Note>
  The callback request has a **10-second timeout**. If your server does not
  respond within 10 seconds, the request is considered failed. Callback failures
  do not affect the evaluation itself — results are still available via the [Get
  Order by ID](/apis/ollang-api-reference/get-order-by-id) endpoint.
</Note>
