# Create a new sensor with scripts, output variables, and execution metadata Creates a new sensor with scripts, output variables, and execution metadata. Supports WINDOWS, LINUX, and MAC platforms. ## Endpoint `POST /intelligence/sensors/api/addSensor` ## Request ### Request URL https://[*{serverurl}*](https://www.manageengine.com/products/desktop-central/help/api/cloud/oauth-authentication-endpoint-domain.html)/intelligence/sensors/api/addSensor ### Scope `DesktopCentralCloud.Platform.CREATE` ### Header `Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52` ### Request Parameters #### Request Headers - **Content-Type** — string — **Mandatory**: `application/json` - **Accept** — string — **Mandatory**: `application/addSensor.v1+json` #### Request Body `application/json` - JSON Object - **sensorDetails** — JSON Object — Optional - Container object holding all sensor configuration details ### Sample Request ```curl curl --request POST \ --url https://appdomains/intelligence/sensors/api/addSensor \ --header 'Accept: application/addSensor.v1+json' \ --header 'Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52' \ --header 'Content-Type: application/json' \ --data '{}' ``` ### Sample Request Body Create a custom disk health sensor for Windows with one output variable ```json { "sensorDetails": { "isCustomSensor": true, "sensorName": "Disk Health Sensor", "executionType": "ondemand", "description": "Collects disk metrics", "numberOfRun": 30, "outputVariables": [ { "variableName": "diskUsage", "displayName": "Disk Usage", "defaultValue": "0", "dataType": 1, "description": "Usage percentage", "isPII": false, "outputVariableID": 0 } ], "forceUpdate": false, "sensorScriptDetails": [ { "scriptArgs": "--quick", "fileName": "collectDisk.ps1", "exitCode": "0,3010", "content": "Get-WmiObject Win32_DiskDrive | Select-Object Status", "platform": "WINDOWS" } ] } } ``` ## Response Parameters ### HTTP Code 200 #### Response Body `application/json` - JSON Object - **status** — string - Result of the operation: 'success' on successful creation - **message** — string - A confirmation message (e.g., 'Sensor Disk Health Sensor added successfully') - **sensorID** — string - Unique ID of the newly created sensor - **sensorVersionID** — string - Version ID of the created sensor - **sensorName** — string - Name of the created sensor ### HTTP Code 400 #### Response Body `application/json` - JSON Object - **errorCode** — string - Error code indicating which validation failed - **errorMessage** — string - Details about which field failed and why ### HTTP Code 401 #### Response Body `application/json` - JSON Object - **errorCode** — long - Unauthorized error code: credentials missing, expired, or invalid - **errorMsg** — string - Authentication failure reason ### HTTP Code 500 #### Response Body `application/json` - JSON Object - **errorCode** — string - Error code for the server error - **errorMessage** — string - Details about the server error ### Possible Response Codes - `200` — HTTP code - `400` — HTTP code - `401` — HTTP code - `500` — HTTP code ### Sample Response: HTTP 200 Sensor created successfully ```json { "sensorVersionID": "67890", "sensorName": "Disk Health Sensor", "message": "Sensor Disk Health Sensor added successfully", "status": "success", "sensorID": "12345" } ``` ### Sample Response: HTTP 400 Sensor name contains invalid characters ```json { "errorMessage": "Sensor name contains invalid characters. Only alphanumeric, underscore and space are allowed.", "errorCode": "SENSOR_VALIDATION_ERROR" } ``` ### Sample Response: HTTP 401 Login credentials are missing or invalid ```json { "errorMessage": "Authentication required. Provide valid credentials.", "errorCode": "UNAUTHORIZED" } ``` ### Sample Response: HTTP 500 Server error while creating the sensor ```json { "errorMessage": "An internal error occurred while creating the sensor.", "errorCode": "INTERNAL_ERROR" } ``` ## Rate Limits ![](https://www.zohowebstatic.com/sites/zweb/images/people/ico-help.png) **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.