---
title: "Analyze Numscript source"
method: POST
path: "/v3/numscripts/analyze"
tags: ["Numscript Library"]
---

# Analyze Numscript source

`POST /v3/numscripts/analyze`

## Request

- Base URL: `http://localhost:9000`
- URL: `http://localhost:9000/v3/numscripts/analyze`
- Auth: one of:
  - HTTP bearer
  - none

Validates Numscript v1 and returns the external input schema without reading or changing ledger state. Recognized source failures are returned as diagnostics with an empty input list. Sources over 64 KiB or with more than 32 block-comment open markers receive a syntax diagnostic; internal failures return a server error.

## Request body

- AnalyzeNumscriptRequest
  - `source` string, required: UTF-8 source text, at most 64 KiB. The complete HTTP JSON body is limited to 4 MiB.
  - `version` string, required: Numscript language version; currently v1.

## Response `200`

Analysis result

- AnalyzeNumscriptResponse
  - `data` object, required
    - `inputs` object[], required
      - `name` string, required
      - `type` string, required: Numscript type spelling.
    - `diagnostics` object[], required
      - `kind` 'version' | 'syntax' | 'feature' | 'compile', required
      - `code` string, required
      - `message` string, required
      - `startLine` integer
      - `startColumn` integer
      - `endLine` integer
      - `endColumn` integer

## Other responses

- `400`: Bad request
- `401`: Authentication required (missing or invalid JWT token)
- `403`: Insufficient permissions (missing required scope)
- `413`: Request body exceeds the 4 MiB HTTP limit (`BODY_TOO_LARGE`)
- `500`: Internal server error

## Changes

- **2026-11-03** `f5e817eca038`: 1 info
  - api operation id `analyzeNumscript` removed and replaced with `v3AnalyzeNumscript`
- **2026-10-27** `2ef539e66273`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/formancehq/apis/ledger-api/changes/v3/numscripts/analyze/post.md)

---

[API](https://skmtc.dev/formancehq/apis/ledger-api.md) - [All operations](https://skmtc.dev/formancehq/apis/ledger-api/llms.txt) - [OpenAPI document](https://skmtc.dev/formancehq/apis/ledger-api/revisions/f5e817eca038?raw)
