DEV Community

DocuMantra Team
DocuMantra Team

Posted on

eSign REST API Integration Patterns: Status Tracking, Retries, Storage and Security for Indian Applications

Once you have chosen an eSign provider and read its documentation, the remaining work is engineering hygiene. These patterns apply to most eSignature REST APIs and help avoid duplicate requests, lost signed files and leaked credentials. They are general guidance; always follow your provider's documented behaviour where it differs.

Pattern 1: Make request creation idempotent

Network timeouts happen. If your service retries a "create signing request" call blindly, a signer may receive two links for the same document, and you may pay twice. Store your own document ID before calling the API, record the provider's request ID as soon as it returns, and check for an existing request before creating another.

Pattern 2: Map IDs both ways

Keep a table that maps your internal record (employee, loan application, customer) to the provider's request ID and to the final document. Support teams will need to answer "where is the signed copy for this customer?" quickly.

Pattern 3: Treat status as a state machine

Define the states you care about and the transitions allowed: draft, sent, partially signed, completed, declined, expired, cancelled. Ignore transitions that go backwards. Update your record only from the provider's authoritative status, using the notification or polling options the provider documents, and back off sensibly when polling.

Pattern 4: Plan for Aadhaar eSign failure paths

If Aadhaar eSign is one of your methods, expect failures that are not bugs. The Controller of Certifying Authorities' (CCA) eSign FAQ says OTP-based eSign requires a mobile number registered with the e-KYC provider. Show signers a clear message and a route to retry or to contact your team, and do not ask signers to send OTPs or Aadhaar numbers to your staff.

Pattern 5: Download and store artefacts promptly

When a request completes, download the signed PDF and the completion certificate or audit trail, verify the download, and store both in your own system under your retention policy. Do not rely on a link that may expire.

Pattern 6: Protect credentials and personal data

  • Keep API keys server-side, in a secrets manager.
  • Separate test and production keys.
  • Log request IDs, not document contents or personal identifiers.
  • Limit who can download signed files.
  • Follow India's Digital Personal Data Protection Act, 2023 obligations for any personal data you handle, with advice from your counsel.

Pattern 7: Keep legal scope outside the code path

An API does not change which documents can be signed electronically. The Information Technology Act, 2000's First Schedule excludes negotiable instruments other than cheques, powers of attorney, trusts, wills, and contracts for the sale or conveyance of immovable property. Encode your counsel's decisions as configuration (which template uses which method) rather than hard-coding assumptions.

Pattern 8: Test the unhappy paths

Before launch, test expired links, declined signatures, wrong signer emails, partial completion with multiple signers, and provider downtime.

How DocuMantra frames REST integration

DocuMantra's article on electronic signature REST API integration describes itself as orientation only: authenticate, create the request, track completion, fetch the documents. It says the developer hub and the documentation are the source of truth and that rate limits and error codes belong in the docs, not invented in a blog post. DocuMantra's developer hub also says no public SDK or sandbox key is published on the site, so ask DocuMantra for the integration details your team needs.

The takeaway

Idempotent creation, a clean state machine, prompt storage and careful credential handling cover most real-world eSign integration problems.

Top comments (0)