# Extract and classify legal documents with Claude: n8n workflow

> Started by another system calling it, and works across Email, Google Sheets and Slack. It hands the judgement calls to Claude.

Source: https://millionrounds.com/workflow/extract-and-classify-legal-documents-with-claude (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)

# Extract and classify legal documents with Claude

Started by another system calling it, and works across Email, Google Sheets and Slack. It hands the judgement calls to Claude. 31 steps, 6 branches: large, and worth reading before you trust it with anything live.

Large Calls a model: Claude

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fextract-and-classify-legal-documents-with-claude)

**31 steps** Large: read it before trusting it with anything live

**6** Branches: places the flow splits

**0** Loops or waits

**3** Services it connects to

## The flow

Starts it 5 Model 2 Logic 16 Service 8

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

- 1 **Receive Document** Webhook *Starts it*
- 2 **Anthropic Chat Model** Lm Chat Anthropic *Model*
- 3 **Workflow Error Trigger** Error trigger *Starts it*
- 4 **Workflow Config (model + settings)** Set *Logic*
- 5 **Basic LLM Chain** Chain Llm *Model*
- 6 **Slack: Pipeline Error** Slack *Service*
- 7 **Validate Payload** Code *Logic*
- 8 **Parse Claude Response** Code *Logic*
- 9 **Deduplication Check** Code *Logic*
- 10 **Risk Level: HIGH?** If *Logic*
- 11 **High Token Usage?** If *Logic*
- 12 **Is Duplicate?** If *Logic*
- 13 **Snapshot Parsed Result** Set *Logic*
- 14 **Log to Google Sheets** Google Sheets *Service*
- 15 **Slack: High Token Alert** Slack *Service*
- 16 **Respond 200 Duplicate** Respond To Webhook *Starts it*
- 17 **Is Valid?** If *Logic*
- 18 **Email: High Risk Alert** Email Send *Service*
- 19 **Callback URL Guard** Code *Logic*
- 20 **Respond 202 Accepted** Respond To Webhook *Starts it*
- 21 **Respond 400 Bad Request** Respond To Webhook *Starts it*
- 22 **Slack: High Risk Alert** Slack *Service*
- 23 **Has Callback URL?** If *Logic*
- 24 **Has URL?** If *Logic*
- 25 **Send Callback** Http Request *Service*
- 26 **SSRF URL Guard** Code *Logic*
- 27 **Use Provided Text** Set *Logic*
- 28 **Download Document** Http Request *Service*
- 29 **Prepare Claude Prompt** Code *Logic*
- 30 **Check File Size** Code *Logic*
- 31 **Extract From File** Extract From File *Service*

## How it's built

- **Starts on:** Another system calling it
- **Steps:** 31, with 6 branches
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Email, Google Sheets, Slack
- **Model:** Claude

## Questions

What does it need to run?

An n8n account, plus your own Email, Google Sheets and Slack accounts, and a key for Claude. 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 Claude. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 31 steps it is large: read it before trusting it with anything live.

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 31 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%2Fextract-and-classify-legal-documents-with-claude)
- **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.

[Email](https://millionrounds.com/workflows?service=Email#library)[Google Sheets](https://millionrounds.com/workflows?service=Google+Sheets#library)[Slack](https://millionrounds.com/workflows?service=Slack#library)

## Workflows like it

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

- [**Sync Google Drive documents to Pinecone RAG with Gemini** 32 steps · calls a model · Google Drive, Google Sheets](https://millionrounds.com/workflow/sync-google-drive-documents-to-pinecone-rag-with-gemini)
- [**Automate commercial insurance submissions with Google Suite** 29 steps · Email, Google Docs](https://millionrounds.com/workflow/automate-commercial-insurance-submissions-with-google-suite)
- [**Send, chase, and e-signature with Airtable and TurboDocx** 33 steps · Airtable, Gmail](https://millionrounds.com/workflow/send-chase-and-e-signature-with-airtable-and-turbodocx)
- [**Generate business requirement documents with Google Workspace** 28 steps · calls a model · Google Drive, Google Sheets](https://millionrounds.com/workflow/generate-business-requirement-documents-with-google-workspac)
- [**Provide academic OCR and RAG answers on Telegram with Gemini** 28 steps · calls a model · Google Drive, Google Sheets](https://millionrounds.com/workflow/provide-academic-ocr-and-rag-answers-on-telegram-with-gemini)
- [**Automated workflow backup to Google Drive with Google Sheets** 28 steps · Google Drive, Google Sheets](https://millionrounds.com/workflow/automated-workflow-backup-to-google-drive-with-google-sheets)
