Get started

Introduction

Docgen turns what your user needs into a finished, state-specific legal document: a lease, an NDA, a will. Your product keeps the user and the file; we do the drafting.

How it works

  1. Start a session. POST /v1/sessions takes your user's first message, like “lease for my condo in Miami”. The session finds the form: it confirms a clear match, offers a choice between several, or asks until it knows.
  2. Talk. POST /v1/sessions/{session}/messages sends what the user typed, or a typed answer to the question on screen. The session asks the form's questions one at a time, with follow-ups only when an answer calls for them.
  3. Generate. When the session is ready, it offers actions. document.generate comes with the exact POST /v1/documents request to make. The document is a durable job: poll it or stream it, then download the files.

What stays yours

The API has no end users. Your users sign in to your product, you call us from your server, and you name each user only by your own reference in Docgen-Subject (Subjects). Sessions are deleted 7 days after they start. Files are temporary: links stop working at expires_at (7 days by default), so download what you want to keep.

AiLawyer is not a law firm. Documents generated through the API are not legal advice and don't create an attorney-client relationship. Your product should tell its users the same.

Where to go next

  • Quickstart: from a test key to a downloaded document.
  • Sessions: phases, questions and actions.
  • Subjects: naming your users, and why only your server calls us.
  • API reference: every endpoint, parameter and error.