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

> Import a Figma file and create translation orders in one step

Import a Figma design file and create AI translation orders for one or more target languages. This endpoint handles the full pipeline: importing text layers from Figma, creating/reusing the project, and triggering translation for each target language.

The Figma file is always re-imported to capture the latest design state. If a project already exists for this file, it will be reused.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api-integration.ollang.com/integration/orders/figma/create" \
    -H "X-Api-Key: <your-api-key>" \
    -H "Content-Type: application/json" \
    -d '{
      "fileKey": "UwNAtPYAu5JPIhFc03M71h",
      "fileUrl": "https://www.figma.com/design/UwNAtPYAu5JPIhFc03M71h/My-Design",
      "sourceLanguage": "en",
      "targetLanguages": ["fr", "de", "tr"]
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://api-integration.ollang.com/integration/orders/figma/create",
    {
      method: "POST",
      headers: {
        "X-Api-Key": "<your-api-key>",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        fileKey: "UwNAtPYAu5JPIhFc03M71h",
        fileUrl: "https://www.figma.com/design/UwNAtPYAu5JPIhFc03M71h/My-Design",
        sourceLanguage: "en",
        targetLanguages: ["fr", "de", "tr"],
      }),
    }
  );

  const result = await response.json();
  console.log(result.orders); // [{orderId, targetLanguage, status}]
  ```

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

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

  payload = {
      'fileKey': 'UwNAtPYAu5JPIhFc03M71h',
      'fileUrl': 'https://www.figma.com/design/UwNAtPYAu5JPIhFc03M71h/My-Design',
      'sourceLanguage': 'en',
      'targetLanguages': ['fr', 'de', 'tr']
  }

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

  result = response.json()
  print(result['orders'])
  ```
</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

## Prerequisites

<Warning>
  Your Figma account must be connected to Ollang via OAuth before using this endpoint.
  Connect your Figma account from the [Ollang dashboard](https://lab.ollang.com) under Settings → Integrations → Figma.
</Warning>

## Body Parameters

<ParamField body="fileKey" type="string" required>
  The Figma file key. This is the identifier in the Figma URL between `/design/` and the file name.
  Example: For `https://www.figma.com/design/UwNAtPYAu5JPIhFc03M71h/My-Design`, the file key is `UwNAtPYAu5JPIhFc03M71h`.
</ParamField>

<ParamField body="fileUrl" type="string" required>
  The full Figma file URL. Must contain `figma.com`.
</ParamField>

<ParamField body="sourceLanguage" type="string" required>
  The source language code of the design content (e.g., `en`, `fr`, `de`).
</ParamField>

<ParamField body="targetLanguages" type="string[]" required>
  Array of target language codes to translate into. At least one is required.
</ParamField>

<ParamField body="folderId" type="string">
  Optional folder ID to organize the project in. If not provided, a default folder is used.
</ParamField>

## Response

<ResponseField name="projectId" type="string">
  The ID of the created or reused project.
</ResponseField>

<ResponseField name="importId" type="string">
  The ID of the Figma import record containing extracted text layers.
</ResponseField>

<ResponseField name="orders" type="array">
  Array of created orders, one per target language.

  <Expandable title="Order item properties">
    <ResponseField name="orderId" type="string">
      The unique order identifier.
    </ResponseField>

    <ResponseField name="targetLanguage" type="string">
      The target language code for this order.
    </ResponseField>

    <ResponseField name="status" type="string">
      Initial order status (`ongoing`).
    </ResponseField>
  </Expandable>
</ResponseField>

## Error Responses

| Status | Description                                                          |
| ------ | -------------------------------------------------------------------- |
| 400    | Figma account not connected, or missing/invalid parameters           |
| 409    | An active order for a target language already exists in this project |
| 422    | Figma file import failed (API error or access issue)                 |

<ResponseExample>
  ```json 201 theme={null}
  {
    "projectId": "60b8d6f1e1b9b1d8c6c0d8e1",
    "importId": "60b8d6f1e1b9b1d8c6c0d8e2",
    "orders": [
      {
        "orderId": "60b8d6f1e1b9b1d8c6c0d8e3",
        "targetLanguage": "fr",
        "status": "ongoing"
      },
      {
        "orderId": "60b8d6f1e1b9b1d8c6c0d8e4",
        "targetLanguage": "de",
        "status": "ongoing"
      },
      {
        "orderId": "60b8d6f1e1b9b1d8c6c0d8e5",
        "targetLanguage": "tr",
        "status": "ongoing"
      }
    ]
  }
  ```

  ```json 400 theme={null}
  {
    "statusCode": 400,
    "message": "Figma account not connected. Please connect your Figma account in the Ollang dashboard first."
  }
  ```

  ```json 409 theme={null}
  {
    "statusCode": 409,
    "message": "An active order for \"fr\" already exists in this project. Wait for it to complete or cancel it before creating a new one."
  }
  ```
</ResponseExample>
