Skip to content

Sign PDF

Stamp one or more uploaded signature PNG images onto any page of a PDF. This route uses a custom multipart contract because it needs the PDF, one or more signature images, and placement coordinates.

API Endpoint

POST /api/v1/tools/pdf/sign-pdf

Accepts multipart form data. The PDF is sent as file; signatures are sent as sig0, sig1, and so on; placements are sent in a placements JSON field.

Parameters

ParameterTypeRequiredDefaultDescription
filefileYes-PDF file to sign
sig0fileYes-First signature image. Additional images use sig1, sig2, and so on
placementsJSON stringYes-Array of placement objects: { "sig": 0, "page": 0, "x": 0.2, "y": 0.7, "w": 0.25, "h": 0.08 }
clientJobIdstringNo-Optional UUID for progress tracking via SSE
fileIdstringNo-Optional file library ID to save the signed result as a new version

Placement Coordinates

FieldTypeDescription
sigintegerSignature image index. 0 maps to sig0
pageintegerZero-based PDF page index
xnumberLeft position as a page fraction
ynumberTop position as a page fraction
wnumberSignature width as a page fraction
hnumberSignature height as a page fraction

Coordinates use a top-left origin. Values may bleed slightly beyond the page edge; the PDF renderer clips the final stamp to the page.

Example Request

bash
curl -X POST http://localhost:1349/api/v1/tools/pdf/sign-pdf \
  -H "Authorization: Bearer si_your-api-key" \
  -F "[email protected]" \
  -F "[email protected]" \
  -F 'placements=[{"sig":0,"page":0,"x":0.64,"y":0.82,"w":0.22,"h":0.08}]'

Example Response

json
{
  "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/contract_signed.pdf",
  "previewUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/preview.png",
  "originalSize": 245000,
  "processedSize": 249000
}

If the request cannot finish inside the synchronous wait window, the API returns:

json
{
  "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "async": true
}

Connect to /api/v1/jobs/<jobId>/progress and download the result when the job completes.

Notes

  • Accepted PDF input format: .pdf.
  • Signature images must be valid image files, typically PNG with transparency.
  • Up to 100 signature images and 100 placements are accepted.
  • sign-pdf is a custom route and does not use the standard tool settings JSON field.