Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to Draftable

Scalekit connector
Open markdown

The Draftable connector lets your AI agent act in each user's Draftable account. Each user connects their own Draftable API key once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 6 tools.

Tools
6
What they doRead · write · destructive
3 · 2 · 13 read2 write1 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 Draftable connection

    In AgentKit > Connections, create a Draftable 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 = 'draftable'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Draftable:', 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: 'draftable_comparisons_list',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user opens the link once and enters their Draftable 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
  • draftable_comparison_getGet one comparison and its processing state.Read-only

    Get Comparison

    Get one comparison and its processing state. Returns identifier, left and right documents, public, creation_time, expiry_time, ready, ready_time, failed and error_message. Poll this after Create Comparison until ready is true.

    Inputs

    identifierstringrequired
    Identifier of the comparison, from List Comparisons or Create Comparison. Example: uCtUqmYb.
  • draftable_comparisons_listList all comparisons in the Draftable account.Read-only

    List Comparisons

    List all comparisons in the Draftable account. Returns comparisons with identifier, left and right documents, public, creation_time, expiry_time, ready, failed and error_message. Use this to find a comparison identifier. Use Get Comparison for one.

    Inputs

    This tool takes no inputs.

  • draftable_export_getGet an export and its status.Read-only

    Get Export

    Get an export and its status. Returns identifier, comparison, kind, ready, failed and url, a signed link to download the PDF once ready. Poll this after Create Export until ready is true.

    Inputs

    identifierstringrequired
    Identifier of the export, from Create Export. Example: Hk2mPq9z.
  • draftable_comparison_createCompare two documents (PDF, Word, PowerPoint or text) that Draftable downloads from URLs.Write

    Create Comparison

    Compare two documents (PDF, Word, PowerPoint or text) that Draftable downloads from URLs. Returns the new comparison with identifier, ready false and the document details; it is usually ready within seconds. Use Get Comparison to poll. View it at https://api.draftable.com/v1/comparisons/viewer/<account_id>/<identifier> (private comparisons need a signed URL).

    Inputs

    left_file_typestringrequired
    File type of the left document: pdf, docx, docm, doc, rtf, pptx, pptm, ppt or txt. Example: pdf.one of pdfdocxdocmdocrtfpptxpptmppttxt
    left_source_urlstringrequired
    URL Draftable downloads the left document from (a public or one-time signed URL). Example: https://api.draftable.com/static/test-documents/paper/left.pdf.
    right_file_typestringrequired
    File type of the right document: pdf, docx, docm, doc, rtf, pptx, pptm, ppt or txt. Example: pdf.one of pdfdocxdocmdocrtfpptxpptmppttxt
    right_source_urlstringrequired
    URL Draftable downloads the right document from (a public or one-time signed URL). Example: https://api.draftable.com/static/test-documents/paper/right.pdf.
    expiry_timestring
    ISO 8601 time when the comparison is deleted automatically; never when empty. Example: 2025-02-15T00:00:00Z.
    identifierstring
    Optional custom identifier, unique in the account (reusable after the comparison is deleted). Example: contract-2025-v1-v2.
    left_display_namestring
    Name shown for the left document in the viewer. Example: Contract v1.
    publicboolean
    Set true to let anyone with the viewer URL see the comparison; private (false) is the default. Example: false.
    right_display_namestring
    Name shown for the right document in the viewer. Example: Contract v1.
  • draftable_export_createExport a ready comparison as a PDF: single_page (right document with changes marked), combined (both documents interleaved), left or right only.Write

    Create Export

    Export a ready comparison as a PDF: single_page (right document with changes marked), combined (both documents interleaved), left or right only. Returns the export with identifier, comparison, kind, ready, failed and url (empty until ready). Use Get Export to poll for the download URL.

    Inputs

    comparisonstringrequired
    Identifier of the comparison to export. Example: uCtUqmYb.
    kindstringrequired
    Export kind: single_page, combined, left or right. Example: single_page.one of single_pagecombinedleftright
  • draftable_comparison_deleteDelete a comparison.Destructive

    Delete Comparison

    Delete a comparison. Its identifier can then be reused. Returns an empty 204 response. Use List Comparisons to find the identifier.

    • Idempotent

    Inputs

    identifierstringrequired
    Identifier of the comparison, from List Comparisons or Create Comparison. Example: uCtUqmYb.