![Laserfiche CDI Fiche Tips Blog](https://static.wixstatic.com/media/6f443f_938d3c969602476e970ee8e84372494b~mv2.jpg/v1/fill/w_980,h_526,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/6f443f_938d3c969602476e970ee8e84372494b~mv2.jpg)
By Kyle Knebel
July 2024 Consultants Corner
The Laserfiche API is a set of “RESTful Web APIs” that allow for interaction with the Laserfiche repository and can even interact with LF Cloud Lookup tables. It works in both Cloud and Self-hosted environments. For Self-hosted environments, the API is part of the Server licensing, and for Laserfiche Cloud the API is part of your subscription. With custom integrations using the API, you can extend the Laserfiche platform into other areas of your business with ease. The Laserfiche API lends itself to building “Image Enablement” solutions like viewing or adding documents to the repository or viewing or modifying metadata on entries.
In this month’s article we will examine how to download, license and start using the API. We won’t be teaching coding skills, just getting you to the point to begin your coding adventure. Let’s take a look!
For Self-Hosted environments, download and install the Laserfiche API server.
Note: If you only have a Cloud subscription this step is not necessary.
On Laserfiche’s Developer website you’ll find links and instructions to download, install and configure the API server.
The links are here: https://developer.laserfiche.com/docs/api/server/
After extracting the installer files, run “Autorun.exe” to find the Documentation and installation menu. The current version of the API is 1.1 (July 2024).
![Consultants Corner Blog CDI Laserfiche](https://static.wixstatic.com/media/6f443f_f791e34590174aa182b9cb6855799562~mv2.jpg/v1/fill/w_409,h_202,al_c,q_80,enc_auto/6f443f_f791e34590174aa182b9cb6855799562~mv2.jpg)
The locally installed Laserfiche API Server includes a Swagger Playground site for testing the various API calls available. To begin, you’ll need to obtain an access token.
Expand the Token section, and then press” the “Try it out" button on the right side. Enter the parameters, which include a repository ID (name of your repository), login name and password. Finally, press the blue “Execute” button, which (if successful) will return the access token in the response body.
![Consultants Corner Blog CDI Laserfiche](https://static.wixstatic.com/media/6f443f_ccbfbeca46ac43c5bdb4e3f48f45c173~mv2.jpg/v1/fill/w_512,h_236,al_c,q_80,enc_auto/6f443f_ccbfbeca46ac43c5bdb4e3f48f45c173~mv2.jpg)
![Consultants Corner Blog CDI Laserfiche](https://static.wixstatic.com/media/6f443f_34c3a66c0f764d7e9fc2e5cc5a503850~mv2.jpg/v1/fill/w_450,h_458,al_c,q_80,enc_auto/6f443f_34c3a66c0f764d7e9fc2e5cc5a503850~mv2.jpg)
A successful response looks like this:
![Consultants Corner Blog CDI Laserfiche](https://static.wixstatic.com/media/6f443f_5d64184620f34fac920b02e3f004ae93~mv2.jpg/v1/fill/w_736,h_225,al_c,q_80,enc_auto/6f443f_5d64184620f34fac920b02e3f004ae93~mv2.jpg)
Copy this token, scroll to the top of the page, click the Authorize button, and paste into the Bearer field:
![Consultants Corner Blog CDI Laserfiche](https://static.wixstatic.com/media/6f443f_4a5bb874d65747d2bd5b79dc5d647653~mv2.jpg/v1/fill/w_541,h_232,al_c,q_80,enc_auto/6f443f_4a5bb874d65747d2bd5b79dc5d647653~mv2.jpg)
You can now test API calls, authenticated to your self-hosted repository.
For LF Cloud solutions, there is no installation needed.
However, you will need an application to be registered in the Cloud Developer console. There are three options:
Service App: runs as a service principal
Web App: prompts for user credentials
Single page app: a web application that runs entirely in a web browser
Please review the documentation carefully (https://developer.laserfiche.com/docs/api/authentication/) and consider the best approach for your intended use and capabilities.
Your own LF Cloud account needs the Developer Privilege to build apps in the Developer console.
![Consultants Corner Blog CDI Laserfiche](https://static.wixstatic.com/media/6f443f_3ae91936345a41769b5cfc63354180bf~mv2.jpg/v1/fill/w_371,h_276,al_c,q_80,enc_auto/6f443f_3ae91936345a41769b5cfc63354180bf~mv2.jpg)
Log in with your Cloud account and navigate to the Laserfiche Developer Console in LF Cloud.
![Consultants Corner Blog CDI Laserfiche](https://static.wixstatic.com/media/6f443f_af673e54191d4d4596c0b7bba8f422a9~mv2.jpg/v1/fill/w_378,h_148,al_c,q_80,enc_auto/6f443f_af673e54191d4d4596c0b7bba8f422a9~mv2.jpg)
On the top left, select Applications, then press the green New button at the top right side of the screen.
![Consultants Corner Blog CDI Laserfiche](https://static.wixstatic.com/media/6f443f_056d7f2c4b694c95a4ea901750489975~mv2.jpg/v1/fill/w_252,h_189,al_c,q_80,enc_auto/6f443f_056d7f2c4b694c95a4ea901750489975~mv2.jpg)
Select the type of application you are going to build. Service apps need a “Service Principal Account”, which takes the place of user credentials. The other two app types will collect the user’s credentials when they run.
To create a Service Principal, if building a service-based app, navigate to the Accounts section of the Admin section.
![Consultants Corner Blog CDI Laserfiche](https://static.wixstatic.com/media/6f443f_9a6ab07b4c7e4d2aa1f0bfe413017262~mv2.jpg/v1/fill/w_404,h_139,al_c,q_80,enc_auto/6f443f_9a6ab07b4c7e4d2aa1f0bfe413017262~mv2.jpg)
Select “Add Service Principal”, give it a Username, then under Access rights Allow Access to the Repository.
![Consultants Corner Blog CDI Laserfiche](https://static.wixstatic.com/media/6f443f_67a9146096d24b528ad802306da7424d~mv2.jpg/v1/fill/w_510,h_368,al_c,q_80,enc_auto/6f443f_67a9146096d24b528ad802306da7424d~mv2.jpg)
Next, go to the Developer Console, and in the Applications area, press the green New button at the top right to begin creating your new application.
![Consultants Corner Blog CDI Laserfiche](https://static.wixstatic.com/media/6f443f_d105d704bf354f988c5eeea91077da81~mv2.jpg/v1/fill/w_513,h_207,al_c,q_80,enc_auto/6f443f_d105d704bf354f988c5eeea91077da81~mv2.jpg)
Select the app type. In this example we would choose “Service”, and then down in the Name box we would enter the name of the new application. Finally, press the green “Create application” button.
![Consultants Corner Blog CDI Laserfiche](https://static.wixstatic.com/media/6f443f_3e52799bcf8547d38257ddc377cd34c5~mv2.jpg/v1/fill/w_637,h_507,al_c,q_80,enc_auto/6f443f_3e52799bcf8547d38257ddc377cd34c5~mv2.jpg)
The next screen is App Configuration page where you will define the App’s name and set the Service Account you just created in the previous steps and set the Authentication properties.
![Consultants Corner Blog CDI Laserfiche](https://static.wixstatic.com/media/6f443f_3cf37307da2a41db844433d9051b6683~mv2.jpg/v1/fill/w_708,h_480,al_c,q_80,enc_auto/6f443f_3cf37307da2a41db844433d9051b6683~mv2.jpg)
In the Authentication tab, you’ll set two properties. The Access Key and the OAuth 2.0 properties.
A single key should be necessary. Create the key here.
![Consultants Corner Blog CDI Laserfiche](https://static.wixstatic.com/media/6f443f_176ee524157f4ce3922abb8b9f5dd173~mv2.jpg/v1/fill/w_697,h_394,al_c,q_80,enc_auto/6f443f_176ee524157f4ce3922abb8b9f5dd173~mv2.jpg)
For a Service-based app that doesn’t prompt for end-user credentials, it’s typical to select the first Access Key option.
![Consultants Corner Blog CDI Laserfiche](https://static.wixstatic.com/media/6f443f_649914a9c122434f959e77b523cd6136~mv2.jpg/v1/fill/w_631,h_659,al_c,q_85,enc_auto/6f443f_649914a9c122434f959e77b523cd6136~mv2.jpg)
Make sure the OAuth 2.0 Scopes are set appropriately for the application you will be coding and update the scopes with the green “Update scopes” button at the bottom of the screen.
![Consultants Corner Blog CDI Laserfiche](https://static.wixstatic.com/media/6f443f_ecc72b81657a469b9df81cc050843180~mv2.jpg/v1/fill/w_808,h_402,al_c,q_80,enc_auto/6f443f_ecc72b81657a469b9df81cc050843180~mv2.jpg)
Since the Authorization approach will vary depending on which application type you’ve chosen in Laserfiche Cloud, we recommend reviewing the documentation (https://developer.laserfiche.com/docs/api/authentication/) to familiarize yourself with the procedure for acquiring an access token.
So now, whether you are using a local API Server or using the LF Cloud API, you will be ready to build custom integrations with Laserfiche. We recommend using the Swagger site to explore and test the various API calls available, and consider using client libraries (which can be found here: https://developer.laserfiche.com/docs/api/libraries/) to aid in development. More information can be found on the Laserfiche Developer website here: https://developer.laserfiche.com/
Also, CDI recently posted an excellent tutorial video and tour of the Laserfiche API on our YouTube channel here: https://www.youtube.com/watch?v=3z9fFr0iUNs\
This concludes this month’s review of where to begin configuring the Laserfiche AI for use when building custom integrations. We hope you found this post informative and useful!
![Laserfiche CDI Newsletter](https://static.wixstatic.com/media/6f443f_1bf3067c9c4043f1a11fff71ecdb0a29~mv2.gif)
CDI NEWSLETTER
Stay updated with all the latest Laserfiche news, CDI webinars, blogs, and more!
Comments