# Add a new Passcode payload configuration to an existing profile To create Passcode policy ## Endpoints **POST** `/api/v1/mdm/profiles/{profile_id}/payloads/passcodepolicy` ## Request URL ``` https://{serverurl}/api/v1/mdm/profiles/{profile_id}/payloads/passcodepolicy ``` ## Scope ``` MDMOnDemand.MDMDeviceMgmt.CREATE ``` ## Header ``` Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52 ``` ## Request Parameters ### Path Parameters - **profile_id** (string) — **Mandatory** Unique identifier of the profile. Obtain from the [Create Profile](https://www.manageengine.com/mobile-device-management/help/api/cloud/profiles-create-profile.html) or [Get Profiles](https://www.manageengine.com/mobile-device-management/help/api/cloud/profiles-get-profile.html) response. ### Query Parameters - **t** (long) — Optional - **ignoreHeader** (boolean) — Optional - **qlt** (long) — Optional - **previousTab** (string) — Optional - **service** (string) — Optional - **search** (string) — Optional Free-text search string applied to the default searchable fields of the resource - **all** (boolean) — Optional - **dc_customerid** (long) — Optional - **mdm_instance** (string) — Optional - **signupsrc** (string) — Optional - **zaaid** (string) — Optional - **command** (string) — Optional - **orderby** (string) — Optional - **sortorder** (string) — Optional - **select_all** (boolean) — Optional When true, applies the operation to every record matching the current filter rather than to specific IDs. Default: false - **zoho-internal** (boolean) — Optional - **dc_instance** (string) — Optional - **SUBREQUEST** (string) — Optional - **source** (string) — Optional - **nocache** (long) — Optional param to avoid being served from cache - **wms_csrparam** (string) — Optional CSRF Token ### Request Body **Content-Type:** `application/json` **Type:** JSON object #### Attributes - **max_passcode_age** (integer) — Optional Maximum Passcode Age in days. Allowed values: 1-170 - **require_alphanumeric** (boolean) — Optional Mandates the use of alphanumeric values as passcode - **max_failed_attempts** (integer) — Optional Maximum number of failed attempts before factory reset. Allowed values: 3-9 - **min_passcode_length** (integer) — Optional Minimum passcode length. Allowed values: 1-16 - **min_complex_chars** (integer) — Optional Minimum number of special characters in the passcode. Allowed values: 1-4 - **no_of_passcode_maintained** (integer) — Optional Number of passcodes maintained in history. Allowed values: 1-50 - **allow_simple_value** (boolean) — Optional Allow numerical values to be configured as passcode - **auto_lock_idle_for** (integer) — Optional Maximum idle time (minutes) before auto-lock. Allowed values: 1, 2, 3, 4, 5, 10, 15 - **max_grace_period** (integer) — Optional Maximum time (minutes) to unlock device without passcode prompt. Allowed values: 0-240 ## Sample Request ### Curl ```bash curl --request POST \ --url https://appdomain/api/v1/mdm/profiles/{profile_id}/payloads/passcodepolicy \ --header 'Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52' \ --header 'content-type: application/json' \ --data '{}' ``` ### Java ```java import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.io.IOException; import java.net.http.HttpTimeoutException; public class Main { public static void main(String[] args) { HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://appdomain/api/v1/mdm/profiles/{profile_id}/payloads/passcodepolicy")) .header("content-type", "application/json") .header("Authorization", "Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52") .method("POST", HttpRequest.BodyPublishers.ofString("{}")) .build(); HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ### Python ```python import http.client conn = http.client.HTTPSConnection("appdomain") payload = "{}" headers = { 'content-type': "application/json", 'Authorization': "Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52" } conn.request("POST", "/api/v1/mdm/profiles/{profile_id}/payloads/passcodepolicy", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` ### Deluge ```javascript headersMap = Map(); headersMap.put("Content-Type", "application/json"); headersMap.put("Accept", "application/json"); data=Map(); response = invokeUrl [ url: "https://appDomain/api/v1/mdm/profiles/{profile_id}/payloads/passcodepolicy" type: POST headers: headersMap body: data connection: connection_name ] info response; ``` ### PowerShell ```powershell $headers=@{} $headers.Add("content-type", "application/json") $headers.Add("Authorization", "Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52") $response = Invoke-WebRequest -Uri 'https://appdomain/api/v1/mdm/profiles/{profile_id}/payloads/passcodepolicy' -Method POST -Headers $headers -ContentType 'application/json' -Body '{}' ``` ## Sample Request Body Add an iOS passcode policy payload to the profile. ```json { "max_passcode_age": 150, "min_passcode_length": 5, "require_alphanumeric": true, "min_complex_chars": 2, "no_of_passcode_maintained": 50, "allow_simple_value": false, "auto_lock_idle_for": 3, "max_grace_period": 0, "max_failed_attempts": 9 } ``` ## Response Parameters ### HTTP Code 200 **Response Body:** `application/json` **Type:** JSON object #### Attributes - **payload_id** (long) Unique identifier for the created payload item - **max_passcode_age** (integer) Maximum Passcode Age in days - **require_alphanumeric** (boolean) Whether alphanumeric passcode is required - **max_failed_attempts** (integer) Maximum failed attempts before factory reset - **min_passcode_length** (integer) Minimum passcode length - **min_complex_chars** (integer) Minimum special characters in passcode - **no_of_passcode_maintained** (integer) Number of passcodes maintained in history - **allow_simple_value** (boolean) Whether simple (numeric) passcode is allowed - **auto_lock_idle_for** (integer) Auto-lock idle time in minutes - **max_grace_period** (integer) Grace period in minutes before passcode prompt ## Sample Response: HTTP 200 Payload successfully added with configuration details. ```json { "max_passcode_age": 150, "min_passcode_length": 5, "payload_id": 9007199254741000, "require_alphanumeric": true, "min_complex_chars": 2, "no_of_passcode_maintained": 50, "allow_simple_value": false, "auto_lock_idle_for": 3, "max_grace_period": 0, "max_failed_attempts": 9 } ``` ## Possible Response Codes - **200** — HTTP code ## Rate Limit **Duration:** 1 minute **Threshold:** 30 **Lock period:** 5 minutes - **Duration** — Time window for the threshold. - **Threshold** — Number of API calls allowed within the specified duration. - **Lock Period** — Wait time before consecutive API requests.