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

# File import for a Memory

> Imports common translation memory or termbase file formats to a specific LILT memory. Currently supported file formats are `*.tmx`, `*.sdltm`, `*.sdlxliff`(With custom Filters), '*.xliff', and `*.tmq` for TM data; `*.csv` and `*.tbx` for termbase data. Request parameters should be passed as JSON object with the header field `LILT-API`.

Example CURL command to upload a translation memory file named `my_memory.sdltm` in the current working directory:
```bash
  curl -X POST https://api.lilt.com/v2/memories/import?key=API_KEY \
    --header "LILT-API: {\"name\": \"my_memory.sdltm\",\"memory_id\": 42}" \
    --header "Content-Type: application/octet-stream" \
    --data-binary @my_memory.sdltm
```

Example CURL command to upload a translation memory file named `my_memory.sdlxliff` in the current working directory, with Custom Filters based on SDLXLIFF fields, conf_name which maps to, percentage, and whether we should ignore unlocked segments.
```bash
  curl -X POST https://api.lilt.com/v2/memories/import?key=API_KEY \
    --header "LILT-API: {\"name\": \"my_memory.sdlxliff\",\"memory_id\": 12,\"sdlxliff_filters\":[{\"conf_name\": \"Translated\", \"percentage\": 100, \"allow_unlocked\": false}]"}" \
    --header "Content-Type: application/octet-stream" \
    --data-binary @my_memory.sdlxliff
```





## OpenAPI

````yaml /api-reference/openapi-bundled.yaml post /v2/memories/import
openapi: 3.0.3
info:
  title: LILT API
  description: >
    LILT API Support: https://lilt.atlassian.net/servicedesk/customer/portals


    The LILT API enables programmatic access to the full-range of LILT backend
    services including:
      * Training of and translating with interactive, adaptive machine translation
      * Large-scale translation memory
      * The Lexicon (a large-scale termbase)
      * Programmatic control of the LILT CAT environment
      * Translation memory synchronization


    Requests and responses are in JSON format. The REST API only responds to
    HTTPS / SSL requests.


    The base url for this REST API is `https://api.lilt.com/`.


    ## Authentication


    Requests are authenticated via API key, which requires the Business plan.


    Requests are authenticated using [HTTP Basic
    Auth](https://en.wikipedia.org/wiki/Basic_access_authentication). Add your
    API key as both the `username` and `password`.


    For development, you may also pass the API key via the `key` query
    parameter. This is less secure than HTTP Basic Auth, and is not recommended
    for production use.


    ## Quotas


    Our services have a general quota of 4000 requests per minute. Should you
    hit the maximum requests per minute, you will need to wait 60 seconds before
    you can send another request.
  version: v3.0.3
  license:
    name: LILT Platform Terms and Conditions
    url: https://lilt.com/lilt-platform-terms-and-conditions
servers:
  - url: https://api.lilt.com
security:
  - BasicAuth: []
  - ApiKeyAuth: []
paths:
  /v2/memories/import:
    post:
      tags:
        - Memories
      summary: File import for a Memory
      description: >+
        Imports common translation memory or termbase file formats to a specific
        LILT memory. Currently supported file formats are `*.tmx`, `*.sdltm`,
        `*.sdlxliff`(With custom Filters), '*.xliff', and `*.tmq` for TM data;
        `*.csv` and `*.tbx` for termbase data. Request parameters should be
        passed as JSON object with the header field `LILT-API`.


        Example CURL command to upload a translation memory file named
        `my_memory.sdltm` in the current working directory:

        ```bash
          curl -X POST https://api.lilt.com/v2/memories/import?key=API_KEY \
            --header "LILT-API: {\"name\": \"my_memory.sdltm\",\"memory_id\": 42}" \
            --header "Content-Type: application/octet-stream" \
            --data-binary @my_memory.sdltm
        ```


        Example CURL command to upload a translation memory file named
        `my_memory.sdlxliff` in the current working directory, with Custom
        Filters based on SDLXLIFF fields, conf_name which maps to, percentage,
        and whether we should ignore unlocked segments.

        ```bash
          curl -X POST https://api.lilt.com/v2/memories/import?key=API_KEY \
            --header "LILT-API: {\"name\": \"my_memory.sdlxliff\",\"memory_id\": 12,\"sdlxliff_filters\":[{\"conf_name\": \"Translated\", \"percentage\": 100, \"allow_unlocked\": false}]"}" \
            --header "Content-Type: application/octet-stream" \
            --data-binary @my_memory.sdlxliff
        ```

      operationId: importMemoryFile
      parameters:
        - name: memory_id
          in: header
          description: A unique Memory identifier.
          required: true
          schema:
            type: integer
        - name: name
          in: header
          description: Name of the TM or termbase file.
          required: true
          schema:
            type: string
        - name: sdlxliff_filters
          in: header
          description: Contains Filter information Unique to SDLXLIFF
          style: simple
          explode: false
          schema:
            type: array
            items:
              $ref: '#/components/schemas/SDLXLIFFFilter'
        - name: has_header_row
          in: header
          description: >-
            A flag indicating whether an imported Termbase CSV has a header row
            or not (the default value is `false`).
          schema:
            type: boolean
        - name: skip_duplicates
          in: header
          description: |
            A flag indicating whether or not to skip the import of segments
            which already exist in the memory. (the default value is `false`).
          schema:
            type: boolean
      requestBody:
        description: >-
          The file contents to be uploaded. The entire POST body will be treated
          as the file.
        content:
          application/octet-stream:
            schema:
              title: MemoryImportBody
              type: string
              format: binary
        required: true
      responses:
        '200':
          description: A status object.
          content:
            application/json:
              schema:
                title: MemoryImportResponse
                type: object
                properties:
                  id:
                    type: integer
                    description: A unique Memory identifier.
                    example: 123
                  isProcessing:
                    type: integer
                    description: The current state of the import.
                    example: 1
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    SDLXLIFFFilter:
      required:
        - confName
      type: object
      properties:
        confName:
          type: string
          description: the current state of the SDLXLIFF Trans Unit.
          enum:
            - Translated
            - Draft
            - ApprovedTranslation
            - Locked
            - SignedOff
        allowablePercentage:
          type: integer
          description: >-
            This represents for the current conf_name what percentage the filter
            applies to.  If you pass -1 it will take any value for this field
            and won't ignore blank values. If you pass 50, Lilt will only import
            Segments that have a 50 percent match or better.
        allowUnlockedSegments:
          type: boolean
          description: >-
            Boolean that tells Lilt whether we should allow unlocked Segments
            for this conf_name.
    Error:
      type: object
      properties:
        message:
          type: string
          description: A human-readable message describing the error.
      description: |
        Response in the event of an unexpected error.
      example:
        message: Internal server error.
  responses:
    UnauthorizedError:
      description: Unauthorized
      content:
        application/octet-stream:
          schema:
            type: string
        text/plain:
          schema:
            type: string
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
    ApiKeyAuth:
      type: apiKey
      name: key
      in: query

````