Other operations (Get, Download, Delete)

Beyond generating documents, the PDFMonkey node supports several other operations to manage your documents.

Get Document

The Get Document operation retrieves information about a previously generated document.

When to use it

  • Check the status of a document that's being generated

  • Retrieve the download URL later in your workflow

  • Get metadata attached to a document

  • Verify a document exists before processing

Configuration

Required fields:

  • Document ID: The ID of the document to retrieve

Example:

Document ID: {{ $json.documentId }}

Output

Returns complete document information:

{
  "id": "doc_abc123",
  "status": "success",
  "filename": "invoice-2024.pdf",
  "download_url": "https://...",
  "preview_url": "https://...",
  "template_id": "tmpl_xyz789",
  "metadata": { ... },
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-15T10:30:05Z"
}

Document status values

  • pending - Document is queued for generation

  • generating - Document is currently being generated

  • success - Document generated successfully

  • failure - Generation failed

Use case: Polling for completion

If you generated a document with Wait for Document disabled, you can poll for its completion:

1. PDFMonkey - Generate Document (Wait: disabled)
2. Wait (10 seconds)
3. PDFMonkey - Get Document
   - Document ID: {{ $node["PDFMonkey"].json.id }}
4. IF node
   - {{ $json.status }} = "success"
   - TRUE: Continue with PDF
   - FALSE: Loop back to step 2

Better approach: Use webhooks

Instead of polling, consider using the PDFMonkey Trigger to be notified when documents are ready.

Download File

The Download File operation downloads a generated PDF as binary data.

When to use it

  • Download a PDF that was generated earlier

  • Get the binary data separately from generation

  • Re-download a document for processing

Configuration

Required fields:

  • Document ID: The ID of the document to download

Optional fields:

  • Binary Property Name: Name for the binary data (default: data)

Example:

Document ID: {{ $json.documentId }}
Binary Property Name: pdfFile

Output

The PDF is stored as binary data and can be used in:

  • Email attachments

  • File storage nodes (Google Drive, Dropbox, etc.)

  • FTP uploads

  • Further processing nodes

Use case: Download and email later

1. Webhook (receives document ID)
2. PDFMonkey - Download File
   - Document ID: {{ $json.documentId }}
3. Gmail - Send Email
   - Attachments: {{ $binary.data }}

Generate Document has built-in download

If you're generating and immediately downloading, use the Download File option in the Generate Document operation instead of a separate Download File node.

Delete Document

The Delete Document operation permanently removes a document from PDFMonkey.

When to use it

  • Clean up after sending a document

  • Remove documents containing sensitive data

  • Manage storage quotas

  • Implement document retention policies

Configuration

Required fields:

  • Document ID: The ID of the document to delete

Example:

Document ID: {{ $json.documentId }}

Output

Returns a success confirmation:

{
  "success": true,
  "message": "Document deleted successfully"
}

Use case: Auto-cleanup after email

1. PDFMonkey Trigger (Download: enabled)
2. Gmail - Send Email
   - Attachments: {{ $binary.data }}
3. Wait (1 hour)
4. PDFMonkey - Delete Document
   - Document ID: {{ $json.id }}

Use case: Delete after storage

1. PDFMonkey Trigger (Download: enabled)
2. Google Drive - Upload
3. Dropbox - Upload
4. PDFMonkey - Delete Document
   - Document ID: {{ $node["PDFMonkey Trigger"].json.id }}

TTL as alternative

Consider using PDFMonkey's automatic deletion (TTL) feature instead of manually deleting documents. You can set documents to auto-delete after a certain time during generation.

Combining operations

Example: Generate, store, and cleanup

1. Manual Trigger
2. PDFMonkey - Generate Document (Download: enabled)
3. Google Drive - Upload File
   - File: {{ $binary.data }}
   - Folder: /Invoices/
4. Postgres - Insert
   - Table: documents
   - Data: {
       drive_url: {{ $node["Google Drive"].json.webViewLink }},
       pdfmonkey_id: {{ $node["PDFMonkey"].json.id }}
     }
5. PDFMonkey - Delete Document
   - Document ID: {{ $node["PDFMonkey"].json.id }}

Example: Conditional download based on status

1. Webhook (receives document ID)
2. PDFMonkey - Get Document
   - Document ID: {{ $json.documentId }}
3. IF node
   - Condition: {{ $json.status }} = "success"
   - TRUE:
     4a. PDFMonkey - Download File
     5a. Send to customer
   - FALSE:
     4b. Send error notification
     5b. PDFMonkey - Delete Document (cleanup failed attempt)

Example: Re-generate and replace

1. Webhook (receives order update)
2. PDFMonkey - Delete Document
   - Document ID: {{ $json.oldDocumentId }}
3. PDFMonkey - Generate Document
   - Template: Invoice
   - Payload: {{ $json.updatedData }}
4. Update database with new document ID

Error handling

All operations can fail for various reasons:

  • Document not found - Invalid document ID

  • Network errors - Connection issues

  • Permission errors - Invalid credentials

  • Rate limits - Too many requests

Use n8n's error handling:

1. PDFMonkey - Get Document
   Settings → On Error → Continue
2. IF node
   - {{ $node["PDFMonkey"].json.error }} exists
   - TRUE: Handle error
   - FALSE: Continue normally

Rate limits and quotas

Keep in mind:

  • API rate limits: PDFMonkey may rate-limit excessive API calls

  • Document quotas: Your plan has monthly generation limits

  • Storage limits: Documents are stored for a limited time

For high-volume workflows:

  • Add Wait nodes between operations

  • Use batch processing

  • Consider upgrading your PDFMonkey plan

Document generation options in n8nReacting to generated documents in n8nAutomatic deletion (TTL)

Last updated

Was this helpful?