This guide explains how to create transactions with form fields that signers can fill in during the signing process. There are two different approaches available, each suited to different use cases.
Form fields allow signers to provide additional information (such as addresses, phone numbers, or checkboxes) while signing documents. This is useful for:
Signhost offers two methods for adding form fields to PDFs:
Use this when you have a PDF that already contains form fields created in a PDF editor (like Adobe Acrobat).
Best for:
Requirements:
Limitations:
Use this when you want to add form fields to any PDF dynamically via the Signhost API.
Best for:
Requirements:
Advantages:
| Feature | PDF-Embedded Fields | API-Generated Fields |
|---|---|---|
| PDF Preparation | Required | Not required |
| Supported Field Types | Text boxes, checkboxes | Text boxes, checkboxes, signatures |
| Field Positioning | Fixed in PDF | Defined via API coordinates |
| Setup Complexity | Requires PDF editor | Requires coordinate calculation |
| Flexibility | Limited to PDF design | Highly flexible |
| Best Use Case | Pre-designed forms | Dynamic form generation |
This approach uses form fields that are already embedded in your PDF document.
Create a transaction: This will initialize a new transaction and return a transactionId.
Add file metadata: Upload JSON metadata that specifies which signer can fill which form fields.
PUT /api/transaction/:transactionId/file/:fileId (with JSON content)
Add the PDF file: Upload the actual PDF document with fillable form fields.
PUT /api/transaction/:transactionId/file/:fileId (with PDF content)
Start the transaction: Once all files are uploaded, start the transaction to notify the signers.
First, create a new transaction with the POST /api/transaction/ endpoint that will contain your fillable PDF document. This will return a transactionId that you will use in subsequent requests.
Example:
You should receive a response with the transaction details, including the Id which is your transactionId:
The Id field contains your transactionId which you'll need for the following steps.
Before uploading the actual PDF, you need to specify which signer can fill which form fields by uploading JSON metadata with the PUT /api/transaction/:transactionId/file/:fileId endpoint.
Parameters:
transactionId: The ID from the transaction you just createdfileId: A unique identifier for your document (e.g., "Contract.pdf")Content-Type: Must be application/json for metadataMetadata Structure:
The FormSets array should contain the fileId of the document that contains the fillable fields.
Example:
The response will indicate that the system is now awaiting the PDF document.
Now upload the actual PDF document containing the fillable form fields using the PUT /api/transaction/:transactionId/file/:fileId endpoint.
Parameters:
transactionId: The ID from the transactionfileId: The same identifier used in the metadata stepContent-Type: Must be application/pdf for PDF filesExample:
This uploads the Contract.pdf file to the transaction. The file must contain fillable form fields that match the configuration in your metadata.
Once both the metadata and PDF file are uploaded, start the transaction with the PUT /api/transaction/:transactionId/start endpoint to notify the signers that they can now view, fill in the form fields, and sign the document.
Example:
This will start the transaction and send notifications to the signers that they can now view, fill in the form fields, and sign the document.
When a signer completes the form fields and signs the document, you'll receive the filled-in data through postbacks (webhooks) or by retrieving the transaction details.
The completed form field data will be included in the Context property of each signer:
You can also retrieve the form field data by calling the Get Transaction endpoint:
This approach allows you to dynamically create form fields on any PDF document through the API, without requiring the PDF to have pre-existing form fields.
First, create a new transaction using the POST /api/transaction/ endpoint.
Example:
You should receive a response with the transaction details:
Note the following fields from the response:
b2a9aca4-cd5e-4a21-b7f7-c08a9f2b2d57 This is your transactionId which you will use in subsequent requests.Signer1 This is your signerId which you will use in the metadata step.Upload JSON metadata that defines the form fields and their locations using the PUT /api/transaction/:transactionId/file/:fileId endpoint.
Parameters:
transactionId: The ID from the transaction you just createdfileId: A unique identifier for your document (e.g., "Contract.pdf")Content-Type: Must be application/json for metadataForm Sets Structure:
The FormSets object in the metadata defines the fields and their locations. Each Form Set can contain multiple fields with different types:
Field Positioning:
You can position fields using coordinates:
Right: Distance from the left edge of the page (in points)Top: Distance from the top edge of the page (in points)Width: Width of the field (in points)Height: Height of the field (in points)PageNumber: The page number where the field should appear (1-based)Note: It is recommended to use a width of 140 and a height of 70 for signature fields.
Example with multiple field types:
Important Notes:
FormSets array in the Signers section should reference one or more keys in the FormSets dictionaryUpload the actual PDF document using the PUT /api/transaction/:transactionId/file/:fileId endpoint.
Parameters:
transactionId: The ID from the transactionfileId: The same identifier used in the metadata stepContent-Type: Must be application/pdf for PDF filesExample:
Start the transaction using the PUT /api/transaction/:transactionId/start endpoint.
Example:
Regardless of which approach you use, retrieving the completed form field data works the same way.
When a signer completes the form fields and signs the document, you'll receive the filled-in data through postbacks (webhooks). The completed form field data will be included in the Context property of each signer:
You can also retrieve the form field data by calling the Get Transaction endpoint:
You will need:
See the Authentication guide for more details on how to obtain authentication tokens.
Both PDF-Embedded and API-Generated approaches support the following field types:
| Field Type | Description |
|---|---|
| Text fields (single line) | Allow signers to enter text information |
| Checkboxes | Allow signers to select or deselect options |
| Signatures | Allow signers to place their signature at specific locations |
Choose the right approach: Use PDF-Embedded fields for pre-designed forms with complex layouts, and API-Generated fields for dynamic scenarios or when you need to add fields to existing PDFs.
Test thoroughly: Test your implementation in a development environment, especially when working with coordinate-based positioning.
Clear field names: Use descriptive names for your form fields that clearly indicate what information is expected.
Validate data: Always validate the form field data you receive through postbacks or API calls.
Handle errors gracefully: Implement proper error handling for cases where form fields are not filled correctly or coordinates are invalid.
User guidance: Provide clear instructions to signers about what information is required in each field.
Signature field sizing: When using API-Generated fields, use the recommended dimensions of 140x70 points for signature fields.
Coordinate calculation: For API-Generated fields, carefully calculate coordinates. Consider using test PDFs to verify field positioning before production use.
You now understand both approaches for creating transactions with form fields using the Signhost API:
Both approaches allow signers to fill in required information during the signing process, and you'll receive the completed data through postbacks or by retrieving transaction details.
For more information: