Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to PDF.co

Scalekit connector
Open markdown

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

Tools
39
What they doRead · write · destructive
5 · 34 · 05 read34 write0 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 PDF.co connection

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

    Each user opens the link once and enters their PDF.co 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
  • pdfco_get_credit_balanceGet the number of PDF.co credits left on the account.Read-only

    Get Credit Balance

    Get the number of PDF.co credits left on the account. Returns remainingCredits. Use pdfco_get_credit_balance before large jobs or when a call fails with HTTP 402 (not enough credits).

    Inputs

    This tool takes no inputs.

  • pdfco_get_document_parser_templateGet one Document Parser template by ID, including its full definition.Read-only

    Get Document Parser Template

    Get one Document Parser template by ID, including its full definition. Returns id, type, title, description, created_at, updated_at and body (the template definition text). Use pdfco_get_document_parser_template to inspect or copy a template before calling pdfco_parse_document. Use pdfco_list_document_parser_templates to find IDs.

    Inputs

    template_idstringrequired
    ID of the Document Parser template, from pdfco_list_document_parser_templates. Example: 1.
  • pdfco_get_presigned_upload_urlCreate a temporary presigned upload link for a local file; this tool does not upload anything.Read-only

    Get Presigned Upload URL

    Create a temporary presigned upload link for a local file; this tool does not upload anything. The caller then sends the file bytes with an HTTP PUT to presignedUrl (with the same Content-Type), and uses the returned url as the input URL for other PDF.co tools. Returns presignedUrl (PUT target, valid about 15 minutes), url (the link to pass to other tools once uploaded, valid about an hour), name and credits. Use pdfco_get_presigned_upload_url when the source file is not already at a public URL. Files up to 2 GB can be uploaded; process them with async true.

    Inputs

    namestringrequired
    File name for the upload, with extension. Example: contract.pdf.
    contenttypestring
    MIME type the file will be uploaded with; send the same Content-Type header in the PUT. Defaults to application/octet-stream. Example: application/pdf.
  • pdfco_list_document_parser_templatesList the Document Parser templates available to the account, both PDF.co system templates and your own.Read-only

    List Document Parser Templates

    List the Document Parser templates available to the account, both PDF.co system templates and your own. Returns templates, each with id, type (system or user), title and description. Use pdfco_list_document_parser_templates to find a template_id for pdfco_parse_document. Use pdfco_get_document_parser_template to read one template's definition.

    Inputs

    This tool takes no inputs.

  • pdfco_list_html_templatesList the HTML-to-PDF templates available to the account: PDF.co's system templates and your own.Read-only

    List HTML Templates

    List the HTML-to-PDF templates available to the account: PDF.co's system templates and your own. Returns templates, each with id, title, description, type (system or user), test_json (sample data) and updated_at. Use pdfco_list_html_templates to find a template_id and sample data for pdfco_html_template_to_pdf.

    Inputs

    This tool takes no inputs.

  • pdfco_add_passwordEncrypt a PDF with an owner and/or user password and set what readers may do: print, copy, edit, fill forms, annotate, assemble pages or extract for accessibility.Write

    Add Password to PDF

    Encrypt a PDF with an owner and/or user password and set what readers may do: print, copy, edit, fill forms, annotate, assemble pages or extract for accessibility. Returns url (a temporary link to the output file, valid for expiration minutes), pageCount, credits and remainingCredits; with async it returns jobId and the reserved url to read once pdfco_check_job reports success. Use pdfco_add_password to protect or restrict a PDF. Use pdfco_remove_password to unlock one.

    Inputs

    urlstringrequired
    Public URL of the source PDF. PDF.co downloads the file from this URL, so it must be reachable without a login: a direct link, a PDF.co temporary file URL from an earlier result, or a presigned upload URL from pdfco_get_presigned_upload_url. Each input file can be up to 100 MB. Prefix with cache: (cache:https://...) to let PDF.co reuse a file it already downloaded. Example: https://pdfco-test-files.s3.us-west-2.amazonaws.com/password-protect/sample.pdf.
    allow_accessibility_supportboolean
    Set false to prohibit content extraction for accessibility tools. Defaults to true (allowed).
    allow_assembly_documentboolean
    Set false to prohibit inserting, deleting or rotating pages. Defaults to true (allowed).
    allow_content_extractionboolean
    Set false to prohibit copying text and images. Defaults to true (allowed).
    allow_fill_formsboolean
    Set false to prohibit filling form and signature fields. Defaults to true (allowed).
    allow_modify_annotationsboolean
    Set false to prohibit adding or changing annotations and form fields. Defaults to true (allowed).
    allow_modify_documentboolean
    Set false to prohibit editing the document. Defaults to true (allowed).
    allow_print_documentboolean
    Set false to prohibit printing. Defaults to true (allowed).
    asyncboolean
    Set true to run the job in the background: the call returns a jobId and reserved output url at once; poll pdfco_check_job until status is success. Scalekit stops waiting after 10 seconds, so use true for large or many-page files.
    encryption_algorithmstring
    Encryption algorithm. Defaults to AES_128bit; AES_128bit or AES_256bit is recommended.one of RC4_40bitRC4_128bitAES_128bitAES_256bit
    expirationinteger
    Minutes until the output URL expires and the file is deleted from PDF.co temporary storage. Defaults to 60; the maximum depends on your PDF.co plan. Example: 120.
    namestring
    File name for the generated output file. Example: protected.pdf.
    owner_passwordstring
    Owner password, needed to change or remove the restrictions. Example: OwnerPass123.
    print_qualitystring
    Allowed print quality when printing is allowed. Defaults to HighResolution.one of LowResolutionHighResolution
    user_passwordstring
    User password that readers must enter to open the PDF. Leave empty to allow opening without a password (restrictions still apply). Example: ReadPass123.
  • pdfco_add_to_pdfEdit a PDF by drawing text, stamping images (logos, signatures) and adding new fillable fields or checkboxes at given coordinates, and optionally filling existing form fields in the same call.Write

    Add Text, Images and Fields to PDF

    Edit a PDF by drawing text, stamping images (logos, signatures) and adding new fillable fields or checkboxes at given coordinates, and optionally filling existing form fields in the same call. Returns url (a temporary link to the output file, valid for expiration minutes), pageCount, credits and remainingCredits; with async it returns jobId and the reserved url to read once pdfco_check_job reports success. Use pdfco_add_to_pdf to annotate, stamp, sign or build a form. Use pdfco_fill_pdf_form when you only need to fill existing fields, and pdfco_replace_text to change existing words. Provide at least one of annotations, images or fields.

    Inputs

    urlstringrequired
    Public URL of the source PDF. PDF.co downloads the file from this URL, so it must be reachable without a login: a direct link, a PDF.co temporary file URL from an earlier result, or a presigned upload URL from pdfco_get_presigned_upload_url. Each input file can be up to 100 MB. Prefix with cache: (cache:https://...) to let PDF.co reuse a file it already downloaded. Example: https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-edit/sample.pdf.
    annotationsarray
    Text objects or new form fields to draw. Each object needs text, x and y (points from the top-left corner); optional: pages (0-based ranges), type (text, textField, TextFieldMultiline or checkbox for a new fillable field, with an id), size, color (#RRGGBB or #AARRGGBB), fontName, fontBold, fontUnderline, fontStrikeout, width, height, alignment (left, center, right), link and RotationAngle. Use {{$$newLine}} or \n for line breaks and {{$$PageNumber}} for page numbers. Example: [{"text": "APPROVED", "x": 400, "y": 30, "size": 24, "color": "#FF0000", "pages": "0"}].
    asyncboolean
    Set true to run the job in the background: the call returns a jobId and reserved output url at once; poll pdfco_check_job until status is success. Scalekit stops waiting after 10 seconds, so use true for large or many-page files.
    expirationinteger
    Minutes until the output URL expires and the file is deleted from PDF.co temporary storage. Defaults to 60; the maximum depends on your PDF.co plan. Example: 120.
    fieldsarray
    Existing form fields to fill. Each object needs fieldName (the exact name from pdfco_get_pdf_form_fields) and text (the value; for a checkbox use true, X or 1 to tick it; for a radio button or combo box use the item value or index). Optional: pages, size, fontName, fontBold, fontItalic, fontUnderline, fontStrikeout. Example: [{"fieldName": "topmostSubform[0].Page1[0].f1_02[0]", "text": "John"}, {"fieldName": "topmostSubform[0].Page1[0].c1_1[0]", "text": "true"}].
    imagesarray
    Images or PDF pages to place on top of the document, such as a logo or signature image. Each object needs url (public image or PDF link, or a data URI), x and y; optional: width, height, pages (0-based ranges), link and keepAspectRatio (default true). Example: [{"url": "https://example.com/signature.png", "x": 400, "y": 700, "width": 120, "pages": "!0"}].
    namestring
    File name for the generated output file. Example: edited.pdf.
    passwordstring
    Password to open the source PDF, if it is password-protected. Example: s3cret.
    profilesstring
    Advanced settings as a JSON-encoded string. Examples: {"FlattenDocument()": []} makes the result read-only; {"Pages[0].SetCropBox()": ["28", "28", "539", "786"]} crops page 1. See https://developer.pdf.co/api/profiles.
  • pdfco_auto_rotate_pagesDetect the text orientation of each page with AI/OCR and rotate sideways or upside-down pages upright, typically for scans.Write

    Auto-rotate PDF Pages

    Detect the text orientation of each page with AI/OCR and rotate sideways or upside-down pages upright, typically for scans. Returns url (a temporary link to the output file, valid for expiration minutes), pageCount, credits and remainingCredits; with async it returns jobId and the reserved url to read once pdfco_check_job reports success. Use pdfco_auto_rotate_pages when page orientation is unknown or mixed. Use pdfco_rotate_pages to rotate specific pages by a fixed angle. Runs in the background by default; poll pdfco_check_job with the returned jobId.

    Inputs

    urlstringrequired
    Public URL of the source PDF. PDF.co downloads the file from this URL, so it must be reachable without a login: a direct link, a PDF.co temporary file URL from an earlier result, or a presigned upload URL from pdfco_get_presigned_upload_url. Each input file can be up to 100 MB. Prefix with cache: (cache:https://...) to let PDF.co reuse a file it already downloaded. Example: https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-rotate/sample_rotated.pdf.
    asyncboolean
    Run the job in the background. Defaults to true: the call returns a jobId and the reserved output url right away; poll pdfco_check_job with the jobId until status is success, then read the url. Scalekit stops waiting after 10 seconds, so only set false for small files that finish within a few seconds.default true
    langstring
    OCR language for scanned pages and images, as a Tesseract code; join two with + (eng+deu). Defaults to eng. See https://developer.pdf.co/api/language-support. Example: deu.
    profilesstring
    Advanced PDF.co profile settings as a JSON-encoded string, for options without their own input. Example: {"CheckPermissions": false} to skip the document-permission check (only if you own the document). See https://developer.pdf.co/api/profiles.