---
schema_version: "1"
id: 043729b3e20588988c43b0e2d4b83d4ab43baf5da8d7400fdd22fe8a41c0df66
title: Flexible Hierarchy Apply Rules (POST)
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/financial_services_cloud_object_reference/connect_resources_flexible_hierarchy_apply_rules.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.financial_services_cloud_object_reference.meta/financial_services_cloud_object_reference/connect_resources_flexible_hierarchy_apply_rules.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: c94eabd76c96d782bce313122e8420c61e8e609f18e2550b47e41eec7b7011f5
description: Create new flexible hierarchies or update existing hierarchies asynchronously by applying the rules defined in a relationship graph definition. Use the operationMode parameter to create hierarchies for matching root records or to re-apply the rules so that existing hierarchies stay in sync with the source data. This API runs asynchronously and returns an ID to track the request.
---
# Flexible Hierarchy Apply Rules (POST)

Create new flexible hierarchies or update existing hierarchies asynchronously by applying the rules defined in a relationship graph definition. Use the operationMode parameter to create hierarchies for matching root records or to re-apply the rules so that existing hierarchies stay in sync with the source data. This API runs asynchronously and returns an ID to track the request.

The operationMode parameter determines the operation. create uses relationshipGraphDefinitionIds (specify an ID) and either rootRecords or shouldIncludeAllRootRecords to build hierarchies for roots that don't already have a hierarchy. Don't specify hierarchyIds when operationMode is create. The update mode uses hierarchyIds to re-run the rules for existing hierarchies. Don't specify relationshipGraphDefinitionIds or rootRecords when operationMode is update.

## Resource

/connect/flexible-hierarchies/actions/apply-rules

## Resource Example

https://yourInstance.salesforce.com/services/data/v68.0/connect/flexible-hierarchies/actions/apply-rules

## Available Version

68.0

## HTTP Methods

POST

## Request Body for POST

### JSON Example

{
  "operationMode": "create",
  "relationshipGraphDefinitionIds": \[
    "06JRG000000001AMA2"
  \],
  "rootRecords": \[
    {
      "recordId": "001xx000003GZ39AAG",
      "name": "PID8 5-Level Hierarchy"
    }
  \],
  "shouldIncludeAllRootRecords": false,
  "effectiveFromDate": "2026-07-09",
  "effectiveToDate": "2027-07-09",
  "isActive": true
}

### Properties

| Name | Type | Description | Required or Optional | Available Version |
| --- | --- | --- | --- | --- |
| effectiveFromDate | String | Date when the generated hierarchies become effective. Don't specify this parameter when operationMode is update. | Optional | 68.0 |
| effectiveToDate | String | Date until which the generated hierarchies remain effective. Don't specify this parameter when operationMode is update. | Optional | 68.0 |
| hierarchyIds | String\[\] | IDs of the existing hierarchies to apply the rule. Required to update the hierarchies. Specify up to 1,000 records to process for the update operation. Don't specify this parameter when operationMode is create. | Required if operationMode is update. | 68.0 |
| isActive | Boolean | Indicates whether the generated hierarchies are active (true) or not (false). The default value is true. Don't specify this parameter when operationMode is update. | Optional | 68.0 |
| operationMode | String | Specifies whether to create new flexible hierarchies or update existing ones. create creates new flexible hierarchies, and update synchronizes existing hierarchies with the latest source data. | Required | 68.0 |
| relationshipGraphDefinitionIds | String\[\] | ID of the relationship graph definition that defines how the hierarchies are generated. Specify one ID at a time. Don't specify this parameter when operationMode is update. | Required if operationMode is create. | 68.0 |
| rootRecords | [Root Record Input](https://developer.salesforce.com/docs/atlas.en-us.financial_services_cloud_object_reference.meta/financial_services_cloud_object_reference/connect_requests_root_record.htm "Input representation of a root record to build a hierarchy for.")\[\] | Root records to create flexible hierarchies for. Specify up to 1,000 root records. Use this parameter when operationMode is create and shouldIncludeAllRootRecords is false or not specified. Don't specify this parameter when operationMode is update. | Required if operationMode is create and shouldIncludeAllRootRecords is false or omitted. | 68.0 |
| shouldIncludeAllRootRecords | Boolean | Indicates whether to generate hierarchies for all root records that match the relationship graph definition (true) or not (false). Don't specify this parameter when operationMode is update. | Optional | 68.0 |

## Response Body for POST

[Flexible Hierarchy Rule-Based Creation Response](https://developer.salesforce.com/docs/atlas.en-us.financial_services_cloud_object_reference.meta/financial_services_cloud_object_reference/connect_responses_flexible_hierarchy_rule_based_creation.htm "Output representation of the status of an asynchronous request to create or update flexible hierarchies by applying relationship graph definition rules.")