In this guide
- What makes up a Deduction Template Definitions.
- How to define deduction rules with a Deduction Template.
- How to add a Deduction to an Employee Check.
- How to create recurring deductions from the Company Dashboard.
API
Accounting for deductions with Zeal’s API is a 2-step process:- Create a Deduction Template
- Create a Deduction (scoped to a single Employee Check)
Understanding Deduction Template Definitions
Before we create a Deduction Template we should first get the Deduction Template Definition Object for the type of deduction (401K, HSA, etc.) we want to address. This object is presented as a JSON schema and defines the instructions, or possible options available, when creating a Deduction Template. This JSON schema can be a little complicated so let’s break it down into pieces.Properties
The first thing to note is theproperties field.
required_template_fields (more on this later), all keys of a properties field directly translate to fields that may be included in the body of your POST request to the Create a Deduction Template endpoint.
Property Values
The Deduction Template Definition also tells us the values we can assign to the fields of each property. There are a few different types of values these fields might hold so let’s go through them.const- field is restricted the value listed.enum- field is restricted to one of the values listed.type- field is restricted to the type listed (ex."number"->5).
Note
While most values are self-explanatory, the values of theoverride_type property may be unfamiliar. Please see our API Reference for details on these values.Required Fields
In example request body above, we included all of the property options that were listed in the HSA template definition. However, not all of the properties are required. Therequired fields tell us what properties must be included in our request.
employer_contribution is not a required field.
Note
The fieldscompanyID, deduction_type, and custom_name are always required.Conditionally Required Fields
One part of the schema that may not be immediately understood is theallOf fields.
override_type is set to final, then the property value will also be required.
With this in mind, it would be valid to create a HSA Deduction Template as follows:
Required Template Fields
With everything we’ve learned so far, we’re ready to create Deduction Templates. But you may be thinking, “Hold on. What about thisrequired_template_fields?”. Great question!
required_template_fields aren’t actually included when creating a Deduction Template. Rather these fields tell us what fields will be required in the subsequent step to create a Deduction using the template.
For example, our HSA Template Definitions state these required_template_fields:
employee_contribution object with the field value in our deduction object.
Create a Deduction Template
A Deduction Template is an object that defines the schema for a Deduction. Deduction Templates may be reused across a company for many employees or may just be reused to create deductions for a single employee. For example:- An employer might create a 401K Deduction Template that defines a fixed employer contribution but allows the employee contribution to be adjusted with each deduction created. This might be reused across multiple employees.
- An employee has a particular case where many garnishments or miscellaneous need to be withheld from their paycheck. The Deduction Templates that are defined to accommodate this use case might only be used to create deductions for this particular employee.
- Call Get Deduction Template Definitions with the type of deduction you’re targeting as a query parameter. We’ll choose
401kfor this example.
Note
Remember to replace the placeholders such as{{testApiKey}} in the examples below.- Use the JSON Schema returned as instructions to build your request to create a deduction template.
- Call Create Deduction Template.
- Store the returned
deductionTemplateIDfor use when creating deductions following this template.
Create a Deduction
A Deduction defines how much should be withheld from an employees pay and is scoped to a single Employee Check. Below are the steps to create a Deduction.- Get Employee Checks by Employee you’d like to apply the Deduction to.
- Get a list of Deduction Templates and grab the
deductionTemplateIDfor the desired template (or use the ID you stored from the previous steps).
garnishments are the exception. These amounts will be deducted from the company’s bank account and paid out to the proper stakeholders by Zeal).
White-Label
From the white-label Company Dashboard, users can create recurring deductions which will automatically be added to future payroll runs. Please reference our Payroll Runs guide to understand payroll runs.Accessing the deductions page
Navigate to Run Payroll and click Get started under Manage deductions.

Creating a 401K deduction
Under the 401K page, check the box next to the employee’s you’d like to add the deduction for, fill the Custom Name, Employee Contribution, and Employer Contribution sections, then click Add new deduction.

Recap
- Understanding the Deduction Template Definitions is key to managing deductions with Zeal.
- A Deduction Template defines the rules for your deductions.
- Deductions are created using a Deduction Template and applied to an Employee Check.
- With a deduction attached to an Employee Check, the deduction will automatically be applied when the check is processed.
- From the white-label Company Dashboard, you can create recurring deductions.
- Recurring deductions will be automatically added to future regular payroll runs.