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

# Import Memory Items

> Add translation units to a translation memory

Queue translation units (source/target text per language pair) for import into a translation memory. The units are processed asynchronously through the same import pipeline as dashboard file uploads — including the vectorization step that makes them available to semantic matching — so the endpoint returns an import job to poll rather than a synchronous result.

A single request accepts up to **1000 items**; send multiple requests for larger corpora. A memory can hold several language pairs at once — matches are resolved per target language at translation time.

Poll [Get Memory Import Job](/apis/ollang-api-reference/get-memory-import-job) with the returned `jobId` to track progress.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api-integration.ollang.com/integration/memories/507f1f77bcf86cd799439011/items/import" \
    -H "X-Api-Key: <your-api-key>" \
    -H "Content-Type: application/json" \
    -d '{
      "items": [
        {
          "sourceLanguage": "en",
          "targetLanguage": "fr",
          "sourceText": "Getting started",
          "targetText": "Premiers pas"
        },
        {
          "sourceLanguage": "en",
          "targetLanguage": "fr",
          "sourceText": "Release notes",
          "targetText": "Notes de version"
        }
      ]
    }'
  ```

  ```javascript JavaScript theme={null}
  const memoryId = "507f1f77bcf86cd799439011";

  const response = await fetch(
    `https://api-integration.ollang.com/integration/memories/${memoryId}/items/import`,
    {
      method: "POST",
      headers: {
        "X-Api-Key": "<your-api-key>",
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        items: [
          {
            sourceLanguage: "en",
            targetLanguage: "fr",
            sourceText: "Getting started",
            targetText: "Premiers pas",
          },
          {
            sourceLanguage: "en",
            targetLanguage: "fr",
            sourceText: "Release notes",
            targetText: "Notes de version",
          },
        ],
      }),
    }
  );

  const { jobId } = await response.json();

  // Poll the import job until it (and vectorization) completes
  const job = await fetch(
    `https://api-integration.ollang.com/integration/memories/import-jobs/${jobId}`,
    { headers: { "X-Api-Key": "<your-api-key>" } }
  ).then((r) => r.json());
  ```

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

  memory_id = "507f1f77bcf86cd799439011"

  data = {
      "items": [
          {
              "sourceLanguage": "en",
              "targetLanguage": "fr",
              "sourceText": "Getting started",
              "targetText": "Premiers pas",
          },
          {
              "sourceLanguage": "en",
              "targetLanguage": "fr",
              "sourceText": "Release notes",
              "targetText": "Notes de version",
          },
      ]
  }

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

  response = requests.post(
      f"https://api-integration.ollang.com/integration/memories/{memory_id}/items/import",
      json=data,
      headers=headers,
  )

  job_id = response.json()["jobId"]

  # Poll the import job until it (and vectorization) completes
  job = requests.get(
      f"https://api-integration.ollang.com/integration/memories/import-jobs/{job_id}",
      headers=headers,
  ).json()
  ```
</RequestExample>

## Authorizations

This endpoint requires API key authentication.

* **Header name**: `X-Api-Key`
* **Header value**: Your API key from the [Ollang dashboard](https://lab.ollang.com)

## Path Parameters

<ParamField path="memoryId" type="string" required>
  The translation memory's unique identifier.
</ParamField>

## Body Parameters

<ParamField body="items" type="array" required>
  Translation units to add to the memory. Minimum 1, maximum 1000 per request.

  <Expandable title="item properties">
    <ParamField body="sourceLanguage" type="string" required>
      Language code of the source text (e.g. `en`).
    </ParamField>

    <ParamField body="targetLanguage" type="string" required>
      Language code of the target text (e.g. `fr`).
    </ParamField>

    <ParamField body="sourceText" type="string" required>
      Source-language text of the translation unit.
    </ParamField>

    <ParamField body="targetText" type="string" required>
      Target-language text of the translation unit.
    </ParamField>
  </Expandable>
</ParamField>

## Response

Returns the import job created for the request.

<ResponseField name="jobId" type="string">
  Identifier of the import job. Poll [Get Memory Import Job](/apis/ollang-api-reference/get-memory-import-job) for progress.
</ResponseField>

<ResponseField name="status" type="string">
  Initial status of the import job. Always `pending` on creation; it moves through `processing` to `completed` (or `failed`).
</ResponseField>

<ResponseExample>
  ```json 201 theme={null}
  {
    "jobId": "66b8d6f1e1b9b1d8c6c0d8e1",
    "status": "pending"
  }
  ```

  ```json 404 theme={null}
  {
    "statusCode": 404,
    "message": "Memory not found"
  }
  ```

  ```json 400 theme={null}
  {
    "statusCode": 400,
    "message": [
      "items must contain no more than 1000 elements"
    ],
    "error": "Bad Request"
  }
  ```

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