Okta.Sdk.Api.GroupRuleApi

October 22, 2025 ยท View on GitHub

All URIs are relative to https://subdomain.okta.com

MethodHTTP requestDescription
ActivateGroupRulePOST /api/v1/groups/rules/{groupRuleId}/lifecycle/activateActivate a group rule
CreateGroupRulePOST /api/v1/groups/rulesCreate a group rule
DeactivateGroupRulePOST /api/v1/groups/rules/{groupRuleId}/lifecycle/deactivateDeactivate a group rule
DeleteGroupRuleDELETE /api/v1/groups/rules/{groupRuleId}Delete a group rule
GetGroupRuleGET /api/v1/groups/rules/{groupRuleId}Retrieve a group rule
ListGroupRulesGET /api/v1/groups/rulesList all group rules
ReplaceGroupRulePUT /api/v1/groups/rules/{groupRuleId}Replace a group rule

ActivateGroupRule

void ActivateGroupRule (string groupRuleId)

Activate a group rule

Activates a specific group rule by ID from your org

Example

using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;

namespace Example
{
    public class ActivateGroupRuleExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.OktaDomain = "https://subdomain.okta.com";
            // Configure API key authorization: apiToken
            config.Token ="YOUR_API_KEY";
            // Configure OAuth2 access token for authorization: oauth2
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new GroupRuleApi(config);
            var groupRuleId = 0pr3f7zMZZHPgUoWO0g4;  // string | The `id` of the group rule

