Skip to main content

GetAgentState

Will determine if the product's agent is enabled.

Syntax​

Method ID​

#define WAAPI_MID_GET_AGENT_STATE 1012

JSON Input Structure​

{
"input": {
"method": 1012,
"signature": number,
"retrieve_agent_info": boolean,
"assessment_queries": [
{
"data_type": string,
"credentials": {
"base_url": string,
"client_id": string,
"client_secret": string
}
},
...
]
}
}

Input Properties​

ParameterTypeDescription
retrieve_agent_infoboolean(optional) If true, will retrieve the agent's information (eg: agent id). Default value is false.
assessment_queriesarray<object>(optional) A list of queries for different types of assessments (e.g., ZTA score, risk score, device posture).
assessment_queries.data_typestringThe type of data being queried. This value must be unique within the array. Possible values: 'zta_score', 'last_server_connect_time'.
assessment_queries.credentialsobject(optional) Credentials required to authenticate with the API.
assessment_queries.credentials.base_urlstring(optional) The base URL of the API endpoint for the specific data type. If the key does not exist then detection will automatically discover the appropriate base URL.
assessment_queries.credentials.client_idstring(optional) A unique identifier for authentication.
assessment_queries.credentials.client_secretstring(optional) A secret key or password for authentication.

JSON Output Structure​

{
"result": {
"method": 1012,
"code": number,
"timing": number,
"timestamp": string,
"enabled": boolean,
"status": string,
"startup_type": number,
"agent_id": string,
"assessment_results": [
{
"data_type": string,
"return_code": number,
"value": number,
"message": string
},
...
]
}
}

Output Properties​

PropertyTypeDescription
result.methodnumberThe method ID that generated this result.
result.codenumberThe result code. See Result Codes.
result.timingnumberThe measured time for the method call in milliseconds.
result.timestampstringThe timestamp in seconds of when the call was made.
result.enabledbooleanTrue if the product's agent is enabled.
result.statusstring(optional) Status of the agent: 'good', 'poor', 'unmonitored', 'snooze' or 'unknown'.
There are also 'idle' and 'pending_restart' statuses, which were designed specifically for Windows Update Agent to describe the status of the system.
result.startup_typenumber(optional) (Windows Update Agent only) Returns the startup type of the 'wuauserv' service associated with the Windows Update Agent. The value follows the standard defined in https://learn.microsoft.com/en-us/dotnet/api/system.serviceprocess.servicestartmode. If the retrieved value is invalid, falls outside the defined range, or is otherwise unrecognized, the return value will be -1, indicating an unknown startup type.
result.agent_idstring(optional) The id of the product's agent.
result.assessment_resultsarray<object>(optional) List of assessment results, each for a different assessment type (e.g., ZTA score, risk score, device status).
result.assessment_results.data_typestringThe type of data being queried. This value must be unique within the array Possible values: 'zta_score', 'last_server_connect_time'.
result.assessment_results.return_codenumberResult code of the assessment.
result.assessment_results.valuenumber(optional) Value of the assessment result.
• zta_score: Return the device score as a number.
• last_server_connect_time: Return the last server connect time as an epoch number value.
result.assessment_results.messagestring(optional) Additional details about the result. This message is only included if the assessment value could not be retrieved.

Result Codes​

CodeNameDescription
0WAAPI_OKThe operation completed successfully.
note

Other codes may be returned. See the full Result Codes reference for the complete list.

Remarks​

Error Handling​

The results of this function are determined by the error code returned by the call. If successful, WAAPI_OK or a special success code will be returned. Always check both the function return value and the result.code field in the output JSON.

Examples​

Examples will be added here demonstrating the usage of this method.

See Also​


Last updated: 2026-10-01