Skip to main content
Skip table of contents

Create document

Requirements

  • Authentication token

  • File hash

1. Create a document from existing file

To create a new document from an existing file, you can use the following API call:

JS
POST /documents?token=:authenticationToken

This call will create a new document, configure its basic information, and assign it to a specified folder.

Before making this call, you must first create the file and obtain its file hash.

In the body of the request, you will need to specify the following information:

  • documentType: The type of document you want to create. (e.g. "d_default")

  • documentTitle: The title of the document.

  • pdfFile: An object containing the content (file hash) of the existing file you want to use.

JS
{
    "body": {
        "documentType": "d_default",
        "documentTitle": "My Document",
        "pdfFile": {
            "content": "w3buldjaekdrigei0uaz8yahmfc1f90cco67wykfuja48uqgi60anzex9lw42sfl"   //specify existing file hash
        }
    },
    "definitionType": "ext",
    "workflow": "wf_archive",
    "optionalData": {
        "folder": "02a9cce1-e63d-47e0-b721-952df1992c45" //optional - specify to which folder document will be placed
    }
}

You can also specify folder path in following way: "path":"my_folder/nested_folder" etc…

If the folders do not exist, they will be created automatically

The response of the API call will include the ID of the newly created document:

JS
{
    "id": "d148b19a-4fa9-442e-adfd-7aa68b8eb766"
}

2. Create an eDoc document

To create a new eDoc document, you can use the following API call:

JS
POST /documents?token=:authenticationToken

This call will create a new eDoc document, configure its basic information, and assign it to a specified folder.

An eDoc document is composed of an HTML template and user inputs. The specific template used is determined by the documentType specified in the request.

In the body of the request, you will need to specify the following information:

  • documentType: The type of eDoc document you want to create. (e.g. d_integration)

  • documentTitle: The title of the document.

  • myField: A custom value for a field specific to this document definition.

JS
{
    "body": {
        "documentType": "d_integration",
        "documentTitle": "My Document",
        "myField": "Custom value" //definition specific field value
    },
    "definitionType": "edoc",
    "workflow": "wf_archive",
    "optionalData": {
        "folder": "02a9cce1-e63d-47e0-b721-952df1992c45" //optional - specify to which folder document will be placed
    }
}

The response of the API call will include the ID of the newly created document:

JS
{
    "id": "d148b19a-4fa9-442e-adfd-7aa68b8eb"
}

Please note that in both cases, an authentication token is required as a parameter in the API call. Also, the user must also specify a definitionType, documentType and workflow in order to properly configure and store the document.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.