You have to use a client for which the agent is authorized.
Original Message:
Sent: Jun 12, 2026 11:56 AM
From: Joshua Mclean
Subject: Stop/Start Agent via REST API
If no scripts are allowed to run in client 0, how can you stop/inactivate an agent via REST API call?
Original Message:
Sent: Jan 29, 2026 10:49 AM
From: Markus Embacher
Subject: Stop/Start Agent via REST API
Hi Steve,
no executions allowed in client 0, so it denies to execute the script you are sending.
Further, the syntax is
:SET &RET#=MODIFY_SYSTEM("TERMINATE","AGENT")
not
:MODIFY_SYSTEM TERMINATE,AGENT
Regards, Markus
Original Message:
Sent: Jan 29, 2026 10:18 AM
From: Steven Blumenkrantz
Subject: Stop/Start Agent via REST API
I have written the following python code and when it runs, I get the following error. I am confused because when I use the UI to stop/start an agent, I do it in client ZERO because that operation affects ALL other clients.
Anyway, when I use a different existing client id, the code seems to work (Status Code of 200 is returned). The issue is that the agent continues to be active. Is my code wrong?
ae/api/v1/0/scripts; status=400; body={
"code" : 7020,
"error" : "Activation in client 0 is not permitted.",
"details" : "No detail information available."
}
---------------------------------
json_payload = {
"script": f":MODIFY_SYSTEM, \'TERMINATE\', \'agent\'"
}
response = post_api(f"/ae/api/v1/{CLIENT_ZERO}/scripts", json.dumps(json_payload), auth)
def post_api(endpoint: str, jsonPayload: str, auth: tuple) -> Any:
try:
response = requests.post(
f"{REST_ENDPOINT}/ae/api/v1/0/scripts",
headers={"Content-Type": "application/json"},
data=jsonPayload,
auth=auth,
timeout=REQUEST_TIMEOUT
)
response.raise_for_status()
return response
except requests.RequestException as e:
# Use the response attached to the exception if present,
# otherwise fall back to the local variable (which may be None)
resp = getattr(e, "response", response)
if resp is not None and getattr(resp, "status_code", None) == 200:
return resp
if resp is not None:
try:
body = resp.text
except Exception:
body = '<unreadable response body>'
logging.error("POST API request failed: %s; status=%s; body=%s", e, getattr(resp, 'status_code', None), body)
else:
logging.exception("POST API request failed: %s", e)
return None