# Update ban settings

- Operation ID: `updateBanSettingsUsingPOST`
- HTTP method: `POST`
- Path: `/sauth/settings/ban`
- [Human-readable API reference](https://hub.synerise.com/api-reference/identity-and-access-management#tag/Settings/operation/updateBanSettingsUsingPOST)

## 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:
  /sauth/settings/ban:
    post:
      tags:
        - Settings
      summary: Update ban settings
      description: |
        Update the configuration of applying bans after a number of failed logins.

        ---

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

        **User role permission required:** `settings_customers_iam_locking_policy: update`
      operationId: updateBanSettingsUsingPOST
      security:
        - JWT: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                blockingForClientEnabled:
                  type: boolean
                  description: When TRUE, first- and second-level bans are enabled. Permanent bans are always enabled.
                firstBanCollectingTime:
                  type: integer
                  format: int32
                  description: |
                    Time in seconds. If a Profile fails to log in too many times during this time, the account is banned. The number of login attempts is defined in `firstBanThreshold` and the duration is defined in `firstBanDuration`.

                    **Note:** The timer starts at the first login attempt and is common for first-level, second-level, and permanent bans.
                firstBanDuration:
                  type: integer
                  format: int32
                  description: Duration of the first-level ban in seconds. The first-level ban is applied to a Profile's identifier and cancelled after a successful password reset.
                firstBanThreshold:
                  type: integer
                  format: int32
                  description: The number of failed login attempts before the first-level ban is applied.
                secondBanCollectingTime:
                  type: integer
                  format: int32
                  description: |
                    Time in seconds. If a Profile fails to log in too many times during this time, the account is banned. The number of login attempts is defined in `secondBanThreshold` and the duration is defined in `secondBanDuration`.

                    **Note:** The timer starts at the first login attempt and is common for first-level, second-level, and permanent bans.
                secondBanDuration:
                  type: integer
                  format: int32
                  description: Duration of the second-level ban in seconds. The second-level ban is applied to a Profile's identifier and cancelled after a successful password reset.
                secondBanThreshold:
                  type: integer
                  format: int32
                  description: The number of failed login attempts before the second-level ban is applied.
                permanentBanCollectingTime:
                  type: integer
                  format: int32
                  description: |
                    Time in seconds. If a Profile fails to log in too many times during this time, the account is banned. The number of login attempts is defined in `permanentBanThreshold` and the duration is defined in `permanentBanDuration`.

                    **Note:** The timer starts at the first login attempt and is common for first-level, second-level, and permanent bans.
                permanentBanDuration:
                  type: integer
                  format: int32
                  description: Duration of the permanent ban in seconds. The permanent ban is applied to an IP address and cancelled after a successful password reset.
                permanentBanThreshold:
                  type: integer
                  format: int32
                  description: The number of failed login attempts before the permanent ban is applied.
        required: true
      responses:
        "200":
          description: Current settings
          content:
            application/json:
              schema:
                type: object
                properties:
                  blockingForClientEnabled:
                    type: boolean
                    description: When TRUE, first- and second-level bans are enabled. Permanent bans are always enabled.
                  firstBanCollectingTime:
                    type: integer
                    format: int32
                    description: |
                      Time in seconds. If a Profile fails to log in too many times during this time, the account is banned. The number of login attempts is defined in `firstBanThreshold` and the duration is defined in `firstBanDuration`.

                      **Note:** The timer starts at the first login attempt and is common for first-level, second-level, and permanent bans.
                  firstBanDuration:
                    type: integer
                    format: int32
                    description: Duration of the first-level ban in seconds. The first-level ban is applied to a Profile's identifier and cancelled after a successful password reset.
                  firstBanThreshold:
                    type: integer
                    format: int32
                    description: The number of failed login attempts before the first-level ban is applied.
                  secondBanCollectingTime:
                    type: integer
                    format: int32
                    description: |
                      Time in seconds. If a Profile fails to log in too many times during this time, the account is banned. The number of login attempts is defined in `secondBanThreshold` and the duration is defined in `secondBanDuration`.

                      **Note:** The timer starts at the first login attempt and is common for first-level, second-level, and permanent bans.
                  secondBanDuration:
                    type: integer
                    format: int32
                    description: Duration of the second-level ban in seconds. The second-level ban is applied to a Profile's identifier and cancelled after a successful password reset.
                  secondBanThreshold:
                    type: integer
                    format: int32
                    description: The number of failed login attempts before the second-level ban is applied.
                  permanentBanCollectingTime:
                    type: integer
                    format: int32
                    description: |
                      Time in seconds. If a Profile fails to log in too many times during this time, the account is banned. The number of login attempts is defined in `permanentBanThreshold` and the duration is defined in `permanentBanDuration`.

                      **Note:** The timer starts at the first login attempt and is common for first-level, second-level, and permanent bans.
                  permanentBanDuration:
                    type: integer
                    format: int32
                    description: Duration of the permanent ban in seconds. The permanent ban is applied to an IP address and cancelled after a successful password reset.
                  permanentBanThreshold:
                    type: integer
                    format: int32
                    description: The number of failed login attempts before the permanent ban is applied.
        "401":
          description: JWT missing, expired, or invalid
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Summary of the error
                  message:
                    type: string
                    description: Description of the problem
                  errors:
                    type: array
                    description: An array of detailed error messages, if applicable
                    items:
                      type: object
                      properties:
                        code:
                          type: integer
                          description: Error code
                        field:
                          type: string
                          description: Name of the field that did not pass validation
                        message:
                          type: string
                          description: Details of the problem
                        rejectedValue:
                          description: The value that did not pass validation
                          anyOf:
                            - type: string
                            - type: number
                            - type: integer
                            - type: boolean
                            - type: array
                              items: {}
                            - type: object
                  status:
                    type: integer
                    format: int32
                    description: Status code
                  timestamp:
                    type: string
                    description: Time when the message was sent
                  path:
                    type: string
                    description: URL of the requested resource
                  traceId:
                    type: string
                    description: ID for debugging
        "403":
          description: Insufficient permissions or wrong JWT scope (for example, profile token where a workspace token was required)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Summary of the error
                  message:
                    type: string
                    description: Description of the problem
                  errors:
                    type: array
                    description: An array of detailed error messages, if applicable
                    items:
                      type: object
                      properties:
                        code:
                          type: integer
                          description: Error code
                        field:
                          type: string
                          description: Name of the field that did not pass validation
                        message:
                          type: string
                          description: Details of the problem
                        rejectedValue:
                          description: The value that did not pass validation
                          anyOf:
                            - type: string
                            - type: number
                            - type: integer
                            - type: boolean
                            - type: array
                              items: {}
                            - type: object
                  status:
                    type: integer
                    format: int32
                    description: Status code
                  timestamp:
                    type: string
                    description: Time when the message was sent
                  path:
                    type: string
                    description: URL of the requested resource
                  traceId:
                    type: string
                    description: ID for debugging
        "404":
          description: Not Found
          content: {}
      x-snr-doc-urls:
        - /api-reference/identity-and-access-management#tag/Settings/operation/updateBanSettingsUsingPOST
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request POST \
              --url https://api.synerise.com/sauth/settings/ban \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
              --header 'content-type: application/json' \
              --data '{"blockingForClientEnabled":true,"firstBanCollectingTime":0,"firstBanDuration":0,"firstBanThreshold":0,"secondBanCollectingTime":0,"secondBanDuration":0,"secondBanThreshold":0,"permanentBanCollectingTime":0,"permanentBanDuration":0,"permanentBanThreshold":0}'
        - lang: Python
          label: Python
          source: |-
            import http.client

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

            payload = "{\"blockingForClientEnabled\":true,\"firstBanCollectingTime\":0,\"firstBanDuration\":0,\"firstBanThreshold\":0,\"secondBanCollectingTime\":0,\"secondBanDuration\":0,\"secondBanThreshold\":0,\"permanentBanCollectingTime\":0,\"permanentBanDuration\":0,\"permanentBanThreshold\":0}"

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

            conn.request("POST", "/sauth/settings/ban", payload, headers)

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

            print(data.decode("utf-8"))
        - lang: JavaScript
          label: JavaScript
          source: |-
            const data = JSON.stringify({
              "blockingForClientEnabled": true,
              "firstBanCollectingTime": 0,
              "firstBanDuration": 0,
              "firstBanThreshold": 0,
              "secondBanCollectingTime": 0,
              "secondBanDuration": 0,
              "secondBanThreshold": 0,
              "permanentBanCollectingTime": 0,
              "permanentBanDuration": 0,
              "permanentBanThreshold": 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/sauth/settings/ban");
            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": "/sauth/settings/ban",
              "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({
              blockingForClientEnabled: true,
              firstBanCollectingTime: 0,
              firstBanDuration: 0,
              firstBanThreshold: 0,
              secondBanCollectingTime: 0,
              secondBanDuration: 0,
              secondBanThreshold: 0,
              permanentBanCollectingTime: 0,
              permanentBanDuration: 0,
              permanentBanThreshold: 0
            }));
            req.end();
        - lang: PHP
          label: PHP
          source: |-
            <?php

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

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

            $request->setBody('{"blockingForClientEnabled":true,"firstBanCollectingTime":0,"firstBanDuration":0,"firstBanThreshold":0,"secondBanCollectingTime":0,"secondBanDuration":0,"secondBanThreshold":0,"permanentBanCollectingTime":0,"permanentBanDuration":0,"permanentBanThreshold":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/sauth/settings/ban")
              .header("Authorization", "Bearer REPLACE_BEARER_TOKEN")
              .header("content-type", "application/json")
              .body("{\"blockingForClientEnabled\":true,\"firstBanCollectingTime\":0,\"firstBanDuration\":0,\"firstBanThreshold\":0,\"secondBanCollectingTime\":0,\"secondBanDuration\":0,\"secondBanThreshold\":0,\"permanentBanCollectingTime\":0,\"permanentBanDuration\":0,\"permanentBanThreshold\":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: Settings
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.
```
