---
title: "Validate Parsing Script"
method: POST
path: "/v2/parsing-scripts/validate"
tags: ["indexing"]
---

# Validate Parsing Script

`POST /v2/parsing-scripts/validate`

Validate a JavaScript parsing script without running it against real data.

Upload your .js file as multipart/form-data under the `file` field. The
endpoint runs the same V8 sandbox that `json_handler` uses at indexing
time, so a script that validates here will work when you index files.

Checks:
1. JavaScript syntax parses cleanly
2. Script exports a default function

Returns HTTP 200 for both valid and invalid scripts — `valid: false` is
a business-logic result, not an HTTP error. 4xx/5xx responses indicate
auth failures, malformed requests, or service unavailability.

## Headers

- `authorization` string, nullable

## Response `200`

Successful Response

- ValidateParsingScriptResponse
  - `error` string, nullable — Human-readable error message when valid=false. Null when valid=true.
  - `error_type` string, nullable — Error category when valid=false: 'syntax_error', 'no_export'. Null when valid=true.
  - `valid` boolean, required — True if the script passes all validation checks

## Other responses

- `400` — Malformed request — empty upload or missing X-Organization-ID header.
- `401` — Missing or invalid API key.
- `403` — API key does not belong to the organization, or trial/billing limits exceeded.
- `413` — Script file exceeds 1000000 bytes.
- `503` — Validation service temporarily unavailable (py_mini_racer not installed).

---

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