> ## Documentation Index
> Fetch the complete documentation index at: https://developers.circularo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create document

> [!WARNING]
>
> You are viewing the documentation of release 26.1, which is no longer the current one. [Go to the documentation of the current release 26.2](https://developers.circularo.com/).

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

```http theme={null}
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](https://developers.circularo.com/26.1/getting-started/basic-scenarios/create-file.md) 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.

```json theme={null}
{
    "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:

```json theme={null}
{
    "id": "d148b19a-4fa9-442e-adfd-7aa68b8eb766"
}
```

## 2. Create an eDoc document

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

```http theme={null}
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.

```json theme={null}
{
    "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:

```json theme={null}
{
    "id": "d148b19a-4fa9-442e-adfd-7aa68b8eb"
}
```

> [!NOTE]
>
> 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.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.