---
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

## Changes

- **2026-06-17** `ddc6169aa951` — 1 info
  - endpoint added
- **2026-05-08** `c6aaf3632e48` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/netxms/apis/netxms-api/changes/v1/script-library/compile/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)
