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

# Create a Revision For an Order

> Create a revision request for an existing order to report issues or request changes

Create a revision request for an existing order to report issues or request changes to the delivered content. This endpoint allows you to specify the type of issue and provide detailed feedback for correction.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api-integration.ollang.com/integration/revision/60b8d6f1e1b9b1d8c6c0d8e1" \
    -H "X-Api-Key: <your-api-key>" \
    -H "Content-Type: application/json" \
    -d '{
      "type": "wrongSubtitle",
      "time": "02:15:30",
      "description": "The subtitle at this timestamp is incorrectly translated. Should be '\''Hello world'\'' instead of '\''Hello universe'\''."
    }'
  ```

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

  const response = await fetch(
    `https://api-integration.ollang.com/integration/revision/${orderId}`,
    {
      method: "POST",
      headers: {
        "X-Api-Key": "<your-api-key>",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        type: "wrongSubtitle",
        time: "02:15:30",
        description:
          "The subtitle at this timestamp is incorrectly translated. Should be 'Hello world' instead of 'Hello universe'.",
      }),
    }
  );

  const revisionData = await response.json();
  ```

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

  order_id = "60b8d6f1e1b9b1d8c6c0d8e1"

  data = {
      "type": "wrongSubtitle",
      "time": "02:15:30",
      "description": "The subtitle at this timestamp is incorrectly translated. Should be 'Hello world' instead of 'Hello universe'."
  }

  headers = {
      'X-Api-Key': '<your-api-key>',
      'Content-Type': 'application/json'
  }

  response = requests.post(
      f'https://api-integration.ollang.com/integration/revision/{order_id}',
      headers=headers,
      data=json.dumps(data)
  )

  revision_data = response.json()
  ```

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

  $data = array(
      'type' => 'wrongSubtitle',
      'time' => '02:15:30',
      'description' => 'The subtitle at this timestamp is incorrectly translated. Should be \'Hello world\' instead of \'Hello universe\'.'
  );

  $curl = curl_init();

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

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

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

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

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

      data := map[string]interface{}{
          "type":        "wrongSubtitle",
          "time":        "02:15:30",
          "description": "The subtitle at this timestamp is incorrectly translated. Should be 'Hello world' instead of 'Hello universe'.",
      }

      jsonData, _ := json.Marshal(data)

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

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

  ```java Java theme={null}
  import org.json.JSONObject;

  String orderId = "60b8d6f1e1b9b1d8c6c0d8e1";

  JSONObject requestBody = new JSONObject();
  requestBody.put("type", "wrongSubtitle");
  requestBody.put("time", "02:15:30");
  requestBody.put("description", "The subtitle at this timestamp is incorrectly translated. Should be 'Hello world' instead of 'Hello universe'.");

  HttpResponse<String> response = Unirest.post("https://api-integration.ollang.com/integration/revision/" + orderId)
    .header("X-Api-Key", "<your-api-key>")
    .header("Content-Type", "application/json")
    .body(requestBody.toString())
    .asString();
  ```
</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 create a revision.
  This should be a completed or delivered order that you have access to.
</ParamField>

## Body Parameters

<ParamField body="type" type="string" required>
  The type of revision needed. Available options: - `missingSubtitle` - Subtitle
  is missing at a specific time - `wrongSubtitle` - Subtitle content is
  incorrect - `syncError` - Subtitle timing is not synchronized with audio -
  `formatError` - Subtitle formatting issues - `other` - Other types of issues
  not covered above
</ParamField>

<ParamField body="time" type="string" required>
  Timestamp indicating where the issue occurs in the content. Format: "HH:MM:SS"
  (e.g., "02:15:30" for 2 hours, 15 minutes, 30 seconds).
</ParamField>

<ParamField body="description" type="string">
  Optional detailed description of the revision request. Provide specific
  information about what needs to be corrected, including the expected result.
</ParamField>

## Response

<ResponseField name="id" type="string">
  Unique identifier of the created revision request.
</ResponseField>

<ResponseField name="createdAt" type="string">
  Creation date and time of the revision request (ISO 8601 format).
</ResponseField>

<ResponseField name="type" type="string">
  The type of revision that was requested.
</ResponseField>

<ResponseField name="time" type="string">
  The timestamp where the issue occurs in the content.
</ResponseField>

<ResponseField name="description" type="string">
  The description provided for the revision request.
</ResponseField>

<ResponseExample>
  ```json 201 theme={null}
  {
    "id": "rev_60b8d6f1e1b9b1d8c6c0d8e1",
    "createdAt": "2024-01-17T10:30:00Z",
    "type": "wrongSubtitle",
    "time": "02:15:30",
    "description": "The subtitle at this timestamp is incorrectly translated. Should be 'Hello world' instead of 'Hello universe'."
  }
  ```

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

  ```json 400 theme={null}
  {
    "error": "Invalid revision type",
    "message": "Revision type must be one of: missingSubtitle, wrongSubtitle, syncError, formatError, other",
    "code": "INVALID_REVISION_TYPE"
  }
  ```

  ```json 400 theme={null}
  {
    "error": "Order not eligible for revision",
    "message": "Only completed or delivered orders can have revision requests",
    "code": "ORDER_NOT_ELIGIBLE"
  }
  ```

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

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