Anvil Logo
Products
Industries
Resources
Developers
Engineering

Standardizing PDF libraries for API use

Author headshot
By Mang-Git Ng

Learn how Anvil helps you manage similar data fields across a library of PDFs.

Back to all articles
Standardizing PDF libraries for API use

Field Aliases enable consistent keys for data fields across multiple PDFs

When setting up a PDF template for the PDF filling API, Anvil automatically generates a unique field ID for each field on the PDF. When working with a library of PDF templates, tracking these unique field IDs across multiple PDFs can be cumbersome, so Anvil allows developers to assign a Field Alias, similar to a variable name, for each PDF field.

A big benefit of using a Field Alias is the ability to have consistent Field Aliases across multiple PDFs that ask for the same information. For example, say you have a library of 10 different PDFs, and each PDF asks for a Name and Address. You could manually track the auto-generated ID for each field on each PDF, resulting in 20 unique field IDs that need to be tracked. Or you can assign a Field Alias of fullName and fullAddress to every name and address field across all PDFs.

Now when making a request to the specific PDF template, you only need to construct a data payload with the Field Aliases and Anvil will automatically route it to the correct field.

{
  "fullName": {
    "firstName": "John",
    "lastName": "Doe"
  },
  "fullAddress": {
    "street1": "123 Main Street",
    "city": "San Francisco",
    "state": "CA",
    "zip": "95273"
  }
}

This data payload will work across all 10 PDF templates in Anvil, as long as the fields have the proper Field Alias assigned.

As an added benefit, reading a JSON payload constructed using Field Aliases makes debugging API requests much easier.

How to assign a Field Alias

In the PDF template editor

  1. Select the field
  2. Add a Field Alias The Field Alias must be unique within the PDF and we suggest using camelCase for all IDs.

Why do you need Field Aliases?

For most paperwork processes there are multiple forms that need to be completed. To ensure that forms are properly associated with one another, the forms have a set of common fields that are consistent across each form.

Common pieces of information used to associate forms with one another include:

  • Name
  • Address
  • Unique Customer Number
  • Social Security Number ← clearly the best use for a sensitive piece of information is to have it on EVERY form

One quirk of how paper and PDF forms are created, is that they are updated over time, resulting in the “consistent” fields becoming inconsistent. Someone might change the formatting of the form, or change the labels for each field NameFull Name, Social Security NumberSSN. All of these little inconsistencies make it a pain to pass the same information into multiple fields across different PDFs.

Anvil’s Field Aliases is a way for you to normalize between your own database and all of the PDFs you are generating with Anvil.

Real world use cases for Field Aliases

Field Aliases are a popular feature for Anvil API developers. To date, we have seen developers use it for

  • New hire packets - Job Application, W4, I9
  • Insurance Policy Packets - Claims Forms, COI, Policy Information
  • Sales Contracts - MSA, Purchase Orders, NDAs
  • Loans - Applications, Supporting Forms, Closing Documents

Each of these cases require the same information, such as name and address, to be completed in multiple documents.

Resources

To sign up for our free developer sandbox or learn more about our API, head over to our developer center at www.useanvil.com/developers. There, you will find comprehensive documentation, simple tutorials, and client libraries to help you get started quickly and easily.

If you have questions, please do not hesitate to contact us at: developers@useanvil.com

Sign up for a live demo

Request a 30-minute live demo today and we'll get in touch shortly. During the meeting our team will help you find the right solution, including:
  • Simplifying data gathering
  • Streamlining document preparation
  • Requesting e-signatures
  • Building and scaling your business
Ready to experience document workflow automation?Sign up for free
Ready to experience document workflow automation?Sign up for free