Skip to main content
POST
/
employer
/
pay-statement-item
/
rule
JavaScript
import Finch from '@tryfinch/finch-api';

const client = new Finch({
  accessToken: 'My Access Token',
});

const rule = await client.hris.payStatementItem.rules.create();

console.log(rule.id);
from finch import Finch

client = Finch(
    access_token="My Access Token",
)
rule = client.hris.pay_statement_item.rules.create()
print(rule.id)
package main

import (
	"context"
	"fmt"

	"github.com/Finch-API/finch-api-go"
	"github.com/Finch-API/finch-api-go/option"
)

func main() {
	client := finchgo.NewClient(
		option.WithAccessToken("My Access Token"),
	)
	rule, err := client.HRIS.PayStatementItem.Rules.New(context.TODO(), finchgo.HRISPayStatementItemRuleNewParams{})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", rule.ID)
}
package com.tryfinch.api.example;

import com.tryfinch.api.client.FinchClient;
import com.tryfinch.api.client.okhttp.FinchOkHttpClient;
import com.tryfinch.api.models.HrisPayStatementItemRuleCreateParams;
import com.tryfinch.api.models.RuleCreateResponse;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        FinchClient client = FinchOkHttpClient.builder()
            .fromEnv()
            .accessToken("My Access Token")
            .build();

        RuleCreateResponse rule = client.hris().payStatementItem().rules().create();
    }
}
package com.tryfinch.api.example

import com.tryfinch.api.client.FinchClient
import com.tryfinch.api.client.okhttp.FinchOkHttpClient
import com.tryfinch.api.models.HrisPayStatementItemRuleCreateParams
import com.tryfinch.api.models.RuleCreateResponse

fun main() {
    val client: FinchClient = FinchOkHttpClient.builder()
        .fromEnv()
        .accessToken("My Access Token")
        .build()

    val rule: RuleCreateResponse = client.hris().payStatementItem().rules().create()
}
require "finch_api"

finch = FinchAPI::Client.new(access_token: "My Access Token")

rule = finch.hris.pay_statement_item.rules.create

puts(rule)
curl --request POST \
  --url https://api.tryfinch.com/employer/pay-statement-item/rule \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: <content-type>' \
  --header 'Finch-API-Version: <finch-api-version>' \
  --data '
{
  "effective_start_date": "<string>",
  "effective_end_date": "<string>",
  "conditions": [
    {
      "field": "<string>",
      "operator": "equals",
      "value": "<string>"
    }
  ],
  "attributes": {
    "metadata": {}
  },
  "entity_type": "pay_statement_item"
}
'
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.tryfinch.com/employer/pay-statement-item/rule",
  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([
    'effective_start_date' => '<string>',
    'effective_end_date' => '<string>',
    'conditions' => [
        [
                'field' => '<string>',
                'operator' => 'equals',
                'value' => '<string>'
        ]
    ],
    'attributes' => [
        'metadata' => [
                
        ]
    ],
    'entity_type' => 'pay_statement_item'
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: <content-type>",
    "Finch-API-Version: <finch-api-version>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
{
  "id": "5d0b10a1-a09a-430f-81f1-20be735dc5e9",
  "priority": 1,
  "effective_start_date": "2025-01-01",
  "effective_end_date": "2025-12-31",
  "conditions": [
    {
      "field": "name",
      "operator": "equals",
      "value": "Salary"
    }
  ],
  "attributes": {
    "metadata": {
      "myLabel": "My Value"
    }
  },
  "entity_type": "pay_statement_item",
  "created_at": "2025-01-01T10:00:00Z",
  "updated_at": "2025-01-01T10:00:00Z"
}
{
  "code": 400,
  "name": "invalid_request_error",
  "finch_code": "invalid_request",
  "message": "Validation error: Array must contain at least 1 element(s) at \"conditions\""
}

Authorizations

Authorization
string
header
required

Please use your Access Token

Headers

Finch-API-Version
string<date>
default:2020-09-17
required

Header used to specify the version for a given API request. Current version is 2020-09-17.

Pattern: ([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))
Content-Type
string
default:application/json
required

Used to indicate the original media type of the resource

Query Parameters

entity_ids
string<uuid>[]

The entity IDs to create the rule for.

Required array length: 1 element
Example:
["550e8400-e29b-41d4-a716-446655440000"]

Body

application/json
effective_start_date
string | null

Specifies when the rule should begin applying based on the date.

Pattern: (\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))
effective_end_date
string | null

Specifies when the rules should stop applying rules based on the date.

Pattern: (\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))
conditions
object[]
attributes
object

Specifies the fields to be applied when the condition is met.

entity_type
enum<string>

The entity type to which the rule is applied.

Available options:
pay_statement_item

Response

Successfully Created

id
string

Finch id (uuidv4) for the rule.

Pattern: [0-9a-f]{8}[-]?(?:[0-9a-f]{4}[-]?){3}[0-9a-f]{12}
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 | null

Specifies when the rule should begin applying based on the date.

Pattern: (\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))
effective_end_date
string | null

Specifies when the rules should stop applying rules based on the date.

Pattern: (\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))
conditions
object[]
attributes
object

Specifies the fields to be applied when the condition is met.

entity_type
enum<string>

The entity type to which the rule is applied.

Available options:
pay_statement_item