Legal document analysis and contract summarisation
- Published
Contract review and legal document analysis is one of the most time-consuming tasks in any organisation. A single contract can take hours to read through, summarise, and extract key terms. Lawyers and legal teams spend considerable time on repetitive document intake, flagging sections, and generating summaries for stakeholders who need the headlines without reading the full text............. For more on this, see Automated legal document review and client summary genera.... For more on this, see Legal contract review and client summary document generation.
The traditional workflow looks like this: a document arrives, someone prints it or opens it in PDF readers, manually highlights important sections, writes notes, creates a summary in Word, then sends it to others. Each step is manual. Each handoff introduces delays and inconsistencies. If you receive 10 contracts a week, you're looking at days of pure document work that could be automated.
This Alchemy recipe combines three AI tools to build a fully automated pipeline: Chat with PDF by Copilotus extracts information from documents, Resoomer AI creates intelligent summaries, and Wordsmith AI polishes and formats the output. Wire them together with an orchestration tool, and you have a system that accepts a contract, analyses it, summarises it, and delivers a formatted report without human intervention.
The Automated Workflow
We'll build this workflow using n8n because it offers the best balance of flexibility, native HTTP request support, and cost for this particular use case. However, I'll note where Zapier and Make differ in approach.
Architecture Overview
The workflow follows this path:
- A trigger fires when a new document lands (via webhook, email, or file upload).
- Chat with PDF by Copilotus receives the document and extracts key clauses, parties, dates, and obligations.
- The extracted text flows to Resoomer AI, which creates a condensed summary.
- Wordsmith AI receives the summary and formats it into a polished report with proper structure.
- The final report is saved to a storage location (Google Drive, Dropbox, or a database) and optionally emailed to stakeholders.
This removes every manual handoff between tools.
Setting Up n8n
n8n is ideal here because it handles file uploads natively, supports complex JSON transformations, and integrates well with the APIs we're using. Start by creating a new workflow in n8n.
The first node is a webhook trigger. This accepts incoming file uploads from your document management system or email service.
{
"method": "POST",
"path": "legal-document-workflow",
"headers": {
"Content-Type": "application/json"
}
}
Configure n8n to expose this webhook URL. You'll receive a unique endpoint that looks like:
https://your-n8n-instance.com/webhook/legal-document-workflow
Any POST request to this URL triggers the workflow. The webhook should send a JSON payload containing the file (base64 encoded or as a URL reference) and optional metadata like the contract type or client name.
Step 1:
Chat with PDF by Copilotus API Integration
Chat with PDF by Copilotus has a REST API that accepts PDF files and questions. We'll use it to extract structured information from contracts.
In n8n, add an HTTP Request node configured as follows:
Method: POST
URL: https://api.chat-with-pdf.copilotus.io/v1/documents/upload
Headers:
Authorization: Bearer YOUR_COPILOTUS_API_KEY
Content-Type: application/json
The request body passes your document:
{
"file_url": "https://example.com/path/to/contract.pdf",
"document_name": "Service Agreement - Acme Corp"
}
If the file comes as base64, use this instead:
{
"file_base64": "JVBERi0xLjQK...",
"document_name": "Service Agreement - Acme Corp"
}
The API returns a document ID:
{
"document_id": "doc_abc123xyz",
"status": "processed",
"pages": 8
}
Store this document ID in n8n using the Set node. Then create a second HTTP Request to query the document:
Method: POST
URL: https://api.chat-with-pdf.copilotus.io/v1/documents/{{document_id}}/ask
Headers:
Authorization: Bearer YOUR_COPILOTUS_API_KEY
Content-Type: application/json
The query body should ask for structured data:
{
"question": "Extract the following in JSON format: contract_parties (list of organisation names), effective_date, expiration_date, renewal_terms, payment_terms, termination_clauses, confidentiality_obligations, and key_deliverables. Be precise and extract exact text where available."
}
Copilotus returns the AI's response as text. To make it usable downstream, add a Function node in n8n to parse this into JSON:
const response = $input.all()[0].json.answer;
let extractedData = {};
try {
const jsonMatch = response.match(/\{[\s\S]*\}/);
if (jsonMatch) {
extractedData = JSON.parse(jsonMatch[0]);
}
} catch (e) {
// If parsing fails, store raw response
extractedData = { raw_response: response };
}
return { extracted_data: extractedData };
This gives you structured data to pass to the next tool.
Step 2:
Resoomer AI for Intelligent Summarisation
Resoomer AI has a straightforward API for summarising text. Take the extracted data from the previous step and feed it into Resoomer.
Add another HTTP Request node:
Method: POST
URL: https://api.resoomer.io/v1/summarize
Headers:
Authorization: Bearer YOUR_RESOOMER_API_KEY
Content-Type: application/json
Construct the body from the extracted data:
{
"text": "Contract Parties: {{extracted_data.contract_parties}}\nEffective Date: {{extracted_data.effective_date}}\nKey Terms: {{extracted_data.key_deliverables}}\nPayment Terms: {{extracted_data.payment_terms}}\nTermination: {{extracted_data.termination_clauses}}\nConfidentiality: {{extracted_data.confidentiality_obligations}}",
"summary_length": "medium",
"language": "en"
}
Resoomer responds with a condensed summary:
{
"summary": "This is a service agreement between Party A and Party B, effective from [date] to [date]...",
"compression_ratio": 0.35,
"status": "success"
}
Store the summary output. You now have both structured extracted data and a human-readable summary.
Step 3:
Wordsmith AI for Report Formatting
Wordsmith AI takes text and applies professional formatting, tone adjustments, and structure. Use it to create a polished deliverable.
Add an HTTP Request node:
Method: POST
URL: https://api.wordsmith.ai/v1/enhance
Headers:
Authorization: Bearer YOUR_WORDSMITH_API_KEY
Content-Type: application/json
The body should combine the extracted data and summary:
{
"content": "LEGAL DOCUMENT ANALYSIS REPORT\n\nDocument: Service Agreement\nDate Analysed: {{current_date}}\n\nEXECUTIVE SUMMARY\n{{summary}}\n\nKEY TERMS EXTRACTED\nParties: {{extracted_data.contract_parties}}\nEffective Date: {{extracted_data.effective_date}}\nExpiration: {{extracted_data.expiration_date}}\nPayment Terms: {{extracted_data.payment_terms}}\nTermination Clause: {{extracted_data.termination_clauses}}\nConfidentiality: {{extracted_data.confidentiality_obligations}}\nDeliverables: {{extracted_data.key_deliverables}}",
"tone": "professional",
"format": "report",
"include_headings": true
}
Wordsmith returns a formatted document:
{
"enhanced_content": "# Legal Document Analysis Report\n\n**Document:** Service Agreement\n**Date Analysed:** [date]\n\n
## Executive Summary\n\n[Formatted summary text]\n\n
## Key Terms Extracted\n\n**Parties:**\n- [Party names]\n\n**Effective Date:** [Date]\n\n**Expiration:** [Date]\n\n**Payment Terms:** [Terms]\n\n**Termination Clause:** [Clause]\n\n**Confidentiality Obligations:** [Details]\n\n**Deliverables:** [List]",
"status": "enhanced"
}
This markdown output is ready for export.
Step 4:
Save and Notify
Add a Google Drive node (or your preferred storage) to save the report:
Operation: Create a file from text
Folder: /Legal Document Reports
File Name: {{document_name}} - Analysis {{current_date}}
File Format: Markdown (.md)
File Content: {{enhanced_content}}
Then add an email node to notify stakeholders:
To: {{stakeholder_email}}
Subject: Legal Analysis Complete: {{document_name}}
Body: The analysis of {{document_name}} is ready. See attached or access it at [link to saved file].
Attachment: The markdown file or a PDF export
If you want to send a Slack message instead for instant notification:
Channel: #legal-reviews
Message: ✅ Contract analysis complete: {{document_name}}. Key parties: {{extracted_data.contract_parties}}. Summary: [first 500 chars of summary]. Full report: [link]
Alternative:
Using Zapier
Zapier doesn't handle file transformations as elegantly as n8n, but you can still build this workflow. The approach differs slightly:
- Use Zapier's file trigger (Google Drive, Dropbox, or email attachment).
- Use the "Code by Zapier" or "Run Python" actions to base64 encode files.
- Create separate Zaps for each API call (Chat with PDF, Resoomer, Wordsmith) because Zapier handles sequential API calls less smoothly than n8n.
- Use Zapier's built-in Google Drive or Slack actions for the output stage.
The downside: more Zaps means more monthly costs and more maintenance. n8n wins on efficiency here.
Alternative:
Using Make (Integromat)
Make has better visual mapping than Zapier and stronger file handling than older Zapier versions. The workflow structure mirrors n8n:
- Webhook trigger for file upload.
- Make's HTTP module for Chat with PDF API.
- Text parser to extract JSON.
- Second HTTP module for Resoomer.
- Third HTTP module for Wordsmith.
- Google Drive or database module for storage.
Make charges per operation, so a 5-step workflow costs more than n8n's flat monthly fee if you run high volumes.
The Manual Alternative
If you prefer more control or want to review outputs before passing them downstream, build a semi-automated workflow instead.
Stop after step 2 (extraction and summarisation). Instead of sending directly to Wordsmith and storage, use n8n's Pause node to wait for human approval. A team member reviews the extracted data and summary, adds notes or corrections, then approves for final formatting.
To implement this:
- After the Resoomer step, add a Pause node.
- Configure it to send a Slack message or email with the extracted data and summary.
- Add approval buttons: "Approve and Format" or "Reject and Review Manually".
- If approved, continue to Wordsmith; if rejected, stop and notify the user to review the source document.
This gives you confidence that the AI outputs are accurate before they reach stakeholders, whilst still eliminating the bulk of manual work.
Pro Tips
1. Handle OCR for Scanned Documents
Chat with PDF by Copilotus handles native PDFs well, but scanned or image-heavy documents sometimes fail. Before sending to Copilotus, add an OCR step using a tool like Cloudinary or AWS Textract. Add this as an HTTP Request node before the Copilotus call:
Method: POST
URL: https://api.cloudinary.com/v1_1/{{cloudinary_cloud}}/image/upload
Params:
file: {{file_base64}}
ocr: "adv_ocr"
This ensures text-based PDFs and scanned contracts are equally processable.
2. Rate Limiting and Cost Control
Chat with PDF charges per document processed, Resoomer per summarisation, and Wordsmith per enhancement. If you're processing 50 contracts daily, costs add up. To reduce waste:
Add validation before the paid API calls. Use a simple text length check in n8n to ensure the file is actually a contract before sending to Copilotus:
const fileSize = $input.all()[0].json.file_size;
if (fileSize < 5000) {
throw new Error("File too small; likely not a full contract.");
}
return { validation_passed: true };
Also implement retry logic with exponential backoff if APIs temporarily fail. n8n's built-in error handling covers this, but in Zapier or Make, add a delay between retries to avoid hammering rate limits.
3. Extract Only What You Need
The Copilotus question can be overly broad. Instead of asking for 10 different fields, request only the 4 or 5 most critical to your use case. This speeds processing and reduces errors. For example:
"question": "Extract only the contract parties and termination clause as plain text."
A narrower request is faster and more reliable than a comprehensive one.
4. Store Raw Outputs for Audit
Always save the raw response from each API step, not just the final output. Use n8n's database node or a cloud storage to log every extraction, summary, and formatting result. If a stakeholder questions why a term was extracted a certain way, you can trace it back through the pipeline and see exactly what the AI returned at each stage.
5. Monitor Extraction Accuracy
Set up a simple weekly report in n8n that flags documents where extraction confidence was low or where Copilotus returned incomplete data. Use n8n's Notion or Airtable integration to log these cases. Review them manually to understand patterns and improve your questions over time.
Cost Breakdown
| Tool | Plan Needed | Monthly Cost | Notes |
|---|---|---|---|
| Chat with PDF by Copilotus | Pay-as-you-go | $0.10–0.50 per document | Costs vary by PDF size and complexity; 50 contracts/month = $5–25 |
| Resoomer AI | Basic | $9.99 or pay-as-you-go | $9.99/month for up to 100 summaries; excess charged per summary |
| Wordsmith AI | Standard | $29/month | Includes 5,000 text enhancements; additional at $0.01 per 100 words |
| n8n Self-Hosted | Cloud Pro or Self-Hosted | $20/month (cloud) or free (self-hosted) | Cloud Pro includes 1,000 workflow executions/month; self-hosted has no per-execution cost |
| Google Drive API | Free tier | $0 | Included with any Google Workspace account; 15GB storage free tier |
| Email Service | Integrated | $0 | Gmail/Google Workspace; or Mailgun at $0.50 per 1,000 emails sent |
Total Estimated Monthly Cost: $39–84 for typical usage (50–100 contracts/month, using n8n cloud and basic plans for each AI tool). Self-hosting n8n drops this to $9–74.
If you require higher volume, Copilotus, Resoomer, and Wordsmith all offer tiered enterprise plans with volume discounts.
This workflow removes the friction from contract analysis. Documents flow in, analyses flow out, and your team gets to focus on decision-making rather than paperwork.
More Recipes
User onboarding video series from feature documentation
SaaS companies need to convert technical documentation into engaging onboarding videos for different user segments.
Course curriculum and assessment generation from subject outline
Educators spend weeks designing course materials and assessments when they could generate them from a high-level curriculum outline.
Technical documentation generation from code
Developers struggle to maintain up-to-date documentation alongside code changes.