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

> Create a new translation order for your uploaded video projects

Create a new translation order for your uploaded video projects. This endpoint allows you to request specific translation services such as closed captions, subtitles, dubbing, and more.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api-integration.ollang.com/integration/orders/create" \
    -H "X-Api-Key: <your-api-key>" \
    -H "Content-Type: application/json" \
    -d '{
      "orderType": "cc",
      "level": 1,
      "projectId": "60b8d6f1e1b9b1d8c6c0d8e1",
      "targetLanguageConfigs": [
        {
          "language": "fr",
          "isRush": false
        },
        {
          "language": "es",
          "isRush": true
        }
      ],
      "callbackUrl": "https://your-domain.com/webhooks/order-completed",
      "autoQc": true
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api-integration.ollang.com/integration/orders/create",
    {
      method: "POST",
      headers: {
        "X-Api-Key": "<your-api-key>",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        orderType: "cc",
        level: 1,
        projectId: "60b8d6f1e1b9b1d8c6c0d8e1",
        targetLanguageConfigs: [
          {
            language: "fr",
            isRush: false,
          },
          {
            language: "es",
            isRush: true,
          },
        ],
        callbackUrl: "https://your-domain.com/webhooks/order-completed",
        autoQc: true,
      }),
    }
  );
  ```

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

  data = {
      "orderType": "cc",
      "level": 1,
      "projectId": "60b8d6f1e1b9b1d8c6c0d8e1",
      "targetLanguageConfigs": [
          {
              "language": "fr",
              "isRush": False
          },
          {
              "language": "es",
              "isRush": True
          }
      ],
      "callbackUrl": "https://your-domain.com/webhooks/order-completed",
      "autoQc": True
  }

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

  response = requests.post(
      'https://api-integration.ollang.com/integration/orders/create',
      headers=headers,
      data=json.dumps(data)
  )
  ```

  ```php PHP theme={null}
  $data = array(
      'orderType' => 'cc',
      'level' => 1,
      'projectId' => '60b8d6f1e1b9b1d8c6c0d8e1',
      'targetLanguageConfigs' => array(
          array(
              'language' => 'fr',
              'isRush' => false
          ),
          array(
              'language' => 'es',
              'isRush' => true
          )
      ),
      'callbackUrl' => 'https://your-domain.com/webhooks/order-completed',
      'autoQc' => true
  );

  $curl = curl_init();

  curl_setopt_array($curl, array(
      CURLOPT_URL => 'https://api-integration.ollang.com/integration/orders/create',
      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"
      "net/http"
  )

  func main() {
      data := map[string]interface{}{
          "orderType": "cc",
          "level":     1,
          "projectId": "60b8d6f1e1b9b1d8c6c0d8e1",
          "targetLanguageConfigs": []map[string]interface{}{
              {
                  "language": "fr",
                  "isRush":   false,
              },
              {
                  "language": "es",
                  "isRush":   true,
              },
          },
          "callbackUrl": "https://your-domain.com/webhooks/order-completed",
          "autoQc": true,
      }

      jsonData, _ := json.Marshal(data)

      req, _ := http.NewRequest("POST", "https://api-integration.ollang.com/integration/orders/create", 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.JSONArray;
  import org.json.JSONObject;

  JSONObject targetLang1 = new JSONObject();
  targetLang1.put("language", "fr");
  targetLang1.put("isRush", false);

  JSONObject targetLang2 = new JSONObject();
  targetLang2.put("language", "es");
  targetLang2.put("isRush", true);

  JSONArray targetLanguageConfigs = new JSONArray();
  targetLanguageConfigs.put(targetLang1);
  targetLanguageConfigs.put(targetLang2);

  JSONObject requestBody = new JSONObject();
  requestBody.put("orderType", "cc");
  requestBody.put("level", 1);
  requestBody.put("projectId", "60b8d6f1e1b9b1d8c6c0d8e1");
  requestBody.put("targetLanguageConfigs", targetLanguageConfigs);
  requestBody.put("callbackUrl", "https://your-domain.com/webhooks/order-completed");
  requestBody.put("autoQc", true);

  HttpResponse<String> response = Unirest.post("https://api-integration.ollang.com/integration/orders/create")
    .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).

## Body Parameters

<ParamField body="orderType" type="string" required>
  Type of the order. Available options: - `cc` - Closed captions - `subtitle` -
  Subtitles - `aiDubbing` - AI Dubbing - `studioDubbing` - Studio-produced
  dubbing - `document` - Document translation (including Image to Image when the
  source is a JPEG, JPG, or PNG from Direct Upload)
</ParamField>

<ParamField body="level" type="number" required>
  Service level for the order. Level 0 means full AI generated and Level 1 is
  Human Review added version.
</ParamField>

<ParamField body="projectId" type="string" required>
  Unique identifier of the project this order belongs to. This should be a
  project ID from a previous video upload.
</ParamField>

<ParamField body="targetLanguageConfigs" type="array" required>
  Array of target language configurations. At least one target language
  configuration is required.

  <Expandable title="Target Language Configuration Object">
    <ParamField body="language" type="string" required>
      ISO 639-1 language code (e.g., 'fr', 'es', 'de')
    </ParamField>

    <ParamField body="isRush" type="boolean">
      Whether this language requires rush delivery
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="orderSubType" type="string" optional>
  Subtype of the order, specific to closed captions or transcription types. Must
  be one of: `closedCaption` or `timecodedTranscription`.
</ParamField>

<ParamField body="dubbingStyle" type="string" optional>
  Style of dubbing for audio orders. Must be one of: `overdub`, `lipsync`, or
  `audioDescription`.
</ParamField>

<ParamField body="callbackUrl" type="string" optional>
  Optional URL to receive a `POST` request when the order completes. Must be a
  valid URL (`http` or `https`). The callback payload includes the completed
  order's translated content (documents, subtitle files, etc.) so you can
  process results immediately without a separate API call.
  See [Order completion callback](#order-completion-callback).
</ParamField>

<ParamField body="autoQc" type="boolean" optional>
  When set to `true`, a QC evaluation will automatically run after the AI order
  completes. Defaults to `false`. Auto-QC only applies to top-level orders
  (child orders created as part of a parent order are excluded).
</ParamField>

## Order completion callback

When `callbackUrl` is provided, Ollang sends a `POST` request to that URL after the
order reaches a completed state. The request uses `Content-Type: application/json`
and has a **10-second timeout**. Callback failures do not affect the order itself.
Implement idempotent handling and validate payloads on your side; you can always
confirm status and outputs with [Get Order by ID](/apis/ollang-api-reference/get-order-by-id).

### Callback payload

The callback `POST` body includes the completed order's translated content, matching
the shape of the [Get Order by ID](/apis/ollang-api-reference/get-order-by-id) response:

| Field            | Type     | Description                                                                                                                                                                                                                                                                        |
| ---------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `orderId`        | `string` | The unique identifier of the completed order.                                                                                                                                                                                                                                      |
| `status`         | `string` | Always `"completed"`.                                                                                                                                                                                                                                                              |
| `orderType`      | `string` | The order type (e.g., `cc`, `subtitle`, `document`, `aiDubbing`).                                                                                                                                                                                                                  |
| `targetLanguage` | `string` | Target language code (ISO 639-1).                                                                                                                                                                                                                                                  |
| `completedAt`    | `string` | Completion timestamp (ISO 8601).                                                                                                                                                                                                                                                   |
| `orderDocs`      | `array`  | All documents associated with the order — source files, translated subtitles, embedded videos, dubbed audio, translated documents, images, etc. Each object includes `id`, `name`, `url`, `type`, `size`, `duration`, `wordCount`, `sourceLanguage`, `createdAt`, and `updatedAt`. |
| `vttUrl`         | `string` | Signed URL to download the VTT subtitle file (valid for 7 days). Empty string if not applicable to the order type.                                                                                                                                                                 |

### Example callback payload

```json theme={null}
{
  "orderId": "507f1f77bcf86cd799439015",
  "status": "completed",
  "orderType": "subtitle",
  "targetLanguage": "fr",
  "completedAt": "2024-01-16T14:20:00.000Z",
  "orderDocs": [
    {
      "id": "doc_123abc",
      "name": "Source Video.mp4",
      "url": "https://example.com/videos/source.mp4",
      "type": "source_video",
      "size": 1073741824,
      "duration": 7200,
      "wordCount": null,
      "sourceLanguage": "en",
      "createdAt": "2024-01-15T10:30:00Z",
      "updatedAt": "2024-01-15T10:30:00Z"
    },
    {
      "id": "doc_456def",
      "name": "French Subtitles.srt",
      "url": "https://example.com/subtitles/fr.srt",
      "type": "created_subtitle",
      "size": 8192,
      "duration": null,
      "wordCount": 1250,
      "sourceLanguage": "fr",
      "createdAt": "2024-01-16T14:20:00Z",
      "updatedAt": "2024-01-16T14:20:00Z"
    }
  ],
  "vttUrl": "https://example.com/subtitles/507f1f77bcf86cd799439015.vtt"
}
```

## Response

The endpoint returns an **array** of created orders — one per
`targetLanguageConfigs` entry. Each element is an object with a single
`orderId` field. If you pass three target languages, you get three order IDs
back in the same order you supplied them.

<ResponseField name="orders" type="array">
  Array of created orders. Each entry corresponds to one
  `targetLanguageConfigs` item, in the same order.

  <Expandable title="Order Object">
    <ResponseField name="orderId" type="string">
      Unique identifier of the created order. Use this with
      [Get Order by ID](/apis/ollang-api-reference/get-order-by-id),
      [Cancel Order](/apis/ollang-api-reference/cancel-order), or any
      other order-scoped endpoint.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json 201 theme={null}
  [
    {
      "orderId": "507f1f77bcf86cd799439015"
    },
    {
      "orderId": "507f1f77bcf86cd799439016"
    }
  ]
  ```

  ```json 400 theme={null}
  {
    "error": "Invalid order type",
    "message": "orderType must be one of: cc, subtitle, document, aiDubbing, studioDubbing",
    "code": "INVALID_ORDER_TYPE"
  }
  ```

  ```json 404 theme={null}
  {
    "error": "Project not found",
    "message": "No project found with the provided projectId",
    "code": "PROJECT_NOT_FOUND"
  }
  ```

  ```json 400 theme={null}
  {
    "error": "Invalid target language",
    "message": "At least one targetLanguageConfig is required",
    "code": "MISSING_TARGET_LANGUAGES"
  }
  ```

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