11/13/2026Digital Signing

Digital Signature API: What It Takes to Sign PDFs from Your Own Software

Gaurav Singhal

View LinkedIn

Your product already generates PDFs: invoices, statements, letters, reports. Someone then asks for them to be digitally signed with the company's certificate before they go out. It sounds like one function call. It rarely is.

This post walks through what signing PDFs from your own code actually involves, why most provider APIs make it costly and complex, and what we are building instead.

Key takeaways

  • Signing a PDF programmatically means handling a certificate file, protecting the private key, embedding a standards-based signature and placing a visible stamp.
  • At volume you also need batching, retries and an audit log of what was signed, when and by whom.
  • Most provider APIs charge per signature or per envelope and come with minimums and sales-led contracts, which is hard to justify for routine documents.
  • Ambill's developer-first signing API is coming soon. You can request early access.

What a digital signature on a PDF actually is

A digital signature proves who signed a document and that it has not been changed since. For an organisation, the identity usually comes from a document signer certificate, typically a .pfx file issued through a licensed certifying authority or its partners. (If that term is new, start with What Is a Document Signer Certificate?.)

The signature is not an image. It is a cryptographic value calculated over the bytes of the PDF using the certificate's private key, then stored inside the file. Any later edit to the document breaks it, and a viewer such as Adobe Acrobat Reader will say so.

Step 1: Handling the certificate

A .pfx file bundles the private key and the certificate chain, protected by a password. Your code has to:

  • Load the file and unlock it with the password.
  • Read the signer's certificate and the intermediate certificates that link it to the issuing authority.
  • Check the certificate has not expired before signing anything with it.
  • Include the chain in the signature so that the recipient's reader can build trust back to the root.

Each of these has edge cases. Chains arrive incomplete. Passwords get rotated. Certificates expire on a weekend and nobody notices until signed documents start failing checks. This is also where many teams first meet the "Validity Unknown" warning; see How to Verify a Digitally Signed PDF.

Step 2: Keeping the private key safe

The private key is the organisation's identity. If it leaks, someone else can sign as you. So the questions pile up quickly:

  • Where is the .pfx stored, and is it encrypted at rest?
  • Where does the password live? Not in source code, not in a config file in the repository.
  • Which services and which people can trigger a signature?
  • How do you rotate the certificate without downtime?

USB tokens solve key safety by keeping the key on hardware, but they do not work for server software. You cannot plug a token into a cloud server and expect someone to type a PIN for every request. That trade-off is covered in USB DSC Token vs Cloud Signing.

Step 3: Embedding a standards-based signature

PDF signatures follow established formats. The common approach for documents that need to stand on their own is a PAdES-style embedded signature: the signature, certificate chain and signing time live inside the PDF itself, so anyone can open the file and check it without contacting you.

Getting this right means:

  • Reserving space in the PDF for the signature and calculating the hash over exactly the right byte ranges.
  • Using an incremental update so the original content is preserved.
  • Adding a trusted timestamp if you want the signing time to be independently provable.
  • Producing output that common readers accept without warnings.

Small mistakes here produce files that look signed but fail validation, which is worse than not signing at all.

Step 4: Placing the visible stamp

Most people expect to see the signature on the page: a box with the signer's name, date and sometimes a reason. That means choosing a page, coordinates and a size that will not cover content, across documents whose layouts vary. Invoices from different templates put totals and footers in different places. Your stamp logic has to cope.

Step 5: Batching and reliability

One document is a demo. A month-end run is hundreds or thousands. At that point you need:

  • A queue, so a large batch does not time out a web request.
  • Retries for transient failures, without signing the same document twice.
  • Clear status for each document: pending, signed, failed and why.
  • Throughput that does not depend on one machine or one person.

This is the gap most teams fall into when they try to sign from software. The manual version of the same problem is described in How to Digitally Sign PDFs in Bulk Without a USB Token.

Step 6: Audit logs

Once signing is automated, someone will ask: who signed this, with which certificate, when, and was it changed afterwards? You need an audit log that records each signing event, the document's hash, the certificate used and the user or system that requested it. Without it, automation becomes a liability rather than a time saver.

Why provider APIs are costly and complex

Building all of the above in-house is real engineering work, so teams look at signing providers. What they usually find:

  • Per-signature or per-envelope pricing. Every document you sign adds to the bill, so cost grows with your business rather than staying flat.
  • Annual minimums and committed volumes. You pay for a tier whether or not you use it.
  • Setup and integration fees, plus enterprise contracts that need a sales call before you can see a sandbox.
  • Workflow-first design. Many APIs are built around sending documents to people for signing, with envelopes, recipients and emails. If you only want to apply your own company's certificate to a PDF your system created, you pay for machinery you do not need.

For routine business documents, that pricing is hard to justify. More on this in Why Digital Signature Solutions Cost So Much.

What we are building: Ambill's signing API

We built Ambill Sign because signing a PDF with your own certificate should be simple and affordable. It already runs in production inside Ambill: finance teams upload their organisation's certificate once and bulk-sign the invoices and credit or debit notes they generate in Ambill, with one password entry per batch. PumPumPum, Kazam and Workie already use it to sign their invoices.

The next step is a developer-first signing API, coming soon, so any product or workflow can sign PDFs with the company's own certificate:

  • Upload your document signer certificate once, stored securely.
  • Send a PDF, get back a signed PDF with an embedded signature and a visible stamp.
  • Sign in batches, with status for every document.
  • An audit trail of every signature.
  • Simple pricing with no per-signature fees.

Uploading and signing any PDF through the Ambill interface is coming soon as well.

The six steps above are the expensive part

Putting a signature on a PDF is the easy bit. Certificate handling, key security, standards-based signatures, batching, retries and audit logs are what take months to build and keep needing attention as libraries, readers and rules change. That is the work Ambill Sign takes off your plate, and it runs on the same controls as the rest of Ambill, which is SOC 1 Type II certified.

Get started

If your software generates PDFs that need your organisation's signature, we would like to hear what you are building.

FAQ

What is a digital signature API?

It is a service your software calls to apply a digital signature to a document, usually a PDF, using a certificate. It handles the cryptography, embedding and stamping so your code does not have to.

Can I sign PDFs programmatically with a USB token?

Not practically on a server. Tokens need to be physically connected and usually need a PIN entered by a person, which does not fit automated or cloud software. A .pfx document signer certificate stored securely is the usual route.

What is a PAdES-style signature?

It is a way of embedding the signature, certificate chain and signing time inside the PDF, so the file can be verified on its own in a standard reader without contacting the sender.

Which documents should my software sign?

That depends on your business and your documents. Check with your advisor on what your documents require.

When will Ambill's signing API be available?

It is coming soon. Request early access and we will get in touch as it opens up.