Deductions
Create Deduction Template
Create a Deduction Template for a company that defines the rules for a class of deduction, such as a 401(k).
POST
/
deductionTemplate
Create Deduction Template
curl --request POST \
--url https://api.zeal.com/deductionTemplate \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"companyID": "fc235f012baa12312asdasdaseda",
"deduction_type": "401k",
"custom_name": "Zeal Testing 401k",
"employee_contribution": {
"contribution_type": "dollars",
"value": 20,
"override_type": "overridable"
},
"employer_contribution": {
"contribution_type": "dollars",
"matching": false,
"value": 30,
"override_type": "overridable"
}
}
'import requests
url = "https://api.zeal.com/deductionTemplate"
payload = {
"companyID": "fc235f012baa12312asdasdaseda",
"deduction_type": "401k",
"custom_name": "Zeal Testing 401k",
"employee_contribution": {
"contribution_type": "dollars",
"value": 20,
"override_type": "overridable"
},
"employer_contribution": {
"contribution_type": "dollars",
"matching": False,
"value": 30,
"override_type": "overridable"
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
companyID: 'fc235f012baa12312asdasdaseda',
deduction_type: '401k',
custom_name: 'Zeal Testing 401k',
employee_contribution: {contribution_type: 'dollars', value: 20, override_type: 'overridable'},
employer_contribution: {
contribution_type: 'dollars',
matching: false,
value: 30,
override_type: 'overridable'
}
})
};
fetch('https://api.zeal.com/deductionTemplate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.zeal.com/deductionTemplate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'companyID' => 'fc235f012baa12312asdasdaseda',
'deduction_type' => '401k',
'custom_name' => 'Zeal Testing 401k',
'employee_contribution' => [
'contribution_type' => 'dollars',
'value' => 20,
'override_type' => 'overridable'
],
'employer_contribution' => [
'contribution_type' => 'dollars',
'matching' => false,
'value' => 30,
'override_type' => 'overridable'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.zeal.com/deductionTemplate"
payload := strings.NewReader("{\n \"companyID\": \"fc235f012baa12312asdasdaseda\",\n \"deduction_type\": \"401k\",\n \"custom_name\": \"Zeal Testing 401k\",\n \"employee_contribution\": {\n \"contribution_type\": \"dollars\",\n \"value\": 20,\n \"override_type\": \"overridable\"\n },\n \"employer_contribution\": {\n \"contribution_type\": \"dollars\",\n \"matching\": false,\n \"value\": 30,\n \"override_type\": \"overridable\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.zeal.com/deductionTemplate")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"companyID\": \"fc235f012baa12312asdasdaseda\",\n \"deduction_type\": \"401k\",\n \"custom_name\": \"Zeal Testing 401k\",\n \"employee_contribution\": {\n \"contribution_type\": \"dollars\",\n \"value\": 20,\n \"override_type\": \"overridable\"\n },\n \"employer_contribution\": {\n \"contribution_type\": \"dollars\",\n \"matching\": false,\n \"value\": 30,\n \"override_type\": \"overridable\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zeal.com/deductionTemplate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"companyID\": \"fc235f012baa12312asdasdaseda\",\n \"deduction_type\": \"401k\",\n \"custom_name\": \"Zeal Testing 401k\",\n \"employee_contribution\": {\n \"contribution_type\": \"dollars\",\n \"value\": 20,\n \"override_type\": \"overridable\"\n },\n \"employer_contribution\": {\n \"contribution_type\": \"dollars\",\n \"matching\": false,\n \"value\": 30,\n \"override_type\": \"overridable\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"deductionTemplateID": "61cad98c3e6f8201c34c77c0",
"companyID": "fc235f012baa12312asdasdaseda",
"custom_name": {
"const": "Zeal Testing 401k"
},
"deduction_type": {
"const": "401k"
},
"employee_contribution": {
"properties": {
"contribution_type": {
"const": "dollars"
},
"value": {
"type": "number",
"default": 0
},
"override_type": {
"const": "overridable"
}
},
"required": [
"value"
]
},
"employer_contribution": {
"properties": {
"contribution_type": {
"const": "dollars"
},
"percentage_source": {
"enum": [
"contribution",
"paycheck"
]
},
"matching": {
"const": false
},
"value": {
"type": "number",
"default": 0
},
"override_type": {
"const": "overridable"
}
},
"required": [
"value"
]
},
"additional_properties": {}
}
}{
"success": false,
"errors": [
{
"message": "Provided deduction template name already exists",
"code": 13
}
]
}The fields you can include are determined by the schema returned from Deduction Template Definition.
Body
application/json
⌘I
Create Deduction Template
curl --request POST \
--url https://api.zeal.com/deductionTemplate \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"companyID": "fc235f012baa12312asdasdaseda",
"deduction_type": "401k",
"custom_name": "Zeal Testing 401k",
"employee_contribution": {
"contribution_type": "dollars",
"value": 20,
"override_type": "overridable"
},
"employer_contribution": {
"contribution_type": "dollars",
"matching": false,
"value": 30,
"override_type": "overridable"
}
}
'import requests
url = "https://api.zeal.com/deductionTemplate"
payload = {
"companyID": "fc235f012baa12312asdasdaseda",
"deduction_type": "401k",
"custom_name": "Zeal Testing 401k",
"employee_contribution": {
"contribution_type": "dollars",
"value": 20,
"override_type": "overridable"
},
"employer_contribution": {
"contribution_type": "dollars",
"matching": False,
"value": 30,
"override_type": "overridable"
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
companyID: 'fc235f012baa12312asdasdaseda',
deduction_type: '401k',
custom_name: 'Zeal Testing 401k',
employee_contribution: {contribution_type: 'dollars', value: 20, override_type: 'overridable'},
employer_contribution: {
contribution_type: 'dollars',
matching: false,
value: 30,
override_type: 'overridable'
}
})
};
fetch('https://api.zeal.com/deductionTemplate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.zeal.com/deductionTemplate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'companyID' => 'fc235f012baa12312asdasdaseda',
'deduction_type' => '401k',
'custom_name' => 'Zeal Testing 401k',
'employee_contribution' => [
'contribution_type' => 'dollars',
'value' => 20,
'override_type' => 'overridable'
],
'employer_contribution' => [
'contribution_type' => 'dollars',
'matching' => false,
'value' => 30,
'override_type' => 'overridable'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.zeal.com/deductionTemplate"
payload := strings.NewReader("{\n \"companyID\": \"fc235f012baa12312asdasdaseda\",\n \"deduction_type\": \"401k\",\n \"custom_name\": \"Zeal Testing 401k\",\n \"employee_contribution\": {\n \"contribution_type\": \"dollars\",\n \"value\": 20,\n \"override_type\": \"overridable\"\n },\n \"employer_contribution\": {\n \"contribution_type\": \"dollars\",\n \"matching\": false,\n \"value\": 30,\n \"override_type\": \"overridable\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.zeal.com/deductionTemplate")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"companyID\": \"fc235f012baa12312asdasdaseda\",\n \"deduction_type\": \"401k\",\n \"custom_name\": \"Zeal Testing 401k\",\n \"employee_contribution\": {\n \"contribution_type\": \"dollars\",\n \"value\": 20,\n \"override_type\": \"overridable\"\n },\n \"employer_contribution\": {\n \"contribution_type\": \"dollars\",\n \"matching\": false,\n \"value\": 30,\n \"override_type\": \"overridable\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zeal.com/deductionTemplate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"companyID\": \"fc235f012baa12312asdasdaseda\",\n \"deduction_type\": \"401k\",\n \"custom_name\": \"Zeal Testing 401k\",\n \"employee_contribution\": {\n \"contribution_type\": \"dollars\",\n \"value\": 20,\n \"override_type\": \"overridable\"\n },\n \"employer_contribution\": {\n \"contribution_type\": \"dollars\",\n \"matching\": false,\n \"value\": 30,\n \"override_type\": \"overridable\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"deductionTemplateID": "61cad98c3e6f8201c34c77c0",
"companyID": "fc235f012baa12312asdasdaseda",
"custom_name": {
"const": "Zeal Testing 401k"
},
"deduction_type": {
"const": "401k"
},
"employee_contribution": {
"properties": {
"contribution_type": {
"const": "dollars"
},
"value": {
"type": "number",
"default": 0
},
"override_type": {
"const": "overridable"
}
},
"required": [
"value"
]
},
"employer_contribution": {
"properties": {
"contribution_type": {
"const": "dollars"
},
"percentage_source": {
"enum": [
"contribution",
"paycheck"
]
},
"matching": {
"const": false
},
"value": {
"type": "number",
"default": 0
},
"override_type": {
"const": "overridable"
}
},
"required": [
"value"
]
},
"additional_properties": {}
}
}{
"success": false,
"errors": [
{
"message": "Provided deduction template name already exists",
"code": 13
}
]
}