Import a Document

Documents, folders, and shortcuts are collectively referred to as entries in Laserfiche. Documents are the basic building block of a Laserfiche repository. Create a document with the Laserfiche API by using the following multipart/form POST reqest.

Request Overview

POST https://api.laserfiche.com/repository/v1/Repositories/repoID/Entries/parentfolderid/documentName

The following multipart/form request creates a document named "LFAPI created document" in the folder with ID 1234 and assigns two field values and a tag to the document. Additionally, we will provide a file that corresponds to the .pdf file we want to associate with the entry. Place the file into the web requests "electronicDocument" portion of the form, and place the metadata setting portion of the request into the "request" part of the form.

POST https://api.laserfiche.com/repository/v1/Repositories/r-abc123/Entries/1234/lfapi%20created%20doc?autoRename=true
{
  "template": "Email",
  "metadata": {
    "fields": {
      "Sender": {
        "values": [
          {
            "value": "sender@laserfiche.com",
            "position": 1
          }
        ]
      },
      "Recipients": {
        "values": [
          {
            "value": "recipient@laserfiche.com",
            "position": 1
          }
        ]
      }
    },
    "tags": [
      "Information tag 1"
    ]
  }
}
===================
electronicDocument=<File.pdf>
===================

If the document was created successfully, the API will return a 201 HTTP response status code. The response body will contain a list of the operations performed during the call and any exceptions if the specified metadata could not be assigned to the document, as well as a link to the document. Any errors with the assignment of the electronic document will be returned in the "setEdoc" operation portion of the response.

HTTP 201 Created
{
  "operations": {
    "entryCreate": {
      "entryId": 4321,
      "exceptions": []
    },
    "setEdoc": {
      "exceptions": []
    },
    "setTemplate": {
      "template": "Email",
      "exceptions": []
    },
    "setFields": {
      "fieldCount": 2,
      "exceptions": []
    },
    "setTags": {
      "assignedTags": [
        "Information tag 1"
      ],
      "exceptions": []
    }
  },
  "documentLink": "https://api.laserfiche.com/repository/v1/Repositories/r-abc123/Entries/4321"
}