Pay Rule Policies

Retrieve pay rule policies and assign users to them.

Endpoints

MethodEndpointDescription
GET/company-policies/v1/pay-rule-policiesGet all pay rule policies
PUT/company-policies/v1/pay-rule-policies/{payRulePolicyId}/assignmentsAssign user to policy

Get Pay Rule Policies

Retrieve all enabled pay rule policies for your account.

Example Request

curl --request GET \
  --url https://api.connecteam.com/company-policies/v1/pay-rule-policies \
  --header 'X-API-KEY: YOUR_API_KEY'

Response

{
  "requestId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "data": {
    "payRulesPolicies": [
      {
        "id": 12345,
        "name": "Standard Hourly"
      },
      {
        "id": 12346,
        "name": "Overtime Eligible"
      },
      {
        "id": 12347,
        "name": "Night Shift Premium"
      }
    ]
  }
}

Response Fields

FieldTypeDescription
idintegerUnique policy identifier
namestringPolicy display name

Assign User to Policy

Assign a user to a specific pay rule policy with an effective date.

Path Parameters

ParameterTypeRequiredDescription
payRulePolicyIdintegerYesPolicy ID to assign

Request Body

FieldTypeRequiredDescription
userIdintegerYesUser ID to assign
effectiveDatestringYesDate policy takes effect (ISO 8601: YYYY-MM-DD)
⚠️

Retroactive Assignments

If the effectiveDate is earlier than an existing policy assignment, the old assignment will be replaced and removed. This affects historical payroll calculations.

Example: Assign User to Policy

curl --request PUT \
  --url https://api.connecteam.com/company-policies/v1/pay-rule-policies/12345/assignments \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: YOUR_API_KEY' \
  --data '{
    "userId": 9170357,
    "effectiveDate": "2025-02-01"
  }'

Response

{
  "requestId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "data": {
    "assignmentId": 789456
  }
}

Response Fields

FieldTypeDescription
assignmentIdintegerUnique assignment record ID

Integration Example

class PayRulePolicyManager {
  constructor(apiKey) {
    this.apiKey = apiKey;
    this.baseUrl = 'https://api.connecteam.com/company-policies/v1/pay-rule-policies';
  }

  async getPolicies() {
    const response = await fetch(this.baseUrl, {
      headers: { 'X-API-KEY': this.apiKey }
    });
    const data = await response.json();
    return data.data.payRulesPolicies;
  }

  async assignUserToPolicy(policyId, userId, effectiveDate) {
    const response = await fetch(
      `${this.baseUrl}/${policyId}/assignments`,
      {
        method: 'PUT',
        headers: {
          'X-API-KEY': this.apiKey,
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({ userId, effectiveDate })
      }
    );
    return response.json();
  }

  async bulkAssignUsers(policyId, userIds, effectiveDate) {
    const results = [];
    for (const userId of userIds) {
      try {
        const result = await this.assignUserToPolicy(policyId, userId, effectiveDate);
        results.push({ userId, success: true, assignmentId: result.data.assignmentId });
      } catch (error) {
        results.push({ userId, success: false, error: error.message });
      }
    }
    return results;
  }
}

// Usage
const manager = new PayRulePolicyManager('YOUR_API_KEY');

// Get all policies
const policies = await manager.getPolicies();
const overtimePolicy = policies.find(p => p.name === 'Overtime Eligible');

// Assign a user
await manager.assignUserToPolicy(overtimePolicy.id, 9170357, '2025-02-01');

// Bulk assign new hires
const newHireIds = [9170358, 9170359, 9170360];
await manager.bulkAssignUsers(overtimePolicy.id, newHireIds, '2025-02-01');

Error Responses

404 Not Found

Policy not found:

{
  "detail": "Pay rule policy with id 99999 not found"
}

400 Bad Request

Invalid policy ID:

{
  "detail": "Invalid pay rule policy ID"
}

User not found:

{
  "detail": "User not found"
}

API Reference