---
title: "Execute command on agent"
method: POST
path: "/v1/objects/{object-id}/execute-agent-command"
tags: ["Objects"]
---

# Execute command on agent

`POST /v1/objects/{object-id}/execute-agent-command`

## Path parameters

- `object-id` integer, required

## Request body

- object
  - `command` string, required — Command line to execute. Supports macro expansion; the command name is the first token, remaining tokens are passed as arguments.
  - `alarmId` integer — Optional alarm ID used as context for macro expansion. Requires read access to the alarm.
  - `inputFields` object — Optional map of input field values used for macro expansion.

## Response `201`

Command executed successfully

## Other responses

- `401` — Unauthorized
- `403` — User does not have control access to given object
- `404` — Object with given ID does not exist
- `500` — Command execution failed

## Changes

- **2026-06-10** `30e75dc6a94c` — 1 breaking
  - added required request body
- **2026-05-08** `c6aaf3632e48` — 1 breaking
  - removed the request body

[Change history](https://skmtc.dev/netxms/apis/netxms-api/changes/v1/objects/:object-id/execute-agent-command/post.md)

---

[API](https://skmtc.dev/netxms/apis/netxms-api.md) · [All operations](https://skmtc.dev/netxms/apis/netxms-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/netxms/netxms-api/revisions/b04ea2fbcedb/schema)
