---
title: "Compile script"
method: POST
path: "/v1/script-library/compile"
tags: ["Script Library"]
---

# Compile script

`POST /v1/script-library/compile`

Compile an NXSL script to check its syntax without executing it. Returns whether compilation succeeded, the error location and message on failure, and any compilation warnings.

## Request body

- object
  - `code` string, required — NXSL source code to compile

## Response `200`

Script compiled (check the success field for the outcome)

- object
  - `success` boolean — True if the script compiled without errors
  - `error` object — Present only when success is false
    - `lineNumber` integer — Line number where the error was detected
    - `message` string — Error description
  - `warnings` object[] — Compilation warnings (may be present regardless of success)
    - `lineNumber` integer
    - `message` string

## Other responses

- `400` — Missing or invalid code field
- `401` — Unauthorized

---

[API](https://skmtc.net/netxms/apis/netxms-api.md) · [All operations](https://skmtc.net/netxms/apis/netxms-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/netxms/netxms-api/versions/14d93e5115dd/schema)