            try
            {
                // Activate a group rule
                apiInstance.ActivateGroupRule(groupRuleId);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling GroupRuleApi.ActivateGroupRule: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

NameTypeDescriptionNotes
groupRuleIdstringThe `id` of the group rule

Return type

void (empty response body)

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
204No Content-
403Forbidden-
404Not Found-
429Too Many Requests-

[Back to top] [Back to API list] [Back to Model list] [Back to README]

CreateGroupRule

GroupRule CreateGroupRule (CreateGroupRuleRequest groupRule)

Create a group rule

Creates a group rule to dynamically add users to the specified group if they match the condition > Note: Group rules are created with the status set to 'INACTIVE'.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;

namespace Example
{
    public class CreateGroupRuleExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.OktaDomain = "https://subdomain.okta.com";
            // Configure API key authorization: apiToken
            config.Token ="YOUR_API_KEY";
            // Configure OAuth2 access token for authorization: oauth2
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new GroupRuleApi(config);
            var groupRule = new CreateGroupRuleRequest(); // CreateGroupRuleRequest | 

            try
            {
                // Create a group rule
                GroupRule result = apiInstance.CreateGroupRule(groupRule);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling GroupRuleApi.CreateGroupRule: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

NameTypeDescriptionNotes
groupRuleCreateGroupRuleRequest

Return type

GroupRule

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200Success-
400Bad Request-
403Forbidden-
429Too Many Requests-

[Back to top] [Back to API list] [Back to Model list] [Back to README]

DeactivateGroupRule

void DeactivateGroupRule (string groupRuleId)

Deactivate a group rule

Deactivates a specific group rule by ID from your org

Example

using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;

namespace Example
{
    public class DeactivateGroupRuleExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.OktaDomain = "https://subdomain.okta.com";
            // Configure API key authorization: apiToken
            config.Token ="YOUR_API_KEY";
            // Configure OAuth2 access token for authorization: oauth2
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new GroupRuleApi(config);
            var groupRuleId = 0pr3f7zMZZHPgUoWO0g4;  // string | The `id` of the group rule

            try
            {
                // Deactivate a group rule
                apiInstance.DeactivateGroupRule(groupRuleId);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling GroupRuleApi.DeactivateGroupRule: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

NameTypeDescriptionNotes
groupRuleIdstringThe `id` of the group rule

Return type

void (empty response body)

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
204No Content-
403Forbidden-
404Not Found-
429Too Many Requests-

[Back to top] [Back to API list] [Back to Model list] [Back to README]

DeleteGroupRule

void DeleteGroupRule (string groupRuleId, bool? removeUsers = null)

Delete a group rule

Deletes a specific group rule by groupRuleId

Example

using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;

namespace Example
{
    public class DeleteGroupRuleExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.OktaDomain = "https://subdomain.okta.com";
            // Configure API key authorization: apiToken
            config.Token ="YOUR_API_KEY";
            // Configure OAuth2 access token for authorization: oauth2
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new GroupRuleApi(config);
            var groupRuleId = 0pr3f7zMZZHPgUoWO0g4;  // string | The `id` of the group rule
            var removeUsers = false;  // bool? | If set to `true`, removes users from groups assigned by this rule (optional)  (default to false)

            try
            {
                // Delete a group rule
                apiInstance.DeleteGroupRule(groupRuleId, removeUsers);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling GroupRuleApi.DeleteGroupRule: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

NameTypeDescriptionNotes
groupRuleIdstringThe `id` of the group rule
removeUsersbool?If set to `true`, removes users from groups assigned by this rule[optional] [default to false]

Return type

void (empty response body)

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
202Accepted-
403Forbidden-
404Not Found-
429Too Many Requests-

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetGroupRule

GroupRule GetGroupRule (string groupRuleId, string expand = null)

Retrieve a group rule

Retrieves a specific group rule by ID from your org

Example

using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;

namespace Example
{
    public class GetGroupRuleExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.OktaDomain = "https://subdomain.okta.com";
            // Configure API key authorization: apiToken
            config.Token ="YOUR_API_KEY";
            // Configure OAuth2 access token for authorization: oauth2
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new GroupRuleApi(config);
            var groupRuleId = 0pr3f7zMZZHPgUoWO0g4;  // string | The `id` of the group rule
            var expand = "expand_example";  // string | If specified as `groupIdToGroupNameMap`, then show group names (optional) 

            try
            {
                // Retrieve a group rule
                GroupRule result = apiInstance.GetGroupRule(groupRuleId, expand);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling GroupRuleApi.GetGroupRule: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

NameTypeDescriptionNotes
groupRuleIdstringThe `id` of the group rule
expandstringIf specified as `groupIdToGroupNameMap`, then show group names[optional]

Return type

GroupRule

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200Success-
403Forbidden-
404Not Found-
429Too Many Requests-

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListGroupRules

List<GroupRule> ListGroupRules (int? limit = null, string after = null, string search = null, string expand = null)

List all group rules

Lists all group rules for your org

Example

using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;

namespace Example
{
    public class ListGroupRulesExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.OktaDomain = "https://subdomain.okta.com";
            // Configure API key authorization: apiToken
            config.Token ="YOUR_API_KEY";
            // Configure OAuth2 access token for authorization: oauth2
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new GroupRuleApi(config);
            var limit = 50;  // int? | Specifies the number of rule results in a page (optional)  (default to 50)
            var after = "after_example";  // string | Specifies the pagination cursor for the next page of rules (optional) 
            var search = "search_example";  // string | Specifies the keyword to search rules for (optional) 
            var expand = "expand_example";  // string | If specified as `groupIdToGroupNameMap`, then displays group names (optional) 

            try
            {
                // List all group rules
                List<GroupRule> result = apiInstance.ListGroupRules(limit, after, search, expand).ToListAsync();
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling GroupRuleApi.ListGroupRules: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

NameTypeDescriptionNotes
limitint?Specifies the number of rule results in a page[optional] [default to 50]
afterstringSpecifies the pagination cursor for the next page of rules[optional]
searchstringSpecifies the keyword to search rules for[optional]
expandstringIf specified as `groupIdToGroupNameMap`, then displays group names[optional]

Return type

List<GroupRule>

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200Success-
403Forbidden-
429Too Many Requests-

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ReplaceGroupRule

GroupRule ReplaceGroupRule (string groupRuleId, GroupRule groupRule)

Replace a group rule

Replaces a group rule > Notes: You can only update rules with a group whose status is set to 'INACTIVE'. > > You currently can't update the action section.

Example

using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;

namespace Example
{
    public class ReplaceGroupRuleExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.OktaDomain = "https://subdomain.okta.com";
            // Configure API key authorization: apiToken
            config.Token ="YOUR_API_KEY";
            // Configure OAuth2 access token for authorization: oauth2
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new GroupRuleApi(config);
            var groupRuleId = 0pr3f7zMZZHPgUoWO0g4;  // string | The `id` of the group rule
            var groupRule = new GroupRule(); // GroupRule | 

            try
            {
                // Replace a group rule
                GroupRule result = apiInstance.ReplaceGroupRule(groupRuleId, groupRule);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling GroupRuleApi.ReplaceGroupRule: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

NameTypeDescriptionNotes
groupRuleIdstringThe `id` of the group rule
groupRuleGroupRule

Return type

GroupRule

Authorization

apiToken, oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200Success-
400Bad Request-
403Forbidden-
404Not Found-
429Too Many Requests-

[Back to top] [Back to API list] [Back to Model list] [Back to README]