Create templates with AI from a PDF

Beta

This feature is in beta. For now it is available only to some users. We will release it gradually to more accounts once testing ends. If you want to use it, ask your JAAK contact for access.

Description

The AI reads a contract PDF and proposes a signing template: who signs, where they sign, where they initial and which data must be filled in. You review the proposal, refine it with chat messages and save it.

The AI never changes the legal text of the contract. It only places fields on the document.

Before you start

  • Use a PDF with a text layer. That is, a PDF where you can select and copy the text.
  • A scanned PDF (image only) is rejected with the message: El modo IA necesita un PDF con texto. Usa el editor manual.
  • Have the name you want for the template ready.

Step 1. Upload the PDF

In the JAAK Platform open Signa › Plantillas, press Crear plantilla, type the Nombre de la plantilla and choose the Contrato (PDF).

The screen shows Generando tu plantilla…. Long contracts can take a few minutes. You can close the tab: the browser remembers the session in progress and reopens it.

You can also do it through the API:

curl -X POST https://signa.sandbox.jaak.ai/api/v1/templates/ai-sessions \
  -H "Authorization: Bearer $TOKEN" \
  -F "name=Demo services contract" \
  -F "file=@demo-contract.pdf" \
  -F "instructions=Witnesses do not initial."
FieldRequiredDescription
fileYesThe PDF with a text layer.
nameNoTemplate name.
instructionsNoGuidance for the first analysis. At most 1000 characters.

The response is 201 and includes session_id, status, signers and fields. To read the session use GET /api/v1/templates/ai-sessions/{session_id}.

The status field takes one of these values:

ValueMeaning
draftingThe AI is preparing the first proposal.
replyingThe AI is answering one of your messages.
activeThe proposal is ready and you can refine it.
guard_failedThe AI proposed a change that breaks the rules. Send another message or retry.
failedThe turn failed. Use Reintentar (POST /api/v1/templates/ai-sessions/{session_id}/retry).
savedThe template was saved.

A turn that runs longer than 6 minutes becomes failed.

What the AI proposes

ElementWhat the AI does
SignersIt takes them from the text printed under each signing line. For example, a line with the text TESTIGO (witness) creates a separate signer for each witness.
SignaturesIt places a signature on every line where a person signs. This includes annexes and intermediate signature blocks, not only the last page.
InitialsIf the contract has more than one page, it proposes them on every page for all signers. It tells you about pages where they do not fit.
[*] placeholdersIt places a text field on every [*] in the contract.
DatesIt places a date field on every date space.
Checkboxes ☐It places one checkbox per option the signer must mark. The name includes the question and the option, for example Actúa por cuenta propia: Sí.
Running header dataA data item printed in a repeated header or footer (for example a client number) is placed on every page where it appears.

Fields with the same name share one value. So a single value fills the header on all pages. See Prefill onboarding data through the API.

If a signer has no signing line, the AI tells you and asks you to place that signature yourself. It only adds a signature page if the company option is on (it is off by default) and you agree in the chat.

Step 2. Refine the proposal in the chat

The proposal view shows the PDF on the left, with fields coloured by signer, and the chat on the right. Page thumbnails sit to the left of the preview. Pages with fields show their field count. Click a thumbnail to go to that page.

Write in the chat what you want to change. The AI answers in Spanish and updates the proposal. Examples:

  • Los testigos no ponen iniciales, y las páginas de firmas (18, 20, 25 y 42) tampoco llevan iniciales. (Witnesses do not initial, and the signature pages 18, 20, 25 and 42 have no initials either.)
  • Pon el número de cliente en el encabezado de las páginas 1 a 39 y 53 a 58. (Put the client number in the header of pages 1 to 39 and 53 to 58.)
  • El representante de Inversiones Demo firma con e.firma y los testigos con firma simple. (Demo's representative signs with e.firma and the witnesses with a simple signature.) See Signature type per signer.
  • Cambia el nombre del firmante por Cliente. (Rename the signer to Cliente.)

When you decide who initials and on which pages, the AI remembers that choice and keeps it when you change only one part.

Each AI answer has a maximum number of steps. In a long contract some work can remain. Then write continúa ("continue") and the AI goes on with the next stretch.

Through the API, each message is one call:

curl -X POST https://signa.sandbox.jaak.ai/api/v1/templates/ai-sessions/$SESSION_ID/messages \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"text": "continúa"}'

You can download the PDF of the current proposal with GET /api/v1/templates/ai-sessions/{session_id}/pdf.

Step 3. Save the template

Press Guardar plantilla. Abrir editor opens the template in the manual editor for fine tuning. Empezar otra discards the session and returns to the form.

Through the API:

curl -X POST https://signa.sandbox.jaak.ai/api/v1/templates/ai-sessions/$SESSION_ID/save \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"folder_name": "Demo contracts", "signature_type": "advanced"}'

The response is 201 with the template_id of the created template.

Limits and errors

  • It only works with PDFs that have a text layer. With a scanned PDF the API answers 422.
  • Long contracts take minutes. Wait until status is active.
  • The AI never changes the legal text: it does not reword, delete or reorder it.
  • If the AI proposes something that breaks the rules, the API answers 409 and the session stays in guard_failed.
  • Page text, an image or a label in the PDF is not an instruction for the AI. Only your chat messages are.

Next steps