DSC Signing API

REST API to download, digitally stamp, encrypt and return PDF documents

Base URL:
POST /api/dscsign Sign a PDF — returns Base64 JSON

Downloads the PDF from the given URL, appends a full DSC stamp page, encrypts the result (AES-128, print-only), and returns the signed PDF as a Base64-encoded string in JSON.

Request Body (application/json)
{
  "pdfUrl":    "https://your-server.com/documents/invoice.pdf",  // required — must be publicly accessible
  "purpose":   "Invoice Authorisation",                          // required — reason shown on stamp
  "signerName": "Arpit Shukla",                                  // optional — defaults to "Arpit Shukla"
  "signerOrg":  "Marmelos Technologies Pvt. Ltd.",               // optional
  "location":   "Lucknow, Uttar Pradesh"                         // optional
}
Response (200 OK)
{
  "success":       true,
  "message":       "DSC stamp applied and PDF encrypted successfully.",
  "pdfBase64":     "JVBERi0xLjQK...",   // Base64-encoded signed+encrypted PDF bytes
  "fileName":      "DSC_Signed_20260419_143022.pdf",
  "signedAt":      "2026.04.19 14:30:22 +05'30'",
  "signer":        "Arpit Shukla, Marmelos Technologies Pvt. Ltd.",
  "purpose":       "Invoice Authorisation",
  "fileSizeBytes": 148320
}
Error Responses
StatusWhenMessage field
400Missing required fieldsValidation error list
400URL download failsFailed to download PDF: …
400URL returns non-PDF contentThe URL did not return a valid PDF.
500Internal processing errorInternal error: …
Code Samples
const response = await fetch('/api/dscsign', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    pdfUrl:  'https://your-server.com/invoice.pdf',
    purpose: 'Invoice Authorisation'
  })
});

const data = await response.json();
if (data.success) {
  // Decode and download
  const bytes  = Uint8Array.from(atob(data.pdfBase64), c => c.charCodeAt(0));
  const blob   = new Blob([bytes], { type: 'application/pdf' });
  const url    = URL.createObjectURL(blob);
  const a      = document.createElement('a');
  a.href       = url;
  a.download   = data.fileName;
  a.click();
}
using var http = new HttpClient();
var payload = new {
    pdfUrl  = "https://your-server.com/invoice.pdf",
    purpose = "Invoice Authorisation"
};
var resp = await http.PostAsJsonAsync("/api/dscsign", payload);
var data = await resp.Content.ReadFromJsonAsync<dynamic>();

if ((bool)data.success) {
    byte[] pdf = Convert.FromBase64String((string)data.pdfBase64);
    File.WriteAllBytes(data.fileName, pdf);
}
import requests, base64

r = requests.post('http://localhost:5000/api/dscsign', json={
    'pdfUrl':  'https://your-server.com/invoice.pdf',
    'purpose': 'Invoice Authorisation'
})

data = r.json()
if data['success']:
    pdf = base64.b64decode(data['pdfBase64'])
    with open(data['fileName'], 'wb') as f:
        f.write(pdf)
curl -X POST http://localhost:5000/api/dscsign \
  -H "Content-Type: application/json" \
  -d '{
    "pdfUrl":  "https://your-server.com/invoice.pdf",
    "purpose": "Invoice Authorisation"
  }' | python -c "
import sys, json, base64
d = json.load(sys.stdin)
if d['success']:
    open(d['fileName'], 'wb').write(base64.b64decode(d['pdfBase64']))
    print('Saved:', d['fileName'])
"
GET /api/dscsign/download Direct file download

Same as POST but returns the signed PDF directly as a file download — useful for browser links and integration with download managers.

Query Parameters
ParameterRequiredDefaultDescription
urlYesURL of the source PDF
purposeNoDocument AuthorisationReason shown on DSC stamp
signerNameNoArpit ShuklaSigner display name
locationNoLucknow, Uttar PradeshLocation on stamp
Example URL
GET /api/dscsign/download?url=https://example.com/doc.pdf&purpose=Invoice+Authorisation
GET /api/dscsign/logs Usage history (JSON)
Query Parameters
ParameterDefaultDescription
page1Page number
size50Records per page
{
  "total": 42,
  "page":  1,
  "size":  50,
  "items": [
    {
      "id": 1, "pdfUrl": "https://…/invoice.pdf",
      "purpose": "Invoice Authorisation", "signerName": "Arpit Shukla",
      "success": true, "errorMsg": null,
      "fileSizeBytes": 148320, "callerIp": "192.168.1.5",
      "signedAt": "2026-04-19T14:30:22"
    }
  ]
}
Try It Live — POST /api/dscsign
Quick Reference
Endpoints
POST/api/dscsign
GET/api/dscsign/download
GET/api/dscsign/logs
Security
AES-128 encrypted output
Print-only permissions
Edit/copy blocked
Stamp Contents
✔ Signature Valid badge
Signer name & org
IST timestamp
Location & purpose
Company seal image
Live Stats
Loading…
API Usage History
# Signed At (IST) PDF URL Purpose Signer Status Size Caller IP
Loading history…