PUT

Update Security Policy

Updates an existing Security Policy.

kind is immutable. Attempting to change kind on an existing policy returns a 422 Unprocessable Entity response.

authentication_factor_ids and reset_password_authentication_factor_ids use full-replace semantics — the array you send replaces the existing list entirely. Send an empty array ([]) to clear all factors.

admin_policy_id and profile_policy_id must reference an app-kind policy belonging to the same account, or the request returns 422.

Resource URL

https://<subdomain>.onelogin.com/api/2/policies/<id>

Header Parameters

ParameterDescription
Authorizationbearer:<access_token>. Requires a scope of Manage All.
Content-Typeapplication/json

Request Parameters

ParameterTypeDescription
idIntegerRequired. Policy ID.
...Any updatable attribute from the Policy Resource page. kind cannot be changed.

Sample Responses

200 Success

{
  "status": {
    "error": false,
    "code": 200,
    "type": "success",
    "message": "Success"
  },
  "data": [
    {
      "id": 3,
      "name": "Custom User Policy",
      "kind": "user",
      "is_default": false,
      "minimum_password_length": 12
    }
  ]
}

422 Unprocessable Entity

{
  "status": {
    "error": true,
    "code": 422,
    "type": "unprocessable_entity",
    "message": "Kind cannot be changed after policy creation"
  }
}

Postman Collection

Add the Security Policies endpoints to your Postman workspace using the OneLogin Postman collection.

Run In Postman

    Clicking Run in Postman button navigates to the page where you can fork the collection to your workspace. Forking the collection into your workspace will enable you to contribute to the source collection using pull requests. You can also view the collection in a public workspace if you like and even import a copy of the collection using the links present on the screen.

Sample Code

curl -X PUT \
  https://<subdomain>.onelogin.com/api/2/policies/3 \
  -H 'Authorization: bearer:<access_token>' \
  -H 'Content-Type: application/json' \
  -d '{
        "minimum_password_length": 12
      }'