# Update device authorization settings

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

## 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/device-control:
    post:
      tags:
        - Settings
      summary: Update device authorization settings
      description: |
        Update the settings related to authorization of logins from unknown devices.

        ---

        **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: updateDeviceSettingsUsingPOST
      security:
        - JWT: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                deviceControlMode:
                  type: string
                  description: |
                    Defines the type of device authorization.

                    - OFF: No device authorization.
                    - SOFT: The Profile is notified about logins from a new device, but the access is not blocked.
                    - HARD: Login attempts from the new device are blocked until the Profile authorizes the device with the link or token received by email.
                    - CONDITIONAL_BASED_ON_LOCATION: If a Profile logs in from a new device in Poland, they receive a notification (same as with SOFT setting). If the new device is outside of Poland, it must be authorized with a link or token received by email (same as with HARD setting). Other countries will be supported in the future.
                  enum:
                    - OFF
                    - SOFT
                    - HARD
                    - CONDITIONAL_BASED_ON_LOCATION
                hardMailBody:
                  type: string
                  description: HTML body of the device authorization email for hard mode. All `"` characters must be escaped and all the code must be a single line.
                hardMailTitle:
                  type: string
                  description: Subject of the device authorization email for hard mode.
                hardTemplateId:
                  type: string
                  description: ID of the device authorization email template for hard mode. If you use a template, it overrides the content sent in `hardMailBody`.
                softMailBody:
                  type: string
                  description: HTML body of the device authorization email for soft mode. All `"` characters must be escaped and all the code must be a single line.
                softMailTitle:
                  type: string
                  description: Subject of the device authorization email for soft mode.
                softTemplateId:
                  type: string
                  description: ID of the device authorization email template for soft mode. If you use a template, it overrides the content sent in `softMailBody`.
                deviceUnlockSuccessRedirectUrl:
                  type: string
                deviceUnlockAlreadyConfirmedRedirectUrl:
                  type: string
        required: true
      responses:
        "200":
          description: Current settings
          content:
            application/json:
              schema:
                type: object
                properties:
                  deviceControlMode:
                    type: string
                    description: |
                      Defines the type of device authorization.

                      - OFF: No device authorization.
                      - SOFT: The Profile is notified about logins from a new device, but the access is not blocked.
                      - HARD: Login attempts from the new device are blocked until the Profile authorizes the device with the link or token received by email.
                      - CONDITIONAL_BASED_ON_LOCATION: If a Profile logs in from a new device in Poland, they receive a notification (same as with SOFT setting). If the new device is outside of Poland, it must be authorized with a link or token received by email (same as with HARD setting). Other countries will be supported in the future.
                    enum:
                      - OFF
                      - SOFT
                      - HARD
                      - CONDITIONAL_BASED_ON_LOCATION
                  hardMailBody:
                    type: string
                    description: HTML body of the device authorization email for hard mode. All `"` characters must be escaped and all the code must be a single line.
                  hardMailTitle:
                    type: string
                    description: Subject of the device authorization email for hard mode.
                  hardTemplateId:
                    type: string
                    description: ID of the device authorization email template for hard mode. If you use a template, it overrides the content sent in `hardMailBody`.
                  softMailBody:
                    type: string
                    description: HTML body of the device authorization email for soft mode. All `"` characters must be escaped and all the code must be a single line.
                  softMailTitle:
                    type: string
                    description: Subject of the device authorization email for soft mode.
                  softTemplateId:
                    type: string
                    description: ID of the device authorization email template for soft mode. If you use a template, it overrides the content sent in `softMailBody`.
                  deviceUnlockSuccessRedirectUrl:
                    type: string
                  deviceUnlockAlreadyConfirmedRedirectUrl:
                    type: string
        "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/updateDeviceSettingsUsingPOST
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request POST \
              --url https://api.synerise.com/sauth/settings/device-control \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
              --header 'content-type: application/json' \
              --data '{"deviceControlMode":"OFF","hardMailBody":"string","hardMailTitle":"string","hardTemplateId":"string","softMailBody":"string","softMailTitle":"string","softTemplateId":"string","deviceUnlockSuccessRedirectUrl":"string","deviceUnlockAlreadyConfirmedRedirectUrl":"string"}'
        - lang: Python
          label: Python
          source: |-
            import http.client

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

            payload = "{\"deviceControlMode\":\"OFF\",\"hardMailBody\":\"string\",\"hardMailTitle\":\"string\",\"hardTemplateId\":\"string\",\"softMailBody\":\"string\",\"softMailTitle\":\"string\",\"softTemplateId\":\"string\",\"deviceUnlockSuccessRedirectUrl\":\"string\",\"deviceUnlockAlreadyConfirmedRedirectUrl\":\"string\"}"

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

            conn.request("POST", "/sauth/settings/device-control", payload, headers)

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

            print(data.decode("utf-8"))
        - lang: JavaScript
          label: JavaScript
          source: |-
            const data = JSON.stringify({
              "deviceControlMode": "OFF",
              "hardMailBody": "string",
              "hardMailTitle": "string",
              "hardTemplateId": "string",
              "softMailBody": "string",
              "softMailTitle": "string",
              "softTemplateId": "string",
              "deviceUnlockSuccessRedirectUrl": "string",
              "deviceUnlockAlreadyConfirmedRedirectUrl": "string"
            });

            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/device-control");
            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/device-control",
              "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({
              deviceControlMode: 'OFF',
              hardMailBody: 'string',
              hardMailTitle: 'string',
              hardTemplateId: 'string',
              softMailBody: 'string',
              softMailTitle: 'string',
              softTemplateId: 'string',
              deviceUnlockSuccessRedirectUrl: 'string',
              deviceUnlockAlreadyConfirmedRedirectUrl: 'string'
            }));
            req.end();
        - lang: PHP
          label: PHP
          source: |-
            <?php

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

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

            $request->setBody('{"deviceControlMode":"OFF","hardMailBody":"string","hardMailTitle":"string","hardTemplateId":"string","softMailBody":"string","softMailTitle":"string","softTemplateId":"string","deviceUnlockSuccessRedirectUrl":"string","deviceUnlockAlreadyConfirmedRedirectUrl":"string"}');

            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/device-control")
              .header("Authorization", "Bearer REPLACE_BEARER_TOKEN")
              .header("content-type", "application/json")
              .body("{\"deviceControlMode\":\"OFF\",\"hardMailBody\":\"string\",\"hardMailTitle\":\"string\",\"hardTemplateId\":\"string\",\"softMailBody\":\"string\",\"softMailTitle\":\"string\",\"softTemplateId\":\"string\",\"deviceUnlockSuccessRedirectUrl\":\"string\",\"deviceUnlockAlreadyConfirmedRedirectUrl\":\"string\"}")
              .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.
```
