# Intelligent legal document review and compliance automation: n8n workflow

> Started by another system calling it, and works across Postgres. It hands the judgement calls to OpenAI. 17 steps: a working afternoon to understand properly.

Source: https://millionrounds.com/workflow/intelligent-legal-document-review-and-compliance-automation (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Documents and files](https://millionrounds.com/workflows?category=Documents+and+files#library)

# Intelligent legal document review and compliance automation

Started by another system calling it, and works across Postgres. It hands the judgement calls to OpenAI. 17 steps: a working afternoon to understand properly.

Medium Calls a model: OpenAI

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fintelligent-legal-document-review-and-compliance-automation)

**17 steps** Medium: a working afternoon

**0** Branches: places the flow splits

**0** Loops or waits

**1** Service it connects to

## The flow

Starts it 1 Model 11 Logic 2 Service 3

The steps in the order they run, from what starts it.

- 1 **Document Upload Webhook** Webhook *Starts it*
- 2 **OpenAI Model - Clause Analysis** Lm Chat Open Ai *Model*
- 3 **Clause Analysis Output Parser** Output Parser Structured *Model*
- 4 **OpenAI Model - Compliance** Lm Chat Open Ai *Model*
- 5 **Compliance Output Parser** Output Parser Structured *Model*
- 6 **OpenAI Model - Alternative Wording** Lm Chat Open Ai *Model*
- 7 **Alternative Wording Output Parser** Output Parser Structured *Model*
- 8 **OpenAI Model - Summary** Lm Chat Open Ai *Model*
- 9 **Workflow Configuration** Set *Logic*
- 10 **Clause Analysis Agent** Agent *Model*
- 11 **Compliance Check Agent** Agent *Model*
- 12 **Alternative Wording Agent** Agent *Model*
- 13 **Summary Report Generator** Agent *Model*
- 14 **Extract Document Text** Extract From File *Service*
- 15 **Prepare Database Record** Set *Logic*
- 16 **Log to Contract Database** Postgres *Service*
- 17 **Send Notification** Http Request *Service*

## How it's built

- **Starts on:** Another system calling it
- **Steps:** 17
- **Size:** Medium: a working afternoon
- **Connects to:** Postgres
- **Model:** OpenAI

## Questions

What does it need to run?

An n8n account, plus your own Postgres account, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on another system calling it.

Does it use AI?

Yes. It calls OpenAI. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Plan an afternoon. 17 steps is enough that you should read each one before running it.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 17 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fintelligent-legal-document-review-and-compliance-automation)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Postgres](https://millionrounds.com/workflows?service=Postgres#library)

## Workflows like it

Also documents and files, with the same services where possible, closest in size first.

- [**Automated document sync between SharePoint and Google Drive** 15 steps · Google Drive, Postgres](https://millionrounds.com/workflow/automated-document-sync-between-sharepoint-and-google-drive)
- [**Build an OpenAI RAG system with Postgres** 20 steps · calls a model · Postgres](https://millionrounds.com/workflow/build-an-openai-rag-system-with-postgres)
- [**Telegram AI chatbot with OpenAI and PGVector RAG** 24 steps · calls a model · Google Drive, Postgres](https://millionrounds.com/workflow/telegram-ai-chatbot-with-openai-and-pgvector-rag)
- [**Generate PDF documents from HTML with PDF Generator API** 10 steps · Gmail, Postgres](https://millionrounds.com/workflow/generate-pdf-documents-from-html-with-pdf-generator-api)
- [**Create RAG vector database from Google Drive documents** 9 steps · calls a model · Google Drive, Postgres](https://millionrounds.com/workflow/create-rag-vector-database-from-google-drive-documents)
- [**Index Google Drive files into a Supabase vector store** 26 steps · calls a model · Google Drive, Postgres](https://millionrounds.com/workflow/index-google-drive-files-into-a-supabase-vector-store)
