The DocuGenerate connector lets your AI agent act in each user's DocuGenerate account. Each user connects their own DocuGenerate API key once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 8 tools.
- Tools
- 8
- What they doRead · write · destructive
- 4 · 2 · 24 read2 write2 destructive
- Users sign in with
- API key
Setup
Install the SDK
Terminal window npm install @scalekit-sdk/node dotenvTerminal window pip install scalekit-sdk-python python-dotenvSet your credentials
Add your Scalekit credentials to your
.envfile. Find values in app.scalekit.com > Developers > API Credentials..env SCALEKIT_ENVIRONMENT_URL=<your-environment-url>SCALEKIT_CLIENT_ID=<your-client-id>SCALEKIT_CLIENT_SECRET=<your-client-secret>Create the DocuGenerate connection
In AgentKit > Connections, create a DocuGenerate connection. The name you give it is the
connection_nameyour code passes. See Configure connections.Authorize a user and make your first call
quickstart.mts import { ScalekitClient } from '@scalekit-sdk/node'import 'dotenv/config'import { createInterface } from 'node:readline/promises'const scalekit = new ScalekitClient(process.env.SCALEKIT_ENVIRONMENT_URL,process.env.SCALEKIT_CLIENT_ID,process.env.SCALEKIT_CLIENT_SECRET,)const actions = scalekit.actionsconst connector = 'docugenerate'const identifier = 'user_123'// Generate an authorization link for the userconst { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })console.log('Authorize DocuGenerate:', link)const rl = createInterface({ input: process.stdin, output: process.stdout })await rl.question('Press Enter after authorizing...')rl.close()// Make your first callconst result = await actions.executeTool({connector,identifier,toolName: 'docugenerate_templates_list',toolInput: {},})console.log(result)Terminal window npx tsx quickstart.mtsquickstart.py import osfrom scalekit import ScalekitClientfrom dotenv import load_dotenvload_dotenv()scalekit_client = ScalekitClient(env_url=os.getenv("SCALEKIT_ENVIRONMENT_URL"),client_id=os.getenv("SCALEKIT_CLIENT_ID"),client_secret=os.getenv("SCALEKIT_CLIENT_SECRET"),)actions = scalekit_client.actionsconnection_name = "docugenerate"identifier = "user_123"# Generate an authorization link for the userlink_response = actions.get_authorization_link(connection_name=connection_name,identifier=identifier,)print("Authorize DocuGenerate:", link_response.link)input("Press Enter after authorizing...")# Make your first callresult = actions.execute_tool(tool_input={},tool_name="docugenerate_templates_list",connection_name=connection_name,identifier=identifier,)print(result)Terminal window python quickstart.pyEach user opens the link once and enters their DocuGenerate credentials there. See Authorize a user for the full flow and statuses.
Tools
Pass the exact name toexecute_tooldocugenerate_document_getGet one generated document.Read-onlyGet Document
Get one generated document. Returns its name, template id, format, page count, document_uri (download link) and creation time. Use documents_list to find document IDs.
Inputs
document_idstringrequired- ID of the generated document. Get it from documents_list or document_generate. Example: Ap7rKq2LmX9sWzT4vBnD.
docugenerate_documents_listList the documents generated from a template, newest first.Read-onlyList Documents
List the documents generated from a template, newest first. Returns each document's id, name, format, page count, document_uri and creation time. Use document_get for one document.
Inputs
template_idstringrequired- ID of the template that was used to generate the documents. Example: hW9ZqkxGm2vSfX4LbNcE.
docugenerate_template_getGet one template.Read-onlyGet Template
Get one template. Returns its name, format, tags (the fields to fill), delimiters, folder, preview and file URLs. Use its tags as the keys of data in document_generate.
Inputs
template_idstringrequired- ID of the template. Get it from templates_list. Example: hW9ZqkxGm2vSfX4LbNcE.
docugenerate_templates_listList your document templates, newest first, optionally filtered by folder.Read-onlyList Templates
List your document templates, newest first, optionally filtered by folder. Returns each template's id, name, format, tags, folder, region and creation time. Use template_get for one template's tags.
Inputs
folderarray- Filter templates by folder, defined as an ordered array of folder names from root to leaf.For example, ?folder=Legal&folder=Contracts returns templates from the Legal > Contracts folder. Example: ["Legal", "Contracts"]
docugenerate_document_generateGenerate one or more documents from a template by filling its tags with data (one document per data object, or all combined with single_file).WriteGenerate Document
Generate one or more documents from a template by filling its tags with data (one document per data object, or all combined with single_file). Returns the document id, name, page count and document_uri to download the file. Use template_get to see which tags the data needs.
Inputs
dataarrayrequired- Array of objects whose keys match the template's tags; one document is generated per object (or one combined file with single_file). A single object also works. Example: [{"Name": "Jane Doe", "Address": "500 Market St"}].
template_idstringrequired- ID of the template to fill. Get it from templates_list. Example: hW9ZqkxGm2vSfX4LbNcE.
attachstring- File(s) to be attached to the generated document, specified as a URL or a Base64-encoded data URI, or an array of such values.If a URL is provided, the filename will be automatically determined from the URL.If a data URI is used, the filename can be specified with the name property in the URI (e.g., data:text/xml;name=invoice.xml;base64,...).If no filename is specified in the data URI, the file will be named attachment with an extension matching... Example: https://example.com/invoice.xml.
merge_withstring- PDF file(s) to be merged at the end of the generated document, specified as a URL or a Base64-encoded data URI, or an array of such values.If any document specified by a URL is not found or is not a PDF file, then that file will be ignored.If the flag single_file is false, then the PDF file(s) are merged at the end of each generated document.If multiple files are provided, they will be merged in the order they appear in the array.This parameter... Example: https://example.com/terms.pdf.
namestring- The document’s name. If not provided, it will be initialized with the template’s name.This is a logical name for identifying the document and is different from the output_name which specifies the filename of the generated document. Example: Offer letters.
output_formatstring- Output format of the generated document. If no format is specified, then the default format is .docx.The supported formats are .docx, .doc, .odt, .txt, .html, .png, .pdf, .pdf/a-1b, .pdf/a-2b and .pdf/a-3b.If the format is .png, then only the first page is exported. This is useful for generating document thumbnails for example.The .pdf/a-1b, .pdf/a-2b and .pdf/a-3b formats allow selecting the PDF/A version for archival purposes. Example: .pdf.one of
.docx.doc.odt.txt.html.png.pdf.pdf/a-1b.pdf/a-2b.pdf/a-3b output_namestring- The filename without extension of the generated document. If not provided, it will be initialized based on the document’s name.For example, if output_name=invoice and output_format=.pdf then the filename of the generated document will be invoice.pdf. Example: offer-letter-jane-doe.
output_qualityinteger- Specifies the quality of the generated document if output_format is .pdf (or a PDF/A version) or .png. A higher value results in higher quality and file size.The lower the value, the less good is the image compression quality and the bigger is the file size. The minimum value is 1.The higher the value, the better is the image compression quality and the smaller is the file size. The maximum value is 100, which is also the default. Example: 100.
page_breakboolean- Flag indicating whether to add a page break in the document after each data row. The default value is true.The flag only applies if single_file is true. Example: true.
single_fileboolean- If the flag is true, then all the generated documents will be combined in a single file with the output_format format.If the flag is false, then for each data item a separate document will be generated with the output_format format and the all the files will be included in a .zip archive.The flag is ignored if there is only one data item, so to generate a .zip archive multiple data items are required. By default, the flag value is true. Example: true.
docugenerate_document_updateRename a generated document.WriteRename Document
Rename a generated document. Returns the updated document. Only the name can change.
- Idempotent
Inputs
document_idstringrequired- ID of the generated document. Get it from documents_list or document_generate. Example: Ap7rKq2LmX9sWzT4vBnD.
namestringrequired- The document’s name. Example: Offer letter - Jane Doe.
docugenerate_document_deleteDelete a generated document and its file.DestructiveDelete Document
Delete a generated document and its file. Returns the result. This cannot be undone.
- Idempotent
Inputs
document_idstringrequired- ID of the generated document. Get it from documents_list or document_generate. Example: Ap7rKq2LmX9sWzT4vBnD.
docugenerate_template_deleteDelete a template.DestructiveDelete Template
Delete a template. Returns the result. Documents already generated from it are kept.
- Idempotent
Inputs
template_idstringrequired- ID of the template. Get it from templates_list. Example: hW9ZqkxGm2vSfX4LbNcE.
No tools match.