Skip to content
ERPDocs

Raw-PDF Sending with Anchor Tags

Normally ERPDocs sends from a template — you upload a PDF once, drag signature and date boxes onto it, and reuse that layout. That works because the document is the same every time.

It stops working when your system generates the document. An invoice, a work order, a policy schedule: every one is a different length, so a signature box pinned to a fixed position on page 3 lands in the wrong place.

Anchor tags solve this. You write a short marker into the document where you want a field, and ERPDocs finds it:

Authorised signatory: {{sig:Supplier}}    Date: {{date:Supplier}}

Send that PDF to POST /api/v1/signpacks. ERPDocs locates each tag, removes it from the final document, and places a real field at exactly that position. No template needed. The field follows the text, however the document reflows.


When to use which

Situation Use
Same document every time, only names and values change A template — see Using Templates with SignPack
Your system generates the document, layout varies Anchor tags
Hundreds of recipients, one identical document Bulk send from a template
No anchor tags in the document A template is still required

Note: a PDF with no anchor tags cannot be sent this way. ERPDocs has no way to guess where a signature belongs on a document it has never seen.


What you need before you start

Item Where it comes from
An API key with the signpack.write scope Admin → API & Webhooks
A document with anchor tags in it Your document generator
A sender email Any active user in your organization

Anchor tag reference

Tag Field type Example
{{sig:Role}} or {{signature:Role}} Signature {{sig:Supplier}}
{{name:Role}} Signer's name {{name:Supplier}}
{{date:Role}} Date signed {{date:Supplier}}
{{text:Role:Label}} Free text {{text:Supplier:Address}}
{{checkbox:Role:Label}} Checkbox {{checkbox:Supplier:I agree}}
{{email:Role}} Email address {{email:Supplier}}
{{number:Role:Label}} Number {{number:Supplier:Amount}}
{{attachment:Role:Label}} File upload request {{attachment:Supplier:Upload ID}}
{{location:Role}} Location {{location:Supplier}}
{{company:Role}} Company name {{company:Supplier}}
{{title:Role}} or {{job_title:Role}} Job title {{title:Supplier}}
{{phone:Role}} Phone number (7–15 digits) {{phone:Supplier}}
{{datesigned:Role}} or {{date_signed:Role}} Signing date, filled in automatically {{datesigned:Supplier}}
{{tag:Value}} or {{tag:Label:Value}} Read-only tag {{tag:Invoice: 12345}}

Role is a label you choose — Supplier, Signer 1, Tenant. It has to match a key in the recipients object you send. Label names the field for the signer and appears in the field editor.

A tag field is creator-only. It renders a fixed value on the document and is never assigned to a recipient — useful for stamping a reference number.

Writing tags that survive PDF generation

Anchor tags are found in the document's text layer, so:

  • Keep each tag on one line. A tag broken across a line wrap will not match.
  • Do not let your generator apply letter-spacing or split the tag across styled runs.
  • Scanned or image-only PDFs have no text layer and will not match anything.
  • Make the tag text small and the same colour as the background if you do not want it visible in your own previews — ERPDocs removes it regardless.

Sending the document

This is a multipart/form-data request, not JSON:

curl -X POST https://www.erpdocs.com/api/v1/signpacks \
  -H "Authorization: Bearer $ERPDOCS_API_KEY" \
  -F "file=@supplier-agreement.pdf" \
  -F "sender_email=ops@yourcompany.com" \
  -F 'recipients={"Supplier":{"name":"Ravi","email":"ravi@example.com"},"Accounts":{"email":"accounts@example.com"}}' \
  -F "title=Supplier Agreement — Acme" \
  -F "signing_order=parallel" \
  -F "expires_in_days=30"
Field Required Notes
file Yes PDF, DOCX or image. DOCX and images are converted to PDF first.
sender_email Yes Must be an active member of your organization.
recipients Yes JSON object keyed by role name, or a list of objects each with a role key.
title No Defaults to the filename.
signing_order No parallel (default) or sequential.
expires_in_days No 1–365. Defaults to 30.
send No true by default. false creates a Draft you can review in the app first.
brand_id No Apply a specific brand profile.

Each recipient accepts name, email, role_type, embedded and suppress_completion_email.

Tip: while you are getting your tags right, send with send=false. That creates a Draft, so you can open it in ERPDocs and see exactly where the fields landed before anything reaches a signer.


How roles become signers

You do not declare who signs. ERPDocs works it out from the tags:

  • A recipient with at least one actionable field (signature, text, checkbox, date, and so on) becomes a Signer.
  • A recipient with no fields becomes CC — they receive a copy and are never asked to sign.

In the example above, Supplier has {{sig:Supplier}} in the document so they sign. Accounts has no tags, so they are simply copied.

Set role_type explicitly on a recipient if you need to override this.


The response

{
  "success": true,
  "signpack_id": 42,
  "status": "Sent",
  "title": "Supplier Agreement — Acme",
  "document_id": 99,
  "recipient_count": 2,
  "field_count": 5,
  "recipients": [
    {"id": 101, "role_key": "supplier", "name": "Ravi",
     "email": "ravi@example.com", "role": "Signer", "embedded": false}
  ],
  "anchor_unrecognised": []
}

Always check anchor_unrecognised. It lists tags ERPDocs found but could not interpret — a misspelled type ({{signatur:Supplier}}), or a role with no matching recipient. Those tags are left in the document and no field is created, so a signature box you were expecting is simply missing. The call still returns 201, so a silent typo will otherwise reach your signer.

Compare field_count against the number of tags you wrote. If it is lower, something did not match.


Combining with embedded signing

Mark a role embedded to keep the signer inside your own product instead of emailing them a link:

{"Supplier": {"name": "Ravi", "email": "ravi@example.com", "embedded": true}}

Set it here, at send time, rather than later — the invitation email goes out the moment the envelope is sent. See Embedded Signing.


Errors

Code HTTP Meaning
file_required 400 No file part, or it had an empty filename.
invalid_recipients 400 recipients was missing, empty, or not valid JSON.
invalid_expiry 400 expires_in_days was not an integer between 1 and 365.
invalid_brand_id 400 brand_id was not an integer.
brand_not_found 404 Valid integer, but not a brand profile in your organization.
sandbox_write_blocked 403 Sandbox key. Use a live key to send.

See Troubleshooting API Errors.


Troubleshooting

field_count is 0 and every tag is in anchor_unrecognised. Check the role names match your recipients keys exactly — they are compared case-insensitively but must otherwise be identical.

Tags are visible in the signed PDF. Only recognised tags are removed. Anything in anchor_unrecognised stays on the page. Fix the tag and resend.

Nothing is detected at all. The PDF probably has no text layer — it is a scan or a flattened image. Generate it from text, or use a template instead.

A signature landed in the wrong place. The field is placed at the tag's position. Check the tag is on the line where you want the signature, and that your generator did not move it during layout.