Validate Parse Script
Validates a JavaScript parsing script without running it against real data. Upload your `.js` file as `multipart/form-data`. Checks that the script parses cleanly, exports a default function, and returns a string when called with an empty object.
The validation runs in the same sandboxed V8 engine used at indexing time, so a script that validates will work when you index files.
Returns HTTP 200 for both valid and invalid scripts - `valid: false` is a normal result, not an error.
### Error Types
| `error_type` | Meaning |
|---|---|
| `syntax_error` | JavaScript fails to parse |
| `no_export` | Script does not export a default function |
| `wrong_return_type` | Function returns something other than a string |
| `timeout` | Execution exceeded 5 seconds |
| `memory_exceeded` | Execution exceeded 32 MB heap |
Authentication
AuthorizationBearer
Bearer token authentication using API key
Headers
X-Organization-ID
Authorization
Bearer token - your Captain API key.
Request
This endpoint expects a multipart form containing a file.
file
The .js parsing script file to validate. Max 1 MB.
Response
Validation result. Returned for both valid AND invalid scripts.
valid
True if the script passes all validation checks.
error
Human-readable error message. Null when valid=true.
error_type
Error category. Null when valid=true.
Allowed values: