---
title: "Execute script without object context"
method: POST
path: "/v1/execute-script"
tags: ["Script Library"]
---

# Execute script without object context

`POST /v1/execute-script`

Execute ad-hoc NXSL script provided in the request body without object context
(`$object` and `$node` are not set). Script runs with access rights of the calling user.

Requires `SYSTEM_ACCESS_MANAGE_SCRIPTS`.

By default the script is executed synchronously and only its return value is provided.
When `stream` is true, the script is compiled synchronously (compilation errors are still
reported with status 400), then the server returns 202 with a single-use token. The script
starts once the client connects to the WebSocket URL from the response; script output
(`print`, `println`, `trace`) and the final result are delivered over that connection.
See GET /v1/script-executions/output/{token}. A running script can be stopped with
POST /v1/script-executions/{execution-id}/stop or by sending `{"type":"stop"}` over the WebSocket.

## Request body

- ScriptExecutionRequest
  - `parameters` string[] — Optional list of parameters to be passed to the script
  - `resultAsMap` boolean — If true, result will always be presented as a map (JSON object)
  - `script` string, required — Source code of the script
  - `stream` boolean — If true, execute script asynchronously and stream its output via WebSocket

## Response `200`

Script executed successfully

- ScriptExecutionResult
  - `result` unknown

## Other responses

- `202` — Script compiled and execution created in streaming mode. Connect to the returned WebSocket URL within `expiresIn` seconds to start the script and receive its output; otherwise execution is cancelled.
- `400` — Invalid arguments or script compilation error
- `401` — Unauthorized
- `403` — User does not have SYSTEM_ACCESS_MANAGE_SCRIPTS permission
- `500` — Script execution failed

## Changes

- **2026-09-30** `c062a41190a9` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/netxms/apis/netxms-api/changes/v1/execute-script/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.dev/netxms/apis/netxms-api/revisions/129789f8868f?raw)
