Pdfmonkey

Learn how to use Pdfmonkey with Composio

Overview

SLUG: PDFMONKEY

Description

PDFMonkey is a service that automates the generation of PDF documents from templates, allowing users to create professional PDFs programmatically.

Authentication Details

generic_api_key
stringRequired

Connecting to Pdfmonkey

Create an auth config

Use the dashboard to create an auth config for the Pdfmonkey toolkit. This allows you to connect multiple Pdfmonkey accounts to Composio for agents to use.

1

Select App

Navigate to Pdfmonkey.

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Pdfmonkey Auth Config”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using API Key

1from composio import Composio
2
3# Replace these with your actual values
4pdfmonkey_auth_config_id = "ac_YOUR_PDFMONKEY_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/app
6
7composio = Composio()
8
9def authenticate_toolkit(user_id: str, auth_config_id: str):
10 # Replace this with a method to retrieve an API key from the user.
11 # Or supply your own.
12 user_api_key = input("[!] Enter API key")
13
14 connection_request = composio.connected_accounts.initiate(
15 user_id=user_id,
16 auth_config_id=auth_config_id,
17 config={"auth_scheme": "API_KEY", "val": {"generic_api_key": user_api_key}}
18 )
19
20 # API Key authentication is immediate - no redirect needed
21 print(f"Successfully connected Pdfmonkey for user {user_id}")
22 print(f"Connection status: {connection_request.status}")
23
24 return connection_request.id
25
26
27connection_id = authenticate_toolkit(user_id, pdfmonkey_auth_config_id)
28
29# You can verify the connection using:
30connected_account = composio.connected_accounts.get(connection_id)
31print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the Pdfmonkey toolkit’s playground

Python
1from composio import Composio
2from openai import OpenAI
3import json
4
5openai = OpenAI()
6composio = Composio()
7
8# User ID must be a valid UUID format
9user_id = "0000-0000-0000" # Replace with actual user UUID from your database
10
11tools = composio.tools.get(user_id=user_id, toolkits=["PDFMONKEY"])
12
13print("[!] Tools:")
14print(json.dumps(tools))
15
16def invoke_llm(task = "What can you do?"):
17 completion = openai.chat.completions.create(
18 model="gpt-4o",
19 messages=[
20 {
21 "role": "user",
22 "content": task, # Your task here!
23 },
24 ],
25 tools=tools,
26 )
27
28 # Handle Result from tool call
29 result = composio.provider.handle_tool_calls(user_id=user_id, response=completion)
30 print(f"[!] Completion: {completion}")
31 print(f"[!] Tool call result: {result}")
32
33invoke_llm()

Tool List

Tool Name: Create Document

Description

Tool to create a Document. Use when you need to instantiate a PDF from a template; set status='pending' to queue immediate generation. Ensure valid `document_template_id` is provided.

Action Parameters

document
objectRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Document Sync

Description

Tool to create a document and wait for generation to finish. Use when immediate PDF is needed.

Action Parameters

document
objectRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Template

Description

Tool to create a new Document Template. Use when you need to define a template with custom content, styles, and settings before generating PDF documents.

Action Parameters

app_id
string
body
string
body_draft
string
edition_mode
string
id
stringRequired
identifier
stringRequired
pdf_engine_draft_id
stringRequired
pdf_engine_id
string
sample_data
string
sample_data_draft
string
scss_style
string
scss_style_draft
string
settings
object
settings_draft
object
ttl
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete Document

Description

Tool to delete a Document by its ID. Use when you need to permanently remove a document after confirming its ID. Returns 204 No Content on success.

Action Parameters

id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete PDFMonkey Document Template

Description

Tool to delete a document template by ID. Use when you need to remove obsolete templates after validation.

Action Parameters

id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Download Document File

Description

Tool to download a generated PDF file via a presigned URL. Use after obtaining a valid download_url from the Document details endpoint. The URL expires after 1 hour; fetch a new URL upon expiry (403 Forbidden).

Action Parameters

download_url
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Current User

Description

Tool to retrieve details about the currently authenticated user. Use when you need account info (quota, plan, email, locale) after authentication.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Document

Description

Tool to fetch a Document by its ID. Use when you need the full document record including payload, meta, logs, and download URL.

Action Parameters

id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get DocumentCard

Description

Tool to fetch a DocumentCard by ID. Use when you have a DocumentCard ID and need its download URLs, status, and metadata. Use after generating or updating a DocumentCard.

Action Parameters

id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Template by ID

Description

Tool to fetch a Document Template by ID. Use when you need the template's content, styles, settings, and preview URL.

Action Parameters

id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List DocumentCards

Description

Tool to list DocumentCards. Use when you need to retrieve multiple DocumentCards with optional pagination and filtering by template, status, workspace, or update time.

Action Parameters

page[number]
integer
q[document_template_id]
array
q[status]
string
q[updated_since]
integer
q[workspace_id]
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List PDF Engines

Description

Tool to list available PDF engines with deprecation metadata. Use when you need to choose a rendering engine before generating PDFs.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Template Cards

Description

Tool to list template cards for a workspace. Use when you need to retrieve templates with optional folder filters, pagination, and sorting.

Action Parameters

page
integer
q[folders]
string
q[workspaceId]
stringRequired
sort
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Workspaces

Description

Tool to list workspaces (applications). Use when you need all available workspaces for the authenticated user after login.

Action Parameters

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Preview Document

Description

Tool to open a document preview via a PDF.js viewer. Use when you need to embed the PDF preview in an iframe after obtaining the document ID.

Action Parameters

id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Preview Template

Description

Tool to preview a template draft as a real PDF via the preview_url. Use after obtaining a template's preview_url.

Action Parameters

preview_url
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Document

Description

Tool to update a Document’s payload, meta, or status. Use when you need to modify a document properties or regenerate it.

Action Parameters

document
objectRequired
id
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Document Template

Description

Tool to update a document template’s properties. Use when you need to modify an existing template’s content, styles, settings, engine, folder, or TTL.

Action Parameters

app_id
stringRequired
body
string
body_draft
string
edition_mode
stringRequired
id
stringRequired
identifier
stringRequired
pdf_engine_draft_id
string
pdf_engine_id
string
preview_url
string
sample_data
string
sample_data_draft
string
scss_style
string
scss_style_draft
string
settings
object
settings_draft
object
template_folder_id
string
ttl
integer

Action Response

data
objectRequired
error
string
successful
booleanRequired