--- name: formify-send-contract description: 'Send a contract or document for e-signature through Formify. Use when sending something to be signed, from a saved template, an uploaded PDF, or a document drafted in this conversation. Triggers on "send for signature", "send this contract", "e-sign", "signing request", "skicka för signering", "skicka kontrakt", "enviar para firmar". Not for a reusable link anyone can sign (formify-share-link) or checking who signed (formify-track-signatures).' license: MIT metadata: version: "1.6.5" --- # Send a document for signature Version 1.6.5. If asked which version you are, quote this line. ## Purpose Take a document — a saved Formify template, a PDF the user has, or one drafted here — place the signature fields, let the user check the result, and send it to the people who must sign. ## When this applies - Sending anything for signature, from any of those three starting points. - Collecting signers, choosing how the invitation reaches them, choosing how they sign. - Previewing where a signature will land before anyone is contacted. ## When it does not - **Building or editing the PDF itself** → `formify-pdf-forms`. - **Choosing an identity check** → `formify-verify-identity` decides *what* verification is needed; this skill configures it on the signer. - **Anything after the send** → `formify-track-signatures`. - **One reusable link that anyone may open and sign** → `formify-share-link`. This skill invites named people to one document. That one publishes a link with no recipients, and produces a separate document per signer. If the user cannot name who will sign, they want the other skill. ## Preconditions A connected Formify account. **Call `get_account_capabilities` first, every time.** It decides which delivery channels and which signing methods you may offer. Offering a feature the account does not have wastes the user's time and is the fastest way to lose their trust. ## Procedure ### 1. Announce what is possible, then take one starting point Before asking anything: > I can send a document for signature. We can use one of your saved templates, a PDF you > upload, or I can draft one here first. Signers can sign by hand, or with BankID, an ID > scan or a face check if your plan includes them. I can also send an AI assistant along > inside the document, so the recipient can ask it questions instead of asking you. > > Which would you like to start from? One question at a time from here on. Never present a form of six questions. ### 2. Get the document in place **From a template.** List templates and let the user pick by name — never show IDs. Read the template and its fields. A template carries its own signer count and its own pre-configured signature settings; **do not override them unless the user explicitly asks.** If the user wants a different number of signers than the template defines, it is possible, but warn that signature placement may be wrong. **From a PDF.** The file must not be password-protected, and must not already carry a digital signature from another service. Check before uploading; neither can be removed here. Four upload routes, **exactly one per upload** — a host file reference, a URL, a staged upload id, or the bytes. Try them in this order and say which one you used: 1. **A file reference the host supplied**, when the user attached the file and this environment passes attachments through to tools. Pass it exactly as given; the server fetches the bytes itself. Never build one by hand and never put a local path in it. If the user did attach a file but no reference arrived, retry the call once before falling to another route — the reference sometimes lands on the second attempt. 2. **A public HTTPS URL** — works in every environment. Prefer it whenever a URL exists. 3. **A staged upload**, when shell commands are available: request the upload URL, run the returned command, and wait for it to return success **before** registering the file. The upload goes to the host named in the returned URL — normally the Formify MCP host — not to the document API host. **Requesting a new staged upload replaces any active one for that user.** Stage and consume one file completely before starting the next, or the earlier one is lost. 4. **Base64**, when the complete untruncated bytes are available here. This is supported. It needs the filename alongside it. **Verify the bytes are complete before sending them.** Assistants routinely truncate long strings, and a truncated base64 payload uploads a corrupt PDF that fails silently rather than erroring — prefer an earlier route whenever one is available. The practical ceiling is small: base64 is a third larger than the file, so anything past roughly 30–50 kB of PDF exceeds what can be emitted in one message. The ceiling is 50 MB per file. If one route fails, say which and offer another. Do not retry the same one. **Several documents into one.** Two to eight uploaded PDFs can be merged into a single file for signing. The order given is the page order. The originals are kept, so a merge is safe to redo. **Drafted here.** Build it with `formify-pdf-forms`, then continue from route 3 or 4. **From something already sent.** A document that went out before can be copied — its file, signature fields, signers, language, sharing and AI assistant come with it. The copy arrives as a **draft, and nothing is sent**: that is deliberate, because re-sending a contract to the same people on one click is almost never what was meant. Review it, adjust, then send. A draft can be copied the same way, which is the cheapest way to build several similar documents from one prepared starting point. Neither copy costs anything; the signature charge happens on the send, as always. Signature progress is never copied — every field in a copy starts unsigned. Any payment requirement on the source **is** carried over, so check it before sending. ### 3. Discover the fields, and offer to pre-fill Always read the document's fields after loading it. Filter to the editable ones; skip read-only fields entirely. If there are editable fields, ask the one question that matters: > Shall I fill these in now, or leave them for the signer? A value you fill is locked for the signer. Blanks are left for them. **Locking is not automatic — you have to ask for it.** The read-only mode for fields defaults to keeping whatever the original PDF had, which leaves your pre-filled values editable. Set the mode to the one that locks filled fields **whenever you supply any field value**; otherwise a signer can quietly change the price you just wrote. The third mode, which locks every field including the blanks, is for a document nobody is meant to complete. **Use the exact field names the API returned.** Never construct or guess one. **Value format — two rules, and breaking either fails the send:** - Only single-line text and radio buttons take a plain string. **Checkboxes, dropdowns and list boxes must be an array, even for one value.** - Never send an empty string. Omit the field instead. ### 4. Collect the signers Each signer needs a full name and **at least one** of an email address or a phone number. Both is fine. **A phone number alone is enough.** Do not insist on an email. A signer reachable only on WhatsApp is a normal case, not an edge case, and refusing it turns away business the platform supports. Delivery channel, gated on capabilities: email is always available; SMS needs `deliverySms`; WhatsApp needs `deliveryWhatsapp`. **A document takes at most 18 signees.** A larger signing — a board resolution, a residents' association — is several documents, and it is better to say so while collecting names than to fail at the send. A personal message may run to 500 characters, but **keep it under about 250 for SMS and WhatsApp**, where the rest is what gets cut off on the recipient's phone. If the user wants to distribute the links themselves rather than have Formify invite anyone, suppress the invitation when creating the document, then hand over the personal links with `formify-track-signatures`. Suppression covers **invitations only** — including the invitation each person gets when their turn comes in a signing order. Reminders and the completed-document email still go out. Signing order — who must sign first — is available when the account has `signingOrder`. **One document, or one each? Ask — do not assume.** `create_document` creates **one** document and places every entry of `signeeDetails` on it. Those people sign the same copy, appear to one another, and all receive the completed document. That is right for a contract between parties and wrong for the same text sent to unrelated people. | The user says | What they mean | What to build | |---|---|---| | "Send it to both tenants" | One agreement, two parties to it | One document, two signees | | "Send this NDA to the three freelancers" | Three separate agreements | Three documents, one signee each | The test is disclosure: **would it be wrong for these signers to see each other's names and receive each other's signed copy?** If yes, they are separate documents, not one document with several signees. For separate documents, choose the template or upload the file once, then call `create_document` once per person with a single-entry `signeeDetails`. Give each one a name that identifies the recipient — `NDA — Maria Alvarez`, not three documents called `NDA` — because that name is what `list_documents` returns and what the user reads when they ask who has signed. Identical names make tracking useless. The tool interface does not state whether one `fileId` may back several documents. Reuse it, and if a later call rejects it, upload the file again for that person. Count out loud before creating anything: *"That is three separate NDAs, so three invitations go out."* Each one is a real message to a real person and none of them can be recalled. ### 5. Choose how each signer signs Four methods, each gated. Ask only if the account has more than the default and the template does not already decide it. | Method | Requires | |---|---| | Handwritten signature | always available | | BankID | `signatureBankId` | | ID scan then signature | `signatureIdScan` | | Face check | `signatureFaceLiveness` | **ID-scan signing needs two boxes placed, not one:** the signature box *and* a separate ID-scan box. Configuring only the signature box is the most common cause of a failed send in this area. See `references/signature-placement.md`. Methods are per signer. Different people on one document can use different methods. ### 6. Place the signature Ask where it goes: a new page at the end — the default and the safe choice — or a specific position on an existing page. For an existing page you need page, x and y. - **Pages are numbered from zero.** The first page is `0`. Getting this wrong puts the signature on the wrong page, and the document still sends. - Origin is the **top-left** corner. x increases right, y increases **down**. (x, y) is the top-left corner of the field. - A standard signature field is **219 × 58 points**. - **Coordinates must be whole numbers.** A decimal is not rounded — it is discarded, and `74.7` is stored as `0`, putting the field in the corner of the page. Round before sending. - Check the actual page size. A4 is 595 × 842 points; US Letter is 612 × 792. Do not assume. Bottom-right on A4: x = 595 − 219 = 376, y = 842 − 58 = 784, page = 0. **Formify does not detect overlapping fields, and a field is fully opaque.** Anything behind it is hidden, and nothing warns you. Never place a field over text the signer needs to read. Where space is tight, shrink the field with a scale factor between 0.25 and 1.5 rather than moving it onto the text. ### 7. Preview before sending — always offer it This is the step that catches a misplaced field, and it is the one the user actually cares about. Create a draft with exactly the configuration you would have sent, then show the rendered PDF. Two ways to present it; pick by what this environment can do: - **Inline**, if PDFs can be displayed here. - **A one-time link** the user opens in a browser. It needs no login, expires in ten minutes and is consumed once used. If neither works, say so plainly and offer to send without a preview — but say what is being skipped. **Check what came back before showing it.** This is the most common bug in this flow, and it is invisible: the user confirms a document that is not the one being sent. - The file must begin with the bytes `%PDF`. An expired or blocked link returns an HTML error page, which saves happily under a `.pdf` name. - It must be larger than about a kilobyte. A near-empty file is a failed download. - Give the preview its own filename, distinct from the uploaded source — something like `