User Lifecycle Rules

A UserLifecycleRule represents a rule that applies to users based on their inactivity, state and authentication method.

The rule either disable or delete users who have been inactive or disabled for a specified number of days.

The authentication_method property specifies the authentication method for the rule, which can be set to "all", "all_non_sso", or a specific authentication method.

The rule can also include or exclude site and folder admins from the action.

List User Lifecycle Rules

Endpoint

GET/user_lifecycle_rules

Return Object

UserLifecycleRule[]

Authorization Requirement

Available to all authenticated keys or sessions.

Additional Arguments

Example Request

curl https://app.files.com/api/rest/v1/user_lifecycle_rules.json \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

[
  {
    "id": 1,
    "authentication_method": "all_non_sso",
    "group_ids": [
      1,
      2,
      3
    ],
    "action": "disable",
    "inactivity_days": 12,
    "include_folder_admins": true,
    "include_site_admins": true,
    "apply_to_all_workspaces": true,
    "name": "password specific rules",
    "notify_users": true,
    "partner_tag": "guest",
    "site_id": 1,
    "workspace_id": 12,
    "user_state": "inactive",
    "user_tag": "guest"
  }
]

Show User Lifecycle Rule

Endpoint

GET/user_lifecycle_rules/{id}

Return Object

UserLifecycleRule

Authorization Requirement

Available to all authenticated keys or sessions.

Request Parameters

ParameterDescription
id
int64
Required
User Lifecycle Rule ID.

Example Request

curl https://app.files.com/api/rest/v1/user_lifecycle_rules/{id}.json \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

{
  "id": 1,
  "authentication_method": "all_non_sso",
  "group_ids": [
    1,
    2,
    3
  ],
  "action": "disable",
  "inactivity_days": 12,
  "include_folder_admins": true,
  "include_site_admins": true,
  "apply_to_all_workspaces": true,
  "name": "password specific rules",
  "notify_users": true,
  "partner_tag": "guest",
  "site_id": 1,
  "workspace_id": 12,
  "user_state": "inactive",
  "user_tag": "guest"
}

Create User Lifecycle Rule

Endpoint

POST/user_lifecycle_rules

Return Object

UserLifecycleRule

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Request Parameters

ParameterDefaultDescription
apply_to_all_workspaces
boolean
falseIf true, a default-workspace rule also applies to users in all workspaces.
authentication_method
string
User authentication method for which the rule will apply. Use all_non_sso to target every non-SSO authentication method with one rule.
Possible values: all, password, sso, none, email_signup, password_with_imported_hash, password_and_ssh_key, all_non_sso
group_ids
array(int64)
Array of Group IDs to which the rule applies. If empty or not set, the rule applies to all users.
inactivity_days
int64
Number of days of inactivity before the rule applies
include_site_admins
boolean
falseIf true, the rule will apply to site admins.
include_folder_admins
boolean
falseIf true, the rule will apply to folder admins.
name
string
User Lifecycle Rule name
notify_users
boolean
falseIf true, users will be emailed before the rule disables or deletes them.
partner_tag
string
If provided, only users belonging to Partners with this tag at the Partner level will be affected by the rule. Tags must only contain lowercase letters, numbers, and hyphens.
user_state
string
"inactive"State of the users to apply the rule to (inactive or disabled)
Possible values: inactive, disabled
user_tag
string
If provided, only users with this tag will be affected by the rule. Tags must only contain lowercase letters, numbers, and hyphens.
workspace_id
int64
0Workspace ID. 0 means the default workspace.

Example Request

curl https://app.files.com/api/rest/v1/user_lifecycle_rules.json \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"apply_to_all_workspaces":true,"authentication_method":"all_non_sso","group_ids":[1,2,3],"inactivity_days":12,"include_site_admins":true,"include_folder_admins":true,"name":"password specific rules","notify_users":true,"partner_tag":"guest","user_state":"inactive","user_tag":"guest","workspace_id":12}' \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

{
  "id": 1,
  "authentication_method": "all_non_sso",
  "group_ids": [
    1,
    2,
    3
  ],
  "action": "disable",
  "inactivity_days": 12,
  "include_folder_admins": true,
  "include_site_admins": true,
  "apply_to_all_workspaces": true,
  "name": "password specific rules",
  "notify_users": true,
  "partner_tag": "guest",
  "site_id": 1,
  "workspace_id": 12,
  "user_state": "inactive",
  "user_tag": "guest"
}

Update User Lifecycle Rule

Endpoint

PATCH/user_lifecycle_rules/{id}

Return Object

UserLifecycleRule

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Request Parameters

