Specifying folders when generating documents

When you generate documents in Inkit, by default the document is placed in your Root folder. If you want to generate a document in another folder, you must specify this folder when generating the document.

Specifying a folder in the web app

Specifying a folder when generating a document in the web app

To specify a folder when generating a document in the web app, do the following:

  1. Follow the first four steps of generating a document.

  2. In the Fill Out Destinations panel, click the Inkit Storage tab and select the folder where you want to generate the documents from the Folder dropdown box. The default is the root folder.

Specifying a folder when creating a flow

To specify a folder when creating a flow, do the following:

  1. Follow the first four steps of creating a flow.

  2. In the Inkit Storage panel, select the folder where you want to generate the documents from the Folder dropdown box. The default is the root folder.

Specifying a folder in an API request

To specify a folder when you generate a document in an Inkit API request, first copy the folder ID. To do this, in the Inkit web app click Documents in the left sidebar and then click the copy button beside the folder ID you want to copy.

Next, place the ID in the folder_id property within the inkit_storage suboject of your destinations object when you generate the document.

# Import the Inkit Python package
import inkit
from inkit.exceptions import InkitResponseException
# Import json package

# Replace the string below with your API key
inkit.api_token = "ENTER YOUR API KEY"

try:
  # Create a PDF document from a template
  resp = inkit.Render.create(
    # Specify the ID of the template
    template_id = "ENTER YOUR TEMPLATE ID",
    # Specify the data for the Name field
    merge_parameters = {"Name": "John"},
    # Specify the name and the folder ID of the PDF file
    destinations = {"inkit_storage": {"name": "Mail Merge Python SDK",
                                      "folder_id": "ENTER YOUR FOLDER ID"}}
  )
  # Print the JSON repsonse of the API call
  print(json.dumps(resp.data, indent = 3))
except InkitResponseException as err:
  # Print any error
  print(err.response.data)
// Import the Inkit Node.js package
const Inkit = require("inkit");

// Replace the string below with your API key
Inkit.apiToken = "ENTER YOUR API KEY";

// Call the  PDF renderer
createRender();

// Create a PDF document from a template
async function createRender() {
    try {
        const result = await Inkit.Render.create({
            // Specify the ID of the template
            templateId: 'ENTER YOUR TEMPLATE ID',
            // Specify the data for the Name field
            mergeParameters: {"Name": "John"},
            // Specify the name and the folder ID of the PDF file
            destinations: {"inkit_storage": {"name": "Mail Merge Node.js SDK",
                                            "folder_id": "ENTER YOUR FOLDER ID"}}
        });
        // Print the JSON response of the API call
        console.log(JSON.stringify(result.data, null, 3));
    } catch (error) {
        // Print any error
        console.error(error.response.status, error.response.statusText);
    }
}
curl --request POST \
     --url https://api.inkit.com/v1/generate \
     --header 'Content-Type: application/json' \
     --header 'X-Inkit-API-Token: ENTER YOUR API KEY' \
     --header 'accept: application/json' \
     --data '
{
  "merge_parameters": {
    "Name": "John"
  },
  "destinations": {
    "inkit_storage": {
      "name": "Mail Merge cURL",
      "folder_id": "ENTER YOUR FOLDER ID"
    }
  },
  "template_id": "ENTER YOUR TEMPLATE ID"
}
'