April 25, 2026 · Templates
Free Agreement Form Templates with E-Signature: 5 Templates You Can Send in One API Call
Every business needs agreements — NDAs, service contracts, freelance deals, leases. Here are 5 free templates in markdown format that you can send for e-signature with a single API call.
Founder, Signbee
TL;DR
Five free agreement templates in markdown format, ready for electronic signature. Copy any template, customize the bracketed variables, and send via the Signbee API — one POST request, legally binding, SHA-256 certified. Free tier: 5 documents/month.
Template 1: Mutual NDA
The most common business agreement. Use when sharing confidential information with potential partners, investors, or clients. See our full NDA automation guide for details.
# Mutual Non-Disclosure Agreement
**Effective Date:** [DATE]
**Between:** [PARTY_A] ("Disclosing Party")
**And:** [PARTY_B] ("Receiving Party")
## 1. Confidential Information
"Confidential Information" means any non-public information
disclosed by either Party, including technical data, trade
secrets, business plans, and financial information.
## 2. Obligations
Each Party agrees to: (a) maintain strict confidentiality,
(b) not disclose to third parties, (c) use only for the
stated Purpose, (d) protect with reasonable care.
## 3. Exclusions
Excludes: publicly available info, independently developed
info, and court-ordered disclosures (with prompt notice).
## 4. Term
This Agreement remains in effect for [DURATION].
Confidentiality survives for [SURVIVAL_PERIOD] after
termination.
## 5. Governing Law
Governed by the laws of [JURISDICTION].
By signing below, each Party agrees to the terms above.Template 2: Freelance Contract
For independent contractors, freelancers, and gig workers. Covers scope, payment, IP rights, and termination.
# Freelance Services Agreement **Date:** [DATE] **Client:** [CLIENT_NAME], [CLIENT_ADDRESS] **Freelancer:** [FREELANCER_NAME], [FREELANCER_ADDRESS] ## 1. Services Freelancer agrees to provide the following services: [DESCRIBE_SERVICES] ## 2. Compensation Client agrees to pay [AMOUNT] [per hour / fixed fee]. Payment terms: Net [30/15/7] days from invoice date. ## 3. Timeline Start date: [START_DATE] Estimated completion: [END_DATE] ## 4. Intellectual Property All work product created under this Agreement is owned by [CLIENT / FREELANCER] upon full payment. ## 5. Termination Either party may terminate with [14/30] days written notice. Client pays for all work completed to date. ## 6. Independent Contractor Freelancer is an independent contractor, not an employee. By signing below, both parties agree to these terms.
Template 3: Service Agreement
# Service Agreement **Effective Date:** [DATE] **Provider:** [COMPANY_NAME] **Client:** [CLIENT_NAME] ## 1. Services Provider will deliver: [DESCRIBE_SERVICES] ## 2. Fees [AMOUNT] per [month/project/hour]. Payment due within [30] days of invoice. ## 3. Term Initial term: [12] months, auto-renewing unless cancelled with [30] days notice. ## 4. Warranties Provider warrants services will be performed in a professional manner consistent with industry standards. ## 5. Limitation of Liability Total liability limited to fees paid in the preceding [12] months. ## 6. Governing Law Governed by the laws of [JURISDICTION]. By signing below, both parties agree to these terms.
Template 4: Commercial Lease
# Commercial Lease Agreement **Date:** [DATE] **Landlord:** [LANDLORD_NAME] **Tenant:** [TENANT_NAME] ## 1. Premises [ADDRESS], approximately [SIZE] sq ft. ## 2. Term [START_DATE] to [END_DATE] ([MONTHS] months). ## 3. Rent [AMOUNT] per month, due on the [1st] of each month. Security deposit: [DEPOSIT_AMOUNT]. ## 4. Permitted Use [DESCRIBE_BUSINESS_USE] ## 5. Maintenance Tenant responsible for interior maintenance. Landlord responsible for structural and exterior. ## 6. Insurance Tenant shall maintain commercial general liability insurance of at least [AMOUNT]. By signing below, both parties agree to these terms.
Template 5: Consulting Agreement
# Consulting Agreement **Effective Date:** [DATE] **Consultant:** [CONSULTANT_NAME] **Client:** [CLIENT_NAME] ## 1. Engagement Client engages Consultant to provide: [DESCRIBE_CONSULTING_SERVICES] ## 2. Compensation [RATE] per [hour/day/project]. Expenses: [reimbursed / included in rate]. ## 3. Confidentiality Consultant will maintain confidentiality of all Client information and not disclose to third parties. ## 4. Intellectual Property All deliverables are work-for-hire and owned by Client. ## 5. Non-Compete [OPTIONAL: Consultant agrees not to provide similar services to [COMPETITORS] for [DURATION].] ## 6. Term and Termination Either party may terminate with [30] days notice. By signing below, both parties agree to these terms.
Why Programmatic Document Generation Matters in 2026
For modern engineering teams, manual document workflow management is a bottleneck that introduces human error, security hazards, and friction. Treating contracts as code is the modern industry standard. By storing your agreement templates in version-controlled markdown repositories or structured database schemas, you gain full auditability, simple editing capabilities, and rapid API-driven execution.
Traditional PDF manipulation engines (like editing absolute coordinates or parsing complex HTML/CSS layouts via fragile wkhtmltopdf binaries) are notoriously difficult to configure. Markdown provides a clean, responsive layout hierarchy that translates deterministically into beautiful, styled PDF contracts. When combined with cryptographic signature verification (like SHA-256 audit trails), you ensure that what your clients read is exactly what they sign, fully compliant with international e-signature regulations like ESIGN (US) and eIDAS (EU).
Designing a Dynamic Variable Substitution Engine
A common developer pitfall is executing a naive string replace on raw template inputs. While a basic replace('[PARTY_A]', name) works for basic local demos, it fails to handle production challenges such as overlapping variables (e.g., [PARTY_A] vs [PARTY_A_ADDRESS]), missing fields, and character sanitization.
When processing user-submitted input, you must ensure that special characters representing markdown tokens (such as asterisks *, underscores _, backticks `, and brackets [ ]) are properly escaped or handled. Otherwise, a company named *Star Tech & Co* could accidentally trigger italic layouts or break link syntax in the generated PDF contract. Additionally, stripping raw HTML tags ensures that malicious actors cannot perform document defacement or visual injection attacks on your signers.
The Architecture Flow: From Template to Client Link
The diagram below demonstrates how data flows from your application database, through the dynamic substitution engine, to the Signbee API, and finally to the client signing page.
+---------------------------------------------------+
| Markdown Template File (e.g., freelance_nda.md) |
| Contains placeholders: [DATE], [PARTY_A], etc. |
+-------------------------+-------------------------+
|
v
+-------------------------+-------------------------+
| Dynamic Context Object (Data Payload) |
| e.g., { "PARTY_A": "Acme Inc", "DATE": "2026" } |
+-------------------------+-------------------------+
|
v
+-------------------------+-------------------------+
| Step 1: Escaping & Sanitization Helper |
| - Strip HTML script tags |
| - Escape markdown control characters |
+-------------------------+-------------------------+
|
v
+-------------------------+-------------------------+
| Step 2: Substitution Regex Matcher |
| - Parses string using regex: /\[([A-Z0-9_]+)\]/g |
| - Maps keys and replaces with clean variables |
+-------------------------+-------------------------+
|
v
+-------------------------+-------------------------+
| Step 3: Compiled Markdown Output |
| - Completed contract text ready for signing |
+-------------------------+-------------------------+
|
v
+-------------------------+-------------------------+
| Step 4: API Dispatch (Signbee POST Request) |
| - Payload: { markdown, signers, expires } |
| - Maps multi-signer roles, emails, and order |
+-------------------------+-------------------------+
|
v
+-------------------------+-------------------------+
| Step 5: Signbee Layout & Cryptographic Engine |
| - Compiles PDF, calculates SHA-256 hash |
| - Generates secure eIDAS-compliant audit trail |
+-------------------------+-------------------------+
|
v
+-------------------------+-------------------------+
| Step 6: Secure Signing Links Generated |
| - Signer A Link: signb.ee/s/xyz123 |
| - Signer B Link: signb.ee/s/xyz456 |
+---------------------------------------------------+Implementation: Node.js & TypeScript Helper
The following TypeScript helper function reads a local template file, validates the incoming context payload, escapes markdown control characters, performs regex-based placeholder substitution, maps multiple signers (with names, emails, roles, and a specified signing order), and dispatches the payload to the Signbee API using the native fetch client.
import * as fs from 'fs';
interface Signer {
name: string;
email: string;
role: string;
signing_order: number;
}
interface SignbeeSendRequest {
title: string;
markdown: string;
signers: Signer[];
expires_in_days: number;
}
/**
* Escapes characters that have syntactic meaning in markdown.
* Prevents user-provided inputs from corrupting contract formatting.
*/
function escapeMarkdown(text: string): string {
if (!text) return "";
// Strip raw HTML tags to prevent scripting/injection in output PDF
const cleanHtml = text.replace(/<[^>]*>/g, "");
// Escape standard markdown characters: \, `, *, _, {, }, [, ], (, ), #, +, -, ., !
return cleanHtml.replace(/([\\\`*_\{\}\[\]()#+\-.!])/g, "\\$1");
}
/**
* Reads a template file, substitutes placeholders, and sends to Signbee API.
*/
export async function compileAndSendAgreement(
templatePath: string,
context: Record<string, string>,
signers: Signer[],
apiKey: string
): Promise<{ document_id: string; signers: { email: string; signing_url: string }[] }> {
// 1. Read the Markdown template file
const templateRaw = fs.readFileSync(templatePath, 'utf8');
// 2. Perform regular expression substitution with context values
// Replaces placeholders like [PARTY_A], [DATE], etc.
const compiledMarkdown = templateRaw.replace(/\[([A-Z0-9_]+)\]/g, (match, key) => {
if (key in context) {
return escapeMarkdown(context[key]);
}
// Return the original match if the key is missing to make debugging easier
return match;
});
// 3. Construct the API Payload with multiple signers configuring roles & order
const payload: SignbeeSendRequest = {
title: `Freelance Services Agreement - ${context['CLIENT_NAME'] || 'Draft'}`,
markdown: compiledMarkdown,
signers: signers,
expires_in_days: 14,
};
// 4. Send the post request to the Signbee API endpoint
const response = await fetch("https://signb.ee/api/v1/send", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${apiKey}`,
},
body: JSON.stringify(payload),
});
if (!response.ok) {
const errorText = await response.text();
throw new Error(`Signbee API Error (${response.status}): ${errorText}`);
}
return response.json();
}Implementation: Python 3 Helper
If your backend is built on Python (using frameworks like FastAPI or Django), you can use this helper module. It relies on the standard re module for substitution and the requests library to manage the HTTP request lifecycle.
import re
import requests
from typing import Dict, List, TypedDict
class Signer(TypedDict):
name: str
email: str
role: str
signing_order: int
def escape_markdown(text: str) -> str:
"""
Strips raw HTML tags and escapes markdown syntax markers to ensure
that dynamic values do not corrupt the formatting of the contract.
"""
if not text:
return ""
# Strip HTML tags
clean_html = re.sub(r'<[^>]*>', '', text)
# Escape markdown reserved control characters
escape_pattern = re.compile(r'([\\\`*_{\}\[\]()#+\-.!])')
return escape_pattern.sub(r'\\\1', clean_html)
def compile_and_send(
template_path: str,
context: Dict[str, str],
signers: List[Signer],
api_key: str
) -> dict:
"""
Loads template, substitutes brackets context, and calls Signbee POST API.
"""
# 1. Load the Markdown template file
with open(template_path, 'r', encoding='utf-8') as f:
template_content = f.read()
# 2. Substitute brackets variables ([VARIABLE_KEY])
def replace_match(match):
key = match.group(1)
if key in context:
return escape_markdown(context[key])
return match.group(0)
compiled_markdown = re.sub(r'\[([A-Z0-9_]+)\]', replace_match, template_content)
# 3. Construct payload with multi-signer mapping and routing order
payload = {
"title": f"Freelance Services Agreement - {context.get('CLIENT_NAME', 'Draft')}",
"markdown": compiled_markdown,
"signers": signers,
"expires_in_days": 14
}
# 4. Dispatch the HTTP POST request to the Signbee API
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {api_key}"
}
response = requests.post(
"https://signb.ee/api/v1/send",
json=payload,
headers=headers,
timeout=15
)
if not response.ok:
raise Exception(f"Signbee API Error ({response.status_code}): {response.text}")
return response.json()
Advanced Integration: Multi-Signer Workflows and Hook Events
Contracts are rarely single-party documents. When automating business workflows, you must define the exact signing order and recipient roles. For example, in a Freelance Contract, the Freelancer should sign first to accept the terms and pricing. Once their signature is captured, the Client is notified to countersign the agreement.
By configuring signing_order in the API payload, you establish a sequential workflow. Signbee handles the transitions automatically. When the document is created, Signbee generates signing URLs for all parties but only notifies the first signer. Once the first signer completes their signature, a webhook notification (e.g., document.signer_completed) is dispatched to your server, and the second signer receives their link. After all signers have signed, the final completed document is generated, certified with a SHA-256 hash, and sent to all parties via email.
By setting up webhook listeners on your backend, you can automatically update contract statuses in your database, activate user accounts, or trigger financial onboarding pipelines without polling the API.
Frequently Asked Questions
Are free agreement templates legally binding?
Yes — when properly signed by all parties. The template provides structure; the signatures and mutual assent create legal force. E-signatures with audit trails provide stronger evidence than paper.
Can I customize these templates?
Yes — replace all bracketed [VARIABLES] with your specific details. These are starting points — consult a lawyer for high-value or unusual agreements.
What agreement templates does every business need?
At minimum: NDA (protecting confidential info), service/freelance agreement (client work), and terms of service (if you have a product). Leases and consulting agreements are needed as you grow.
How can I ensure safety and avoid code-injection attacks when substituting variables in markdown templates?
To ensure safety when programmatically substituting variables in markdown templates, you must treat dynamic input with caution. If variables are sourced from untrusted user inputs (like free-text fields in a public form), they might contain malicious markdown syntax, HTML tags, or script elements. In production environments, you should run a sanitization step before compiling or sending the payload. A robust sanitization helper should strip out raw HTML tags, escape markdown control characters (such as backticks, asterisks, and square brackets) unless they are explicitly intended, and validate value formats (like verifying that email inputs conform to RFC 5322 and dates are in standard ISO format). By performing this verification, you prevent potential layout disruption, malformed PDFs, or visual injection attacks where signers see misleading clauses injected via user-submitted variables. Always enforce static schema boundaries for context objects.
What are the best practices for caching compiled templates and scaling document generation performance?
When scaling document workflows that generate thousands of agreements, caching is vital for maintaining high performance. You should keep raw markdown templates stored in a distributed key-value store, such as Redis, or in local in-memory caches (like lru-cache in Node.js) to avoid costly disk reads or database queries on every request. Since the dynamic context object is light and computed at runtime, the substitution process itself is CPU-bound but extremely fast. Once variables are substituted, avoid storing the compiled intermediate markdown. Instead, send it directly to the Signbee API, and cache the returned metadata (like document IDs and signer tracking URLs) for real-time webhooks. If the same document must be reviewed by many parties simultaneously without modifications, cache the generated signer link and status flags locally, using webhook notifications to invalidate cache entries when the document status transitions to 'completed' or 'void'.
Can I handle nested arrays, loops, or conditional statements inside these markdown agreement templates?
Standard markdown does not natively support logic structures like loops, arrays, or conditionals. If your agreements require dynamic lists (such as an itemized breakdown of deliverables or pricing tables) or optional clauses (like a conditional non-compete section), you should implement a simple preprocessing layer. For loops, you can define custom placeholder blocks like {{#each items}}...{{/each}} or use a standard templating engine like Handlebars or Mustache to compile the markdown structure before running final variable substitutions. Alternatively, in Node.js or Python, you can programmatically format nested arrays into markdown tables or bulleted lists in your code, and substitute the resulting compiled markdown string into a single template placeholder (such as [ITEMIZED_DELIVERABLES]). This keeps the base template clean while providing full flexibility to render complex, variable-length tabular data seamlessly.
Send any template for e-signature — 5 free documents/month, no credit card.
Last updated: May 29, 2026 · These templates are for informational purposes. Consult a qualified attorney for your specific situation. Michael Beckett is the founder of Signbee and B2bee Ltd.