Skip to content

Integration

The core of Legal Engine is the Builder. The Builder is a hosted UI to which you redirect your end-users. To start using the Builder, you need a template. You can allow your end-users to choose a template using our hosted Template Browser, or you can create your own customized template browser UI using our API.

What is template?
Template is our proprietary format for defining a set of questions and logic to generate highly customizable and trustworthy legal documents. Each template belongs to one or more jurisdictions (usually just one as legal requirements differ across them), and can be available in multiple languages. For example, the Finnish Employment Agreement template is available in three languages: Finnish, English, and Swedish. The end-user can choose which language version they want to draft.

As part of your account setup, we can choose which templates are available via the API and via the Template Browser.

Template Browser

To use the Template Browser, you must create a new browser session. Then, redirect your end-user to the provided URL. Once the end-user selects their template, they will be redirected back to the return URL you provided. In most cases, you will then immediately start a new Builder session using the provided data and redirect the user back to our UI.

Docue UIDocue APIIntegratorDocue UIDocue APIIntegratorPOST /api/browser/sessionsRedirect url and session idRedirect user to Template BrowserUser chooses the templateRedirect to provided return url with template id + language
Docue UIDocue APIIntegratorDocue UIDocue APIIntegratorPOST /api/browser/sessionsRedirect url and session idRedirect user to Template BrowserUser chooses the templateRedirect to provided return url with template id + language

Builder

To use the Builder, you must create a new builder session. Then, redirect your end user to the provided URL. Once the end user completes the document, they will be redirected back to the return URL you provided. After that, you can fetch the completed PDF and metadata, including the list of signees, using the API.

Docue UIDocue APIIntegratorDocue UIDocue APIIntegratorPOST /api/builder/sessionsRedirect url and session idRedirect user to builderUser updates the documentUser finalizes the documentRedirect to return urlRequest PDF + metadataPDF + metadata
Docue UIDocue APIIntegratorDocue UIDocue APIIntegratorPOST /api/builder/sessionsRedirect url and session idRedirect user to builderUser updates the documentUser finalizes the documentRedirect to return urlRequest PDF + metadataPDF + metadata

Once the drafting UI redirects back to your service you can manage the document lifecycle via the Builder endpoints:

  • PATCH /api/builder/sessions/{session_id} to update builder session settings (for example, trial mode configuration).
  • GET /api/builder/sessions/{session_id}/contract to fetch the latest contract state.
  • POST /api/builder/sessions/{session_id}/contract/finalize to lock the document when it is ready.
  • POST /api/builder/sessions/{session_id}/contract/unfinalize to revert a finalized document back to an editable state.
  • GET /api/builder/sessions/{session_id}/html or GET /api/builder/sessions/{session_id}/pdf to retrieve the rendered output.
  • GET /api/builder/sessions/{session_id}/export to export session data as ZIP.
  • POST /api/builder/sessions/import to import an exported ZIP and create a new session.