OpenKM has a complete API exposed via REST. This means you can call any of these API methods from any programming language, like Java, PHP or Python among others.  This feature makes it possible to create a custom client, or integrate with third-party applications like a CRM or a CMS.

These URLs are protected by BASIC authentication so you need to provide an user and password to access them.

You can extend the REST API. More information at Creating your own Rest Plugin ( extending REST API ).

We encourage using our SDK's for accessing OpenKM across REST API rather than you build your own client, more information:

On almost samples you'll see parameters named "docId", "fldId" or "nodeId". The value of this parameter can be a valid node UUID ( from version 7.x we have deprecated almost methods where path can be used ).

Example of nodeId:

  • Using UUID -> "f123a950-0329-4d62-8328-0ff500fd42db";
  • Using path -> "/okm:root/logo.png"

Almost all samples use the command curl, more information at curl tutorial with examples of usage.

Sample usage

To try these API methods you can use an HTTP Client library or any REST client which ease this process. Or simply you can use the curl command-line application. For example, you can list the children folders:

$ curl -u okmAdmin:admin -H "Accept: application/json" \

The result is:

    "@type": "folder",
    "created": 1568408949000,
    "lastModified": 1568409037000,
    "path": "/okm:root/test/test",
    "author": "okmAdmin",
    "permissions": 31,
    "uuid": "0fd9f008-27e8-4980-a22b-d71c9a34060a",
    "parent": "de7b07c2-e707-4390-b5cc-cae340c8c3e5",
    "subscribed": false,
    "nodeClass": 0,
    "dispositionCurrentStage": 0,
    "subscriptors": [],
    "keywords": [],
    "categories": [],
    "notes": [],
    "linkTarget": null,
    "actualVersion": {
      "name": "1.1",
      "created": 1568409037000,
      "size": 0,
      "author": "okmAdmin",
      "actual": true,
      "comment": null,
      "checksum": null,
      "action": "PROPERTY_GROUP_ADDED",
      "params": "okg:consulting",
      "uuid": null,
      "parent": "0fd9f008-27e8-4980-a22b-d71c9a34060a"
    "promotedAsRecord": false,
    "hasRelations": false,
    "description": null,
    "restricted": false,
    "nodeClassChildren": [],
    "metadataLabel": null,
    "hasChildren": false,
    "style": 0

In this case you can see the result in JSON format.

This is a Java client for the same call:  

package com.openkm;


public class JavaRestClient {

    public static void main(String[] args) throws Exception {
        try {
            String fldUuid = "de7b07c2-e707-4390-b5cc-cae340c8c3e5";
            URL url = new URL("http://localhost:8080/openkm/rest/folders/" + fldUuid + "/children");
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setRequestProperty("Accept", "application/json");

            Authenticator.setDefault(new Authenticator() {
                protected PasswordAuthentication getPasswordAuthentication() {
                    return new PasswordAuthentication("okmAdmin", "admin".toCharArray());

            if (conn.getResponseCode() == 200) {
                BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream())));
                System.out.println("Output from Server .... \n");
                String output;

                while ((output = br.readLine()) != null) {
            } else {
                System.err.println("Failed : HTTP error code : " + conn.getResponseCode());

        } catch (MalformedURLException e) {
        } catch (IOException e) {

Folder samples

Create a new folder:

 $ curl -u okmAdmin:admin -H "Accept: application/json" \
   -X POST -H "Content-Type: application/json" -d 'newfolder' \

Document samples

To create a document, we need to provide the document binary data:

$ curl -u okmAdmin:admin -H "Accept: application/json" \
   -X POST -F content=newDoc.txt -F content=@/home/openkm/doc1.txt \

Or also from a HTML form:

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document Upload</title>
    <form method="POST" enctype="multipart/form-data"
      Select file: <input type="file" name="content" size="45"/><br/>
      <input type="submit" value="Upload" />

And now download it:  

$ curl -u okmAdmin:admin \

Search samples

Search with parameters:

$ curl -u okmAdmin:admin -H "Accept: application/json" -X GET \

Search with metadata:

$ curl -u okmAdmin:admin -H "Accept: application/json" -X GET \

Security samples

Show granted users:

$ curl -u okmAdmin:admin -H "Accept: application/json" -X GET \

Show granted roles:

$ curl -u okmAdmin:admin -H "Accept: application/json" -X GET \

Add a grant:

$ curl -v -u okmAdmin:admin -X POST -H "Content-Type: application/x-www-form-urlencoded" \
  -d userId=sochoa -d permissions=15 -d recursive=false \

Revoke a grant:

$ curl -v -u okmAdmin:admin -X DELETE -H "Content-Type: application/x-www-form-urlencoded" \
  -d permissions=15 -d recursive=false \

Metadata samples

The metadata group definition used in the samples:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 2.0//EN"
  <property-group label="Consulting" name="okg:consulting">
    <input label="Name" type="text" name="" >
      <validator type="req"/>            
    <textarea label="Comment" name="okp:consulting.comment" >
      <validator type="req"/>

Add a metadata group:

$ curl -u okmAdmin:admin -H "Accept: application/json"  \

  -X POST -H "Content-type: application/json"
 -d '{"properties":[{"name":"okp:consulting.comment","value":"new comment"},{"name":"","value":"new name"},{"name":"","value":"20190917163517"}],"grpName":"okg:consulting"}' \


Set metadata group values:

$ curl -u okmAdmin:admin -H "Accept: application/json" \
  -X PUT -H "Content-Type: application/json" \
  -d '[{"name":"okp:consulting.comment","value":"set comment"},{"name":"","value":"set name"},{"name":"","value":"20190917164717"}]' \

Notes samples

Create a note:

 $ curl -u okmAdmin:admin -H "Accept: application/json" \
   -X POST -H "Content-Type: application/x-www-form-urlencoded" -d 'text=Hello, world!' \

Conversion samples

With conversion feature from the OpenKM API, you can convert, for example, a document from MS Office Word format to PDF, among other conversion types available.

Convert a doc file to pdf:

$ curl -u okmAdmin:admin -F content=@sample.doc -o sample.pdf \

Or also from a HTML form:

    <form method="POST" enctype="multipart/form-data"
      Select file: <input type="file" name="content" size="45"/><br/>
      <input type="submit" value="Convert" />

Convert a doc file to txt:

$ curl -u okmAdmin:admin -F content=@sample.doc http://localhost:8080/openkm/rest/conversion/doc/txt

Convert an image file to txt:

$ curl -u okmAdmin:admin -F content=@sample.tif http://localhost:8080/rest/rest/conversion/img/txt