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

# Upload a File

> Create a Document from a file in any of the formats [documented in our knowledge base](/kb/supported-file-formats).
Request parameters should be passed as JSON object with the header field `LILT-API`.

File names in the header can only contain [US-ASCII characters](https://en.wikipedia.org/wiki/ASCII). File names with characters outside of US-ASCII should be [URI encoded](https://en.wikipedia.org/wiki/Percent-encoding) or transliterated to US-ASCII strings.

Example CURL command:
```bash
  curl -X POST https://api.lilt.com/v2/documents/files?key=API_KEY \
  --header "LILT-API: {\"name\": \"introduction.xliff\",\"pretranslate\": \"tm+mt\",\"project_id\": 9}" \
  --header "Content-Type: application/octet-stream" \
  --data-binary @Introduction.xliff
```





## OpenAPI

````yaml /api-reference/openapi-bundled.yaml post /v2/documents/files
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/documents/files:
    post:
      tags:
        - Documents
      summary: Upload a File
      description: >+
        Create a Document from a file in any of the formats [documented in our
        knowledge base](/kb/supported-file-formats).

        Request parameters should be passed as JSON object with the header field
        `LILT-API`.


        File names in the header can only contain [US-ASCII
        characters](https://en.wikipedia.org/wiki/ASCII). File names with
        characters outside of US-ASCII should be [URI
        encoded](https://en.wikipedia.org/wiki/Percent-encoding) or
        transliterated to US-ASCII strings.


        Example CURL command:

        ```bash
          curl -X POST https://api.lilt.com/v2/documents/files?key=API_KEY \
          --header "LILT-API: {\"name\": \"introduction.xliff\",\"pretranslate\": \"tm+mt\",\"project_id\": 9}" \
          --header "Content-Type: application/octet-stream" \
          --data-binary @Introduction.xliff
        ```

      operationId: uploadDocument
      parameters:
        - name: name
          in: header
          description: A file name.
          required: true
          schema:
            type: string
        - name: project_id
          in: header
          description: A unique Project identifier.
          required: true
          schema:
            type: integer
        - name: pretranslate
          in: header
          description: |
            An optional parameter indicating if and how the document will be
            pretranslated upon being uploaded.
            The accepted values are `TM`, or `TM+MT`
          schema:
            type: string
        - name: auto_accept
          in: header
          description: >
            An optional parameter to auto-accept segments with 100% translation

            memory matches when the `pretranslate` option is also set, or to

            auto-accept any target data that is present when the uploaded file

            is XLIFF. If omitted it will default to your organization settings
            for `Accept and lock exact matches`,

            if set to `false`, no segments will be auto-accepted.
          schema:
            type: boolean
        - name: case_sensitive
          in: header
          description: >
            An optional parameter to use case sensitive translation memory
            matching when the `pretranslate`

            option is also enabled. Matches must have identical
            character-by-character case to qualify as matches.

            Default value matches your organization settings for `Use case
            sensitive translation memory matching` setting
          schema:
            type: boolean
        - name: match_attribution
          in: header
          description: >
            An optional parameter to attribute translation authorship of exact
            matches to the author of the file

            when the `pretranslate` option is also enabled. Default value
            matches your organization settings for `Translation authorship`
            setting
          schema:
            type: boolean
        - name: config_id
          in: header
          description: |
            An optional pararameter to specify an import configuration to
            be applied when extracting translatable content from this file.
          schema:
            type: integer
      requestBody:
        description: |
          The file contents to be uploaded. The entire POST body will be
          treated as the file.
        content:
          application/octet-stream:
            schema:
              title: DocumentUploadBody
              type: string
              format: binary
              example: |-
                <?xml version="1.0" encoding="UTF-8" standalone="no"?>
                <xliff xmlns="urn:oasis:names:tc:xliff:document:1.2">
                ...
                </xliff>
        required: true
      responses:
        '200':
          description: A Document object.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentWithSegments'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    DocumentWithSegments:
      type: object
      properties:
        id:
          type: integer
          description: A unique number identifying the Document.
          example: 46530
        project_id:
          type: integer
          description: A unique number identifying the Project.
          example: 287
        srclang:
          type: string
          description: An ISO 639-1 language identifier.
          example: en
        trglang:
          type: string
          description: An ISO 639-1 language identifier.
          example: de
        name:
          type: string
          description: The document name.
          example: Introduction.xliff
        import_in_progress:
          type: boolean
          description: True if the document is currently being imported
          example: false
        import_succeeded:
          type: boolean
          description: True if the import process succeeded.
          example: false
        import_error_message:
          type: string
          description: Error message if `import_succeeded=false`
          example: Could not parse XML.
        export_in_progress:
          type: boolean
          description: True if the document is currently being exported for download
          example: false
        export_succeeded:
          type: boolean
          description: True if the export process succeeded.
          example: false
        export_error_message:
          type: string
          description: Error message if `export_succeeded=false`
          example: Could not parse XML.
        is_pretranslating:
          type: boolean
          description: True if the document is currently being pretranslated.
          example: false
        status:
          type: object
          properties:
            pretranslation:
              type: string
              description: ''
              example: idle
              enum:
                - idle
                - pending
                - running
          description: A list of translations for the query term.
          example:
            pretranslation: idle
        translator_email:
          type: string
          description: The email of the assigned translator.
          example: translator@example.com
        reviewer_email:
          type: string
          description: The email of the assigned reviewer.
          example: reviewer@example.com
        created_at:
          type: integer
          description: >-
            Time at which the object was created. Measured in seconds since the
            Unix epoch.
          example: 1489147692
        updated_at:
          type: integer
          description: >-
            Time at which the object was created. Measured in seconds since the
            Unix epoch.
          example: 1489147692
        is_review_complete:
          type: boolean
          description: Document review status.
          example: true
        segments:
          type: array
          description: A list of Segments.
          items:
            $ref: '#/components/schemas/Segment'
      description: |
        A Document is a collection of zero or more Segments.
    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.
    Segment:
      type: object
      properties:
        id:
          type: integer
          format: int64
          description: A unique number identifying the Segment.
          example: 84480010
        created_at:
          type: integer
          description: >-
            Time at which the object was created. Measured in seconds since the
            Unix epoch.
          example: 1489147692
        updated_at:
          type: integer
          description: >-
            Time at which the object was created. Measured in seconds since the
            Unix epoch.
          example: 1489147692
        document_id:
          type: integer
          description: A unique Document identifier.
          example: 1234
        memory_id:
          type: integer
          description: The Memory with which this Segment is associated.
          example: 5678
        source:
          type: string
          description: The source string.
          example: The red bus.
        srclang:
          type: string
          description: An ISO 639-1 language code.
          example: en
        target:
          type: string
          description: The target string.
          example: Le bus rouge.
        trglang:
          type: string
          description: An ISO 639-1 language code.
          example: fr
        is_confirmed:
          type: boolean
          description: The confirmation status.
          example: true
        is_reviewed:
          type: boolean
          description: The review status.
          example: true
      description: >
        A Segment is a source string and, optionally, its translation. A Segment
        can be associated with both a Memory and a Document. The Segment object
        contains additional metadata about the source and target strings.
  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

````