# Update user password policy

- Operation ID: `updateSettingsUsingPOST`
- HTTP method: `POST`
- Path: `/uauth/settings/password-policy`
- [Human-readable API reference](https://hub.synerise.com/api-reference/identity-and-access-management#tag/Access-control/operation/updateSettingsUsingPOST)

## Self-contained OpenAPI method

The fenced document below contains this method's documentation and all of its local references. It is self-contained; no category or master specification fetch is required.

```yaml
openapi: 3.0.0
info:
  title: Synerise Public API
  version: 1.9.1
paths:
  /uauth/settings/password-policy:
    post:
      tags:
        - Access control
      summary: Update user password policy
      description: |
        Update the user password policy. Entering `0` as the value disables a requirement.

        ---

        **API consumer:** <a href="/api-reference/authorization?tag=Authorization&amp;operationId=userLogin" target="_blank" rel="noopener">Synerise User</a>

        **User role permission required:** `settings_users_am_password_policy: update`
      operationId: updateSettingsUsingPOST
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                attempts:
                  type: integer
                  format: int32
                  description: The number of failed sign-in attempts after which an account is blocked
                block:
                  type: integer
                  format: int32
                  description: The number of days after which an account is blocked after the password expires.
                different:
                  type: integer
                  format: int32
                  description: |
                    Defines how many previous passwords are compared.

                    For example, if set to 3, the new password must be different than the 3 last passwords.
                digits:
                  type: integer
                  format: int32
                  description: The minimum number of digits in a password
                expiration:
                  type: integer
                  format: int32
                  description: The number of days after which the passwords expire
                lowerLetters:
                  type: integer
                  format: int32
                  description: The minimum number of lower-case letters in a password
                maxIdleTime:
                  type: integer
                  format: int32
                  description: Time (in seconds) after which an idle user is signed out
                maxLength:
                  type: integer
                  format: int32
                  description: The maximum number of characters in a password
                minLength:
                  type: integer
                  format: int32
                  description: The minimum number of characters in a password
                nextChange:
                  type: integer
                  format: int32
                  description: Currently not used
                specialChars:
                  type: integer
                  format: int32
                  description: The minimum number of special characters in a password
                upperLetters:
                  type: integer
                  format: int32
                  description: The minimum number of upper-case letters in a password
      responses:
        "200":
          description: New password policy
          content:
            application/json:
              schema:
                type: object
                properties:
                  attempts:
                    type: integer
                    format: int32
                    description: The number of failed sign-in attempts after which an account is blocked
                  block:
                    type: integer
                    format: int32
                    description: The number of days after which an account is blocked after the password expires.
                  different:
                    type: integer
                    format: int32
                    description: |
                      Defines how many previous passwords are compared.

                      For example, if set to 3, the new password must be different than the 3 last passwords.
                  digits:
                    type: integer
                    format: int32
                    description: The minimum number of digits in a password
                  expiration:
                    type: integer
                    format: int32
                    description: The number of days after which the passwords expire
                  lowerLetters:
                    type: integer
                    format: int32
                    description: The minimum number of lower-case letters in a password
                  maxIdleTime:
                    type: integer
                    format: int32
                    description: Time (in seconds) after which an idle user is signed out
                  maxLength:
                    type: integer
                    format: int32
                    description: The maximum number of characters in a password
                  minLength:
                    type: integer
                    format: int32
                    description: The minimum number of characters in a password
                  nextChange:
                    type: integer
                    format: int32
                    description: Currently not used
                  specialChars:
                    type: integer
                    format: int32
                    description: The minimum number of special characters in a password
                  upperLetters:
                    type: integer
                    format: int32
                    description: The minimum number of upper-case letters in a password
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "404":
          description: Not Found
      security:
        - JWT: []
      x-snr-doc-urls:
        - /api-reference/identity-and-access-management#tag/Access-control/operation/updateSettingsUsingPOST
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request POST \
              --url https://api.synerise.com/uauth/settings/password-policy \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
              --header 'content-type: application/json' \
              --data '{"attempts":0,"block":0,"different":0,"digits":0,"expiration":0,"lowerLetters":0,"maxIdleTime":0,"maxLength":0,"minLength":0,"nextChange":0,"specialChars":0,"upperLetters":0}'
        - lang: Python
          label: Python
          source: |-
            import http.client

            conn = http.client.HTTPSConnection("api.synerise.com")

            payload = "{\"attempts\":0,\"block\":0,\"different\":0,\"digits\":0,\"expiration\":0,\"lowerLetters\":0,\"maxIdleTime\":0,\"maxLength\":0,\"minLength\":0,\"nextChange\":0,\"specialChars\":0,\"upperLetters\":0}"

            headers = {
                'Authorization': "Bearer REPLACE_BEARER_TOKEN",
                'content-type': "application/json"
                }

            conn.request("POST", "/uauth/settings/password-policy", payload, headers)

            res = conn.getresponse()
            data = res.read()

            print(data.decode("utf-8"))
        - lang: JavaScript
          label: JavaScript
          source: |-
            const data = JSON.stringify({
              "attempts": 0,
              "block": 0,
              "different": 0,
              "digits": 0,
              "expiration": 0,
              "lowerLetters": 0,
              "maxIdleTime": 0,
              "maxLength": 0,
              "minLength": 0,
              "nextChange": 0,
              "specialChars": 0,
              "upperLetters": 0
            });

            const xhr = new XMLHttpRequest();
            xhr.withCredentials = true;

            xhr.addEventListener("readystatechange", function () {
              if (this.readyState === this.DONE) {
                console.log(this.responseText);
              }
            });

            xhr.open("POST", "https://api.synerise.com/uauth/settings/password-policy");
            xhr.setRequestHeader("Authorization", "Bearer REPLACE_BEARER_TOKEN");
            xhr.setRequestHeader("content-type", "application/json");

            xhr.send(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const http = require("https");

            const options = {
              "method": "POST",
              "hostname": "api.synerise.com",
              "port": null,
              "path": "/uauth/settings/password-policy",
              "headers": {
                "Authorization": "Bearer REPLACE_BEARER_TOKEN",
                "content-type": "application/json"
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on("data", function (chunk) {
                chunks.push(chunk);
              });

              res.on("end", function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.write(JSON.stringify({
              attempts: 0,
              block: 0,
              different: 0,
              digits: 0,
              expiration: 0,
              lowerLetters: 0,
              maxIdleTime: 0,
              maxLength: 0,
              minLength: 0,
              nextChange: 0,
              specialChars: 0,
              upperLetters: 0
            }));
            req.end();
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $request = new HttpRequest();
            $request->setUrl('https://api.synerise.com/uauth/settings/password-policy');
            $request->setMethod(HTTP_METH_POST);

            $request->setHeaders([
              'Authorization' => 'Bearer REPLACE_BEARER_TOKEN',
              'content-type' => 'application/json'
            ]);

            $request->setBody('{"attempts":0,"block":0,"different":0,"digits":0,"expiration":0,"lowerLetters":0,"maxIdleTime":0,"maxLength":0,"minLength":0,"nextChange":0,"specialChars":0,"upperLetters":0}');

            try {
              $response = $request->send();

              echo $response->getBody();
            } catch (HttpException $ex) {
              echo $ex;
            }
        - lang: Java
          label: Java
          source: |-
            HttpResponse<String> response = Unirest.post("https://api.synerise.com/uauth/settings/password-policy")
              .header("Authorization", "Bearer REPLACE_BEARER_TOKEN")
              .header("content-type", "application/json")
              .body("{\"attempts\":0,\"block\":0,\"different\":0,\"digits\":0,\"expiration\":0,\"lowerLetters\":0,\"maxIdleTime\":0,\"maxLength\":0,\"minLength\":0,\"nextChange\":0,\"specialChars\":0,\"upperLetters\":0}")
              .asString();
servers:
  - description: Microsoft Azure EU
    url: https://api.synerise.com
  - description: Microsoft Azure USA
    url: https://api.azu.synerise.com
  - description: Google Cloud Platform
    url: https://api.geb.synerise.com
tags:
  - name: Access control
components:
  securitySchemes:
    JWT:
      type: http
      scheme: bearer
      description: |-
        JWT Bearer token. The header looks like this: `Bearer {JWT}`

        Remember to include the space between 'Bearer' and the token.

        Generate a token via the **Authorization** endpoints.
```