ParameterDescription
id
int64
Required
User Lifecycle Rule ID.
apply_to_all_workspaces
boolean
If true, a default-workspace rule also applies to users in all workspaces.
authentication_method
string
User authentication method for which the rule will apply. Use all_non_sso to target every non-SSO authentication method with one rule.
Possible values: all, password, sso, none, email_signup, password_with_imported_hash, password_and_ssh_key, all_non_sso
group_ids
array(int64)
Array of Group IDs to which the rule applies. If empty or not set, the rule applies to all users.
inactivity_days
int64
Number of days of inactivity before the rule applies
include_site_admins
boolean
If true, the rule will apply to site admins.
include_folder_admins
boolean
If true, the rule will apply to folder admins.
name
string
User Lifecycle Rule name
notify_users
boolean
If true, users will be emailed before the rule disables or deletes them.
partner_tag
string
If provided, only users belonging to Partners with this tag at the Partner level will be affected by the rule. Tags must only contain lowercase letters, numbers, and hyphens.
user_state
string
State of the users to apply the rule to (inactive or disabled)
Possible values: inactive, disabled
user_tag
string
If provided, only users with this tag will be affected by the rule. Tags must only contain lowercase letters, numbers, and hyphens.
workspace_id
int64
Workspace ID. 0 means the default workspace.

Example Request

curl https://app.files.com/api/rest/v1/user_lifecycle_rules/{id}.json \
  -X PATCH \
  -H 'Content-Type: application/json' \
  -d '{"apply_to_all_workspaces":true,"authentication_method":"all_non_sso","group_ids":[1,2,3],"inactivity_days":12,"include_site_admins":true,"include_folder_admins":true,"name":"password specific rules","notify_users":true,"partner_tag":"guest","user_state":"inactive","user_tag":"guest","workspace_id":12}' \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

Example Response

{
  "id": 1,
  "authentication_method": "all_non_sso",
  "group_ids": [
    1,
    2,
    3
  ],
  "action": "disable",
  "inactivity_days": 12,
  "include_folder_admins": true,
  "include_site_admins": true,
  "apply_to_all_workspaces": true,
  "name": "password specific rules",
  "notify_users": true,
  "partner_tag": "guest",
  "site_id": 1,
  "workspace_id": 12,
  "user_state": "inactive",
  "user_tag": "guest"
}

Delete User Lifecycle Rule

Endpoint

DELETE/user_lifecycle_rules/{id}

Return Object

No return value.

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Request Parameters

ParameterDescription
id
int64
Required
User Lifecycle Rule ID.

Example Request

curl https://app.files.com/api/rest/v1/user_lifecycle_rules/{id}.json \
  -X DELETE \
  -H 'X-FilesAPI-Key: YOUR_API_KEY'

The UserLifecycleRule Object

Some of the endpoints above return a UserLifecycleRule object. The attributes of this object are listed below.

AttributeDescription
id
int64
User Lifecycle Rule ID
authentication_method
string
User authentication method for which the rule will apply. Use all_non_sso to target every non-SSO authentication method with one rule.
Possible values: all, password, sso, none, email_signup, password_with_imported_hash, password_and_ssh_key, all_non_sso
group_ids
array(int64)
Array of Group IDs to which the rule applies. If empty or not set, the rule applies to all users.
action
string
Action to take on inactive users (disable or delete)
Possible values: disable, delete
inactivity_days
int64
Number of days of inactivity before the rule applies
include_folder_admins
boolean
If true, the rule will apply to folder admins.
include_site_admins
boolean
If true, the rule will apply to site admins.
apply_to_all_workspaces
boolean
If true, a default-workspace rule also applies to users in all workspaces.
name
string
User Lifecycle Rule name
notify_users
boolean
If true, users will be emailed before the rule disables or deletes them.
partner_tag
string
If provided, only users belonging to Partners with this tag at the Partner level will be affected by the rule. Tags must only contain lowercase letters, numbers, and hyphens.
site_id
int64
Site ID
workspace_id
int64
Workspace ID. 0 means the default workspace.
user_state
string
State of the users to apply the rule to (inactive or disabled)
Possible values: inactive, disabled
user_tag
string
If provided, only users with this tag will be affected by the rule. Tags must only contain lowercase letters, numbers, and hyphens.

Example UserLifecycleRule Object

{
  "id": 1,
  "authentication_method": "all_non_sso",
  "group_ids": [
    1,
    2,
    3
  ],
  "action": "disable",
  "inactivity_days": 12,
  "include_folder_admins": true,
  "include_site_admins": true,
  "apply_to_all_workspaces": true,
  "name": "password specific rules",
  "notify_users": true,
  "partner_tag": "guest",
  "site_id": 1,
  "workspace_id": 12,
  "user_state": "inactive",
  "user_tag": "guest"
}