---
title: "Send an employment contract from n8n"
description: "An n8n workflow that merges a new hire into a DOCX employment contract and sends it for approval by HR, then signature by the employer and the employee."
canonical: "https://signatureapi.com/docs/integrations/n8n/employment-contract"
source: "https://signatureapi.com/docs/integrations/n8n/employment-contract.md"
last_verified_api_version: "1.18.0"
---

# Send an employment contract from n8n

An n8n workflow that merges a new hire into a DOCX employment contract and sends it for approval by HR, then signature by the employer and the employee.

_Last verified against API version 1.18.0._

Your HR system posts a new hire to an n8n webhook. The workflow merges the data into the employment contract template and creates an envelope. HR approves it first, then the employer signs, then the employee.

![A successful run of the Employment contract workflow: New hire, Build envelope, Create envelope and Respond each have a green check, with 1 item passed between them](https://signatureapi.com/docs/images/captured/n8n/execution-employment-contract.webp)

*A successful run*

## Before you start

- The [Header Auth credential](https://signatureapi.com/docs/integrations/n8n#create-the-credential) named `SignatureAPI test key`.
- The employment contract template stored in your account, and its upload URL. Download the [template](https://signatureapi.com/docs/samples/templates/employment-contract.docx) and [store it once](https://signatureapi.com/docs/integrations/n8n#store-your-templates-once).

## How the workflow runs

1. **New hire** (Webhook) receives the request.
2. **Build envelope** (Code) turns the request into an envelope body.
3. **Create envelope** (HTTP Request) sends it to `POST /v1/envelopes`.
4. **Respond** (Respond to Webhook) answers the caller with the envelope id, or with the API's error.

For the finished workflow, download [`employment-contract.json`](https://github.com/signatureapi/examples/blob/main/no-code/n8n/employment-contract.json) from GitHub and import it into n8n.

## Build it

1. **New hire: the Webhook node**

   Add a **Webhook** node. Set **HTTP Method** to `POST`, **Path** to `employment-contract`, and **Respond** to **Using 'Respond to Webhook' Node**.

2. **Build envelope: a Code node**

   Add a **Code** node in **Run Once for All Items** mode, with this JavaScript. Replace `REPLACE_WITH_YOUR_TEMPLATE_URL` with your stored template's URL, and the constants with your company's details.

   ```javascript Build envelope
   // Builds the envelope from the request your HR system sends to this webhook.
   // Settings: replace with your own values.
   const TEMPLATE_URL = 'REPLACE_WITH_YOUR_TEMPLATE_URL'; // the stored employment-contract template
   const EMPLOYER = { name: 'Acme Corp', address: '100 Example Street, Springfield' };
   const HR_APPROVER = { name: 'Alex Chen', email: 'alex.chen@example.com' };
   const EMPLOYER_SIGNER = { name: 'John Smith', email: 'john.smith@example.com', title: 'Head of Operations' };

   const input = $input.first().json.body;
   if (!input?.employee?.name || !input?.employee?.email) {
     throw new Error('The request needs employee.name and employee.email');
   }

   const envelope = {
     title: `Employment contract: ${input.employee.name}`,
     message: 'Please review and sign your employment contract.',
     routing: 'sequential', // recipients act in array order: HR, then employer, then employee
     metadata: input.reference ? { hr_reference: String(input.reference) } : {},
     documents: [
       {
         key: 'contract',
         url: TEMPLATE_URL,
         format: 'docx',
         data: {
           city: 'Springfield',
           contractDate: new Date().toISOString().slice(0, 10),
           employer: { ...EMPLOYER, signatory: EMPLOYER_SIGNER.name, signatoryTitle: EMPLOYER_SIGNER.title },
           employee: { name: input.employee.name, address: input.employee.address ?? '' },
           startDate: input.start_date,
           jobTitle: input.job_title,
           hasProbation: Boolean(input.has_probation),
           probationMonths: String(input.probation_months ?? '3'),
           weeklyHours: String(input.weekly_hours ?? '40'),
           currency: input.currency ?? 'USD',
           salary: String(input.salary),
           vacationDays: String(input.vacation_days ?? '25'),
           governingLaw: 'the State of Delaware',
         },
         places: [
           { key: 'employer_signs_here', type: 'signature', recipient_key: 'employer' },
           { key: 'employee_signs_here', type: 'signature', recipient_key: 'employee' },
         ],
       },
     ],
     recipients: [
       { type: 'approver', key: 'hr', ...HR_APPROVER },
       { type: 'signer', key: 'employer', name: EMPLOYER_SIGNER.name, email: EMPLOYER_SIGNER.email },
       { type: 'signer', key: 'employee', name: input.employee.name, email: input.employee.email },
     ],
   };

   return [{ json: { envelope } }];
   ```

   The `data` keys match the template's merge fields, and the two `places` match its placeholders `[[employer_signs_here]]` and `[[employee_signs_here]]`. The approver needs no place: approvers review and approve without signing. With `routing: "sequential"`, the employer is notified only after HR approves, and the employee only after the employer signs.

3. **Create envelope: the HTTP Request node**

   Add an **HTTP Request** node:

   | Setting            | Value                                                                                          |
   | ------------------ | ---------------------------------------------------------------------------------------------- |
   | Method             | `POST`                                                                                         |
   | URL                | `https://api.signatureapi.com/v1/envelopes`                                                    |
   | Authentication     | Generic Credential Type, **Generic Auth Type** Header Auth, credential `SignatureAPI test key` |
   | Send Body          | On, **Body Content Type** JSON, **Specify Body** Using JSON                                    |
   | JSON               | `{{ JSON.stringify($json.envelope) }}`                                                         |
   | Options > Response | **Include Response Headers and Status** on, **Never Error** on, **Response Format** JSON       |

   The response options keep the workflow running when the API refuses the request, so the next node can return the error.

4. **Respond: the Respond to Webhook node**

   Add a **Respond to Webhook** node. Set **Respond With** to **JSON**, and add the **Response Code** option.

   - **Response Body**: `{{ JSON.stringify($json.statusCode === 201 ? { envelope_id: $json.body.id, status: $json.body.status } : $json.body) }}`
   - **Response Code**: `{{ $json.statusCode === 201 ? 201 : 502 }}`

5. **Activate the workflow**

   Activate (publish) the workflow so its production URL `https://<your-n8n>/webhook/employment-contract` accepts requests.

## Try it

```bash Send a new hire
curl -X POST https://<your-n8n>/webhook/employment-contract \
  -H 'Content-Type: application/json' \
  -d '{
    "reference": "HR-1042",
    "employee": { "name": "Maria Garcia", "email": "maria.garcia@example.com", "address": "12 Sample Lane, Springfield" },
    "job_title": "Customer Success Manager",
    "start_date": "2026-12-01",
    "salary": "72,000",
    "currency": "USD",
    "has_probation": true,
    "probation_months": 3,
    "weekly_hours": 40,
    "vacation_days": 25
  }'
```

```json 201 Created
{ "envelope_id": "eb4cf433-a8af-4161-b37b-7ef57d423e56", "status": "processing" }
```

A few seconds later the envelope is `in_progress`. The HR approver has the request, and both signers wait their turn. `has_probation` chooses the template's probation clause. In test mode no email reaches anyone. Read the emails in the Dashboard's [Emails](https://dashboard.signatureapi.com/emails?mode=test) view.

## Make it yours

- **Your template.** Change the `data` object to match your template's merge fields. See [Document templates](https://signatureapi.com/docs/api/resources/documents/templates).
- **Your HR system's fields.** The Code node reads `employee`, `job_title`, `start_date` and the rest from the request body. Rename them to match what your system sends.
- **The signed copy.** Add the [signed PDF workflow](https://signatureapi.com/docs/integrations/n8n/deliverable-on-completion) to store the contract when everyone has signed. `data.envelope_metadata.hr_reference` comes back in every event for this envelope.
