n8n

How to Automate API PDF Signing Document Security?

Put PDF signing behind a simple API that your apps can call. Teams can upload a PDF and a certificate, or generate a new key pair, then get a signed file back with clear status messages. It fits IT and compliance needs where signed records matter.

Two webhook endpoints do the work. A POST route accepts actions like upload, sign, and key generation. A GET route serves downloads. Switch nodes direct each request to the right path. Code checks make sure required fields are present for uploads, key creation, and signing. Files move from the request into the server file system, and checks confirm the file saved as expected. JavaScript code creates certificates and signs PDFs with a P12 file. Success and error response nodes send clean JSON so calling apps know what happened.

Setup is straight forward. Choose a folder for storage and update the file path node to that location. Send uploads as multipart with the field name fileData and include a file name. Use the returned server file names when you call the sign step. Expect faster turnarounds, fewer manual steps, and consistent results for legal, finance, and HR documents that must be signed and stored.

What are the key features?

  • POST and GET webhook endpoints for one API interface
  • Operation routing to upload, generate keys, sign, or download
  • Input validators for key generation, signing, and file uploads
  • File conversion and disk write steps for PDF and PFX storage
  • Certificate creation in code using a JavaScript crypto library
  • PDF signing with a P12 certificate using JavaScript code
  • Integrity checks confirm files were saved with the right name
  • Clear success and error responses for simple error handling

What are the benefits?

  • Reduce manual signing work from 2 hours to 5 minutes
  • Streamline document handling by 80 percent with one API
  • Cut upload and form errors by 90 percent with input checks
  • Handle up to 10 times more documents with simple scaling
  • Connect internal apps easily through webhooks

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. Create a storage folder on the server and note its full path. Open the set file path node and set the pdfPath and keyPath to that location so n8n can read and write files.
  3. Open the API POST Endpoint node and copy the Test URL. This is the address your app or HTTP client will call for uploads, key generation, and signing.
  4. Open the API GET Endpoint node and copy the Test URL. This is the address used to download files by file name.
  5. In the Switch Operation node, review the rule values for actions such as upload, sign, generate, and download. Match your request body field to these values.
  6. For PDF upload, send a POST request with operation set to upload and uploadType set to pdfDoc. Use multipart form data with the file field named fileData and add a text field fileName. Save the returned serverFileName.
  7. For certificate upload, send a POST request with operation set to upload and uploadType set to key. Use the same file field name fileData for the PFX file and include fileName. Save the returned serverFileName.
  8. For key generation, send a POST request with operation set to generate and include subjectCN, issuerCN, serialNumber, validFrom, validTo, and password in the JSON body. Store the returned file names for later use.
  9. For signing, send a POST request with operation set to sign and include inputPdf, pfxFile, and pfxPassword. Use the exact server file names you received from the upload or key generation steps.
  10. To download a file, call the GET endpoint and pass the fileName. The node will read the file from disk and return it.
  11. If you get an error response, check required fields, confirm the upload type value, verify the storage folder permissions, and make sure the file names match what was returned earlier.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.