Back to blog
March 10, 202614 min read

Building a Contract Generation and Signing Workflow

End-to-end tutorial: generate contracts from templates, add signature fields, send for signing, and store the sealed document.

contractssigningworkflowtemplates

The full workflow

Most contract workflows involve: generate document → review → sign → store. With pdfRelay, this is a single API call:

Step 1: Create the contract with sign fields

const res = await fetch('https://pdfrelay.com/api/v1/sign', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer sk_live_...', 'Content-Type': 'application/json' },
  body: JSON.stringify({
    template: 'service-agreement',
    data: {
      client_name: 'Acme Corp',
      service_description: 'Web development',
      amount: 15000,
      term_months: 12,
    },
    signers: [
      { role: 'client', name: 'Jane Smith', email: 'jane@acme.com' },
      { role: 'provider', name: 'Bob Wilson', email: 'bob@company.com' },
    ],
  }),
});

Step 2: Template with sign fields

The template includes <sign-field> elements that flow naturally with the content — no coordinate math, no pixel placement:

<h1>Service Agreement</h1>
<p>Client: {client_name}</p>
<p>Amount: ${amount.toLocaleString()}</p>

<sign-field type="checkbox" signer="client"
  label="I agree to the terms" required>check</sign-field>

<sign-field type="signature" signer="client" required>Sign</sign-field>
<sign-field type="date" signer="client">Date</sign-field>

The fields render as styled placeholders in the generated PDF. When signers open their signing links, the fields become interactive. No separate signing service. No DocuSign fees. Just HTML elements in your template.

Step 3: Signers complete

Each signer gets a unique URL. They review the document, fill their fields, and submit. When all signers complete, pdfRelay automatically:

  • Overlays signatures onto the original PDF
  • Appends an audit trail page
  • Uploads the sealed document
  • Fires a signing.completed webhook

Ready to try pdfRelay?

Get started free. No credit card required.