Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to DocuGenerate

Scalekit connector
Open markdown

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

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. 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>
  3. Create the DocuGenerate connection

    In AgentKit > Connections, create a DocuGenerate connection. The name you give it is the connection_name your code passes. See Configure connections.

  4. 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.actions
    const connector = 'docugenerate'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { 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 call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'docugenerate_templates_list',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each 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 to execute_tool
Try in PlaygroundRequest a tool
  • docugenerate_document_getGet one generated document.Read-only

    Get 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-only

    List 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-only

    Get 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-only

    List 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).Write

    Generate 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.Write

    Rename 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.Destructive

    Delete 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.Destructive

    Delete 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.