DakiyAi
How-toMay 26, 2026·9 min read

How to automate your listing agreements and leases (without expensive software)

The exact mechanics to generate compliant listing agreements and residential leases in under 3 minutes: ID OCR, land title parsing, legal validation, PDF generation, Drive archiving.


Out of the hundreds of tasks a real estate agency handles every month, two consistently emerge as the best candidates for automation: drafting listing agreements and residential leases. Three reasons: they're long manually, they're repetitive, and they're risky — a single error can break the legal validity of the document.

This article walks through the full mechanics to automate both: architecture, workflow steps, edge cases to handle, and real cost of getting it to production. It's the operational follow-up to our complete guide to real estate automation.

Why these two documents first?

A Moroccan real estate listing agreement drafted cleanly (with co-owners, ANCFCC land title, net and public prices written in words, signatures from every rightful party) takes 60 to 90 minutes for an assistant or agent. At 10 agreements per month, that's a full work week.

Same for a residential lease: between entering tenant info (sometimes 5 for shared housing), checking the legal deposit cap (Moroccan Law 67-12 = 2 months max), drafting furnished/unfurnished clauses, handling a proxy if the landlord isn't present — you're at 45 to 60 minutes per contract. And the cost of an error is high: a miscalculated deposit can void the lease.

Well automated, both ship in 2 to 3 minutes, with no manual entry risk and clean per-property archiving.

Anatomy of an automated listing agreement: the 4 steps

Here's the pipeline we deploy at our clients for our Mandat Auto automation. The architecture is deliberately modular so each step can be debugged or improved independently.

Step 1 — Upload and setup

The user submits documents via a web form (Telegram Bot, WhatsApp Business API, or a plain React form):

  • ID documents: national ID cards (old and new format), passports (French, Spanish, Italian, British, Moroccan…), residency cards for foreign residents. Accepted formats: smartphone photo, scan, PDF.
  • ANCFCC land title: bilingual Arabic/French, a scanned document is enough.
  • Habitation permit: if required by the agreement.
  • Agreement parameters: type (exclusive, semi-exclusive, non-exclusive), net seller price, public price, commission rate, agreement duration.

Step 2 — Parallel AI reading (OCR + structured extraction)

All documents are sent in parallel to a multimodal model (GPT-4o, Claude 3.5 Sonnet, or Gemini 2.0) with a strict output schema (Pydantic or JSON Schema). The AI extracts:

  • Identity: first name, last name, ID number, date of birth, address, nationality.
  • Land title: number, area, location, description, and — critical — the list of co-owners with their exact shares (X/Y fractions).
  • Transliteration: names and addresses in Arabic script are automatically converted to Latin per standard conventions.

Small technical note: do the extraction in parallel, not sequentially — otherwise you wait 30 seconds per agreement when you could do it in 8.

Step 3 — Automatic validation

This is the step that separates a demo from a production system. The workflow must run three checks before generating anything:

  1. Signer cross-check: each person supplied as a signer is cross-referenced against the official co-owners on the title. Mismatch = alert. Forgotten party = automatically added as "represented by proxy."
  2. Price compliance: net, public, and commission prices are written out in words (legal requirement in Morocco).
  3. Cross-document consistency: name on ID ↔ name on title, plausible dates, coherent prices.

On uncertainty, the workflow pauses and asks the user to confirm via a Telegram form ("the name on the ID is X, on the title it's Y — same person?"). This is what's called a human-in-the-loop gate — it converts a silent risk into an explicit question.

Step 4 — Generation and delivery

Once validated, the system generates:

  • An editable DOCX from a Word template (python-docx or docxtemplater on Node).
  • A ready-to-sign PDF (conversion via headless LibreOffice or Puppeteer).
  • A smart filename: property_owner_yyyymmdd.pdf — not agreement_v2_final_REALLY_final.pdf.

Delivery: dedicated Google Drive folder per property, plus instant Telegram notification with the download link.

The edge cases that break a naïve system

In theory, simple. In practice, here are the cases we hit on nearly every Moroccan agreement that blow up a poorly-designed LLM prompt:

  • Co-ownership with complex fractions: a property held at 5/16, 3/16, 4/16, and 4/16 by 4 people. The model has to read the exact fractions from the title, not guess them.
  • Absent co-owners: the proxy must be referenced by its certification date. The template must insert the representation clause automatically.
  • Bilingual Arabic/French title: the AI must read both scripts. Arabic names get systematically transliterated to Latin for the agreement.
  • Poor-quality document photos: blurry, backlit, shot crooked. The pipeline must preprocess (deskew, denoise) before passing to the LLM.
  • Missing habitation permit: if the document is required by the template but absent, ask the user to provide it rather than hallucinating it.

Residential lease: Law 67-12 (Morocco) specifics

Our BailGen automation follows the same 4-step architecture, with a few checks specific to Law 67-12:

  • Legal deposit cap: automatically capped at 2 months' rent. If the user enters 3 months, the workflow brings it down to 2 and emits a warning.
  • Furnished / unfurnished clauses: selected automatically based on the input parameter, each with its own inventory and restitution regime.
  • Tacit renewal: included by default unless explicit opt-out.
  • Corporate landlord: company name, legal form, corporate ID, registration number, registered address, legal representative — all integrated into the landlord clause. The OCR reads the legal rep's ID separately.
  • Up to 5 tenants: each with their own ID, profession, nationality, and signature line.

What about France? Where it diverges

A French lease follows similar logic but with different constraints: Alur law, rent control in tight zones (Paris, Lille, Lyon…), mobility lease, mandatory inventory of fixtures. A good French automation must embed the local reference rent grid and block generation if the proposed rent exceeds the legal cap.

DakiyAi can adapt BailGen to the French framework — let's talk about it on a discovery call.

Tools: custom GPT, n8n + LLM, or dedicated SaaS?

Three approaches we see regularly, and our verdict on each:

  • A custom GPT (ChatGPT): easy to configure, but zero output control. No co-owner validation, no archiving, no notifications. Fine for a demo, not for production.
  • n8n + LLM: the combo we recommend. n8n orchestrates the steps (form, OCR, validation, generation, archiving). The LLM is called for structured extraction only. You stay owner of the workflow and the data.
  • Dedicated SaaS (Mandat-Express, Bailfacile-style…): fast to set up but you depend on the vendor, you pay per use, and you can't customize the template beyond what they offer.

Cost and time to production

For ballpark numbers (adjust to your context):

  • Deployment time: 1 to 2 weeks for Mandat Auto, 2 weeks for BailGen (slightly more due to furnished/unfurnished/corporate/proxy variants).
  • Marginal cost per document: a few cents to a few dozen cents in LLM API calls (depending on the model and the length of the OCR'd documents).
  • Infrastructure: a $10/mo VPS is enough to host n8n and process several hundred documents per month.

Go deeper

Listing visuals are the other big automation family to attack in parallel — see our article on real estate listing photos: AI staging, retouching, and video. And for calculating the cumulative ROI of these automations on your agency, see ROI of real estate automation.

Co-founded by Othman Kaddach (who also runs the Nesty agency), we battle-test every automation in the field before offering it. See who we are, or book a call to talk through your own flow.