How to Automate PDF Signing with REST API
Manual PDF signing is tedious. Open the PDF, insert signature, enter PIN, save, repeat. What if you have 500 invoices to sign every day?
OneSigner's REST API lets you automate the entire process. Here's how to set it up in under 10 minutes.
Prerequisites
- OneSigner installed and running
- USB token with valid signing certificate
- API token from your configuration
Step 1: Upload and Sign
The simplest approach — upload a PDF and let the signing engine handle it:
curl -X POST http://localhost:9440/api/upload
-H "Authorization: Bearer YOUR_TOKEN"
-F "file=@invoice.pdf"
That's it. OneSigner finds the matching signing profile, locates the signature position, signs with your USB token certificate, and saves the result.
Step 2: Batch Processing
Upload multiple files in one request:
for file in /invoices/unsigned/*.pdf; do
curl -X POST http://localhost:9440/api/upload
-H "Authorization: Bearer TOKEN"
-F "file=@$file"
done
Step 3: Folder Watch (Zero Code)
Even simpler — configure a folder watch profile. Drop PDFs into the input folder, OneSigner signs them automatically and moves them to the output folder. No API calls needed.
Performance
In our tests, OneSigner processes 12 PDFs in parallel in under 6 seconds. The USB token is the bottleneck (~4 seconds per signature), but the API handles concurrent uploads efficiently.
