---
title: "Create Rule"
method: POST
path: "/employer/pay-statement-item/rule"
tags: ["Payroll"]
---

# Create Rule

`POST /employer/pay-statement-item/rule`

Custom rules can be created to associate specific attributes to pay statement items depending on the use case. For example, pay statement items that meet certain conditions can be labeled as a pre-tax 401k. This metadata can be retrieved where pay statement item information is available.

## Query parameters

- `entity_ids` string[]

## Headers

- `Finch-API-Version` string, date, required
- `Content-Type` string, required

## Request body

- CreateRuleRequest
  - `effective_start_date` string, nullable
  - `effective_end_date` string, nullable
  - `conditions` object[]
    - `field` string — The field to be checked in the rule.
    - `operator` 'equals' — The operator to be used in the rule.
    - `value` string — The value of the field to be checked in the rule.
  - `attributes` object — Specifies the fields to be applied when the condition is met.
    - `metadata` object — The metadata to be attached in the entity. It is a key-value pairs where the values can be of any type (string, number, boolean, object, array, etc.).
  - `entity_type` 'pay_statement_item' — The entity type to which the rule is applied.

## Response `201`

Successfully Created

- CreateRuleResponse
  - `id` string — Finch id (uuidv4) for the rule.
  - `priority` integer — The priority of the rule.
  - `created_at` string, date-time — The datetime when the rule was created.
  - `updated_at` string, date-time — The datetime when the rule was last updated.
  - `effective_start_date` string, nullable
  - `effective_end_date` string, nullable
  - `conditions` object[]
    - `field` string — The field to be checked in the rule.
    - `operator` 'equals' — The operator to be used in the rule.
    - `value` string — The value of the field to be checked in the rule.
  - `attributes` object — Specifies the fields to be applied when the condition is met.
    - `metadata` object — The metadata to be attached in the entity. It is a key-value pairs where the values can be of any type (string, number, boolean, object, array, etc.).
  - `entity_type` 'pay_statement_item' — The entity type to which the rule is applied.

## Other responses

- `400` — Malformed Request

---

[API](https://skmtc.net/finch-api/apis/api-reference.md) · [All operations](https://skmtc.net/finch-api/apis/api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/finch-api/api-reference/revisions/f1cca2cb0ef2/schema)
