{{SIGN_HERE}} or similar, though any literal string works — pass an anchor_tags array in your create request, and Firma searches the document for each string and places a field wherever it finds a match.
Anchor tags only work with document-based creation — a request that includes
document (base64) or document_id. They have no effect on template_id-based requests, because the anchor pipeline searches the uploaded document itself; a template’s fields are already positioned.How matching works
anchor_string is matched as literal, case-insensitive-by-default substring text anywhere in the document — there’s no required delimiter syntax. {{...}} is just a convention that’s visually easy to spot in a document and unlikely to collide with real content; "Sign Here:" or "X_____" work exactly the same way.
Each anchor tag supports:
Default field sizes
If you don’t passwidth/height on an anchor tag, the field is sized by type (as a percentage of the page):
Hiding anchor text
Two independent, combinable options control what happens to the marker text and the area around it once a field is placed:
Because
remove_anchor_text only changes how the text is painted, it never removes the string from the document’s text layer:
A document processed with
remove_anchor_text: true (the default) looks like the anchor text is gone in any PDF viewer — but running text extraction (pdftotext, a PDF library’s extractText, etc.) against the same file still returns the literal anchor string. This applies to the finished, signed document too, not just the version before signing. If you see a support report that anchor text is “still there” after processing, this is almost always the explanation: the text is invisible, not deleted, and the signature itself is a separate image layer placed at the anchor’s coordinates.remove_anchor_text hides the marker glyphs, add_white_background covers the full field footprint.
DOCX documents
There’s no DOCX-specific anchor-matching logic. A DOCX upload is fully converted to PDF first, and the exact same text-search pipeline described above then runs against the resulting PDF:- The first bytes of the uploaded file are sniffed to detect DOCX (a ZIP-format file) vs. PDF.
- A DOCX is converted via
mammoth(DOCX → HTML) and then re-laid-out from scratch onto a fixed A4 page with fixed margins and a fixed font-size table — it is not a rasterization of the original Word pagination. - Anchor matching runs against this freshly-rendered PDF.
type values you can use.
PDF documents
For a native PDF upload, anchor matching runs directly against the document: positioned text is extracted page by page, adjacent text fragments on the same line are merged (so an anchor string split across separate PDF text-show operators by the original PDF producer is still found as one match), and each match is converted from PDF points into a page-relative percentage position for the new field.Match position is approximated proportionally from character index within a text run, not from exact per-glyph kerning. On proportional (non-monospace) fonts, a placed field can be very slightly off-center relative to the exact anchor text. This is rarely visible at normal field sizes, but worth knowing if you need sub-pixel placement accuracy.
PDF vs. DOCX at a glance
Complete example
This request creates and sends a document with three anchor-placed fields: a signature, a date defaulting to the day of signing, and a read-only text field pulling from a fixed value.recipient_id uses a temporary id (temp_1) here because the recipient is defined in the same request (document-based creation). Fields resolved from anchor tags are merged with any manually specified fields in the same request, and once created they’re ordinary field rows — the response doesn’t distinguish an anchor-placed field from a manually positioned one, and doesn’t expose which anchor string or occurrence produced it.Gotchas
Removed anchor text is hidden, not deleted — plan for it showing up in extraction
As covered above,remove_anchor_text never deletes characters from the PDF; it only stops them from being painted. If your own compliance or redaction requirements mean a marker string can never appear in programmatic text extraction of the final signed document, anchor tags as implemented today can’t satisfy that — choose anchor strings you’re comfortable having permanently present (invisibly) in the file, or don’t rely on this API to scrub them.
Reprocessing an already-anchored document re-matches the same anchors
Because the anchor text is only visually hidden, a document you’ve already run through anchor-tag processing still matches the sameanchor_string values if you pass it (or a copy of it) back into a new create request with the same anchor_tags. The invisible text is indistinguishable from visible text to the matching step. Always run anchor tags against your original, unprocessed source document — not against a document you already generated from a previous anchor-tag request.
Anchor-tag font styling mostly doesn’t persist
An anchor tag acceptsfont_family, font_size, font_color, and text_align. Only font_size actually reaches the created field — it’s merged into format_rules.fontSize (clamped to 8–48). font_family, font_color, and text_align are resolved internally but dropped before the field is saved, so setting them on an anchor tag has no visible effect.
stamp, file, and approval_* anchor types need explicit sizing
stamp, file, approval_signature, approval_checkmark, and approval_date all pass server-side validation as anchor type values, but none has a dedicated default-dimensions entry, so all five silently inherit the text default (20% × 3%). Pass width and height explicitly for these types.
Next steps
- Sending a signing request for the full recipient and field creation flow
- Field prefilling — the
read_only/read_only_value/format_rules.prefilledDatabehavior that anchor-placed fields also follow once created - Webhooks — subscribe to webhook events to react as anchor-placed fields are completed