Skip to content
Get started

Create eligibility policy

employers.create_eligibility_policy(employer_id, **kwargs) -> BenefitEligibilityPolicyAPI { id, active, created_at, 7 more }
post/v1/employers/{employer_id}/benefit-eligibility-policy

Creates a new benefit eligibility policy for a specific employer. Eligibility policies define rules that determine which employees qualify for benefits based on criteria such as employment status (full-time, part-time), hours worked per week, waiting periods after hire date, or other custom requirements. Optionally provide 'policy_to_replace_id' as a query parameter to replace an existing policy.

ParametersExpand Collapse
employer_id: String
effective_date: Date

Date when policy becomes effective

formatdate
name: String

Display name for the policy

maxLength255
minLength1
rules: Array[{ operator, rule_type, value}]

List of eligibility rules (at least one required)

operator: String

Comparison operator

rule_type: String

Type of eligibility rule

value: String

Value to compare against (can be string, number, boolean, or list)

policy_to_replace_id: String

ID of existing policy to replace (epol_*)

description: String

Detailed description

ReturnsExpand Collapse
class BenefitEligibilityPolicyAPI { id, active, created_at, 7 more }

Serializer for Benefit Eligibility Policy entity.

Eligibility policies define rules that determine which employees qualify for benefits.

id: String

Unique eligibility policy identifier with 'epol_' prefix

active: bool

Whether this policy is currently active

created_at: Time

Timestamp when the policy was created

formatdate-time
effective_date: Date

Date when this policy becomes effective

formatdate
employer_id: String

ID of the employer this policy belongs to (empr_*)

name: String

Display name for the eligibility policy

rules: Array[{ operator, rule_type, value}]

List of eligibility rules that must be satisfied

operator: String

Comparison operator (e.g., 'equals', 'greater_than', 'in')

rule_type: String

Type of eligibility rule (e.g., 'employment_status', 'hours_per_week', 'waiting_period')

value: untyped

Value to compare against (type depends on rule_type)

updated_at: Time

Timestamp when the policy was last updated

formatdate-time
description: String

Detailed description of the policy

replaced_policy_id: String

ID of the policy this one replaces, if any (epol_*)

Create eligibility policy
require "vitable_connect_api"

vitable_connect_api = VitableConnectAPI::Client.new(
  api_key: "My API Key",
  environment: "environment_1" # defaults to "production"
)

benefit_eligibility_policy = vitable_connect_api.employers.create_eligibility_policy(
  "empr_abc123def456",
  effective_date: "2019-12-27",
  name: "x",
  rules: [{operator: "operator", rule_type: "rule_type", value: "value"}]
)

puts(benefit_eligibility_policy)
{
  "id": "id",
  "active": true,
  "created_at": "2019-12-27T18:11:19.117Z",
  "effective_date": "2019-12-27",
  "employer_id": "employer_id",
  "name": "name",
  "rules": [
    {
      "operator": "operator",
      "rule_type": "rule_type",
      "value": {}
    }
  ],
  "updated_at": "2019-12-27T18:11:19.117Z",
  "description": "description",
  "replaced_policy_id": "replaced_policy_id"
}
Returns Examples
{
  "id": "id",
  "active": true,
  "created_at": "2019-12-27T18:11:19.117Z",
  "effective_date": "2019-12-27",
  "employer_id": "employer_id",
  "name": "name",
  "rules": [
    {
      "operator": "operator",
      "rule_type": "rule_type",
      "value": {}
    }
  ],
  "updated_at": "2019-12-27T18:11:19.117Z",
  "description": "description",
  "replaced_policy_id": "replaced_policy_id"
}