The code validation endpoints provide static and structural checks for JavaScript and TypeScript source code before execution. Use them to verify syntax, transpile TypeScript, inspect declared dependencies, parse magic comments, confirm a value matches a return type, or run the full validation pipeline in a single request.
All endpoints accept a JSON request body and return JSON responses. They share the same error envelope (error, code, timestamp, optional details) for non-success statuses.
Validate Script
Section titled “Validate Script”POST /api/v1/exec/validate/script
Section titled “POST /api/v1/exec/validate/script”Run the full validation pipeline (syntax, TypeScript, dependencies, magic comments, and source normalization) against a script in one call.
This endpoint takes no parameters.
Request Body
Section titled “Request Body”| Name | Type | Required | Description |
|---|---|---|---|
code | string | Yes | Source code to validate |
Response
Section titled “Response”{ "valid": true, "results": { "syntax": { "valid": true, "message": "JavaScript syntax is valid" }, "typescript": { "valid": true, "transpiledLength": 412 }, "dependencies": { "total": 3, "installed": 3, "missing": 0, "missingModules": [], "allInstalled": true }, "magicComments": { "returns": "{ status: number, body: string }" }, "normalized": false, "transformations": [] }, "message": "Script validated successfully"}{ "error": "VALIDATION_ERROR", "code": "VALIDATION_ERROR", "timestamp": "2026-01-15T12:00:00.000Z", "details": { "field": "code", "reason": "code is required" }}| Error Code | Title | Description | Resolution |
|---|---|---|---|
VALIDATION_ERROR | Invalid input | Request parameters failed validation | Check parameter format and requirements |
{ "error": "Internal server error", "code": "ERROR_500", "timestamp": "2026-01-15T12:00:00.000Z"}SDK Usage
Section titled “SDK Usage”const result = await client.exec.validate.validateScript({ code: "export default async function() { return { status: 200, body: 'ok' }; }"});Validate Syntax
Section titled “Validate Syntax”POST /api/v1/exec/validate/syntax
Section titled “POST /api/v1/exec/validate/syntax”Validate the JavaScript syntax of a source string and report normalization transformations that were applied.
This endpoint takes no parameters.
Request Body
Section titled “Request Body”| Name | Type | Required | Description |
|---|---|---|---|
code | string | Yes | JavaScript source code to check |
Response
Section titled “Response”{ "valid": true, "message": "JavaScript syntax is valid", "codeLength": 87, "normalized": false, "transformations": []}{ "error": "VALIDATION_ERROR", "code": "VALIDATION_ERROR", "timestamp": "2026-01-15T12:00:00.000Z", "details": { "field": "code", "reason": "code is required" }}| Error Code | Title | Description | Resolution |
|---|---|---|---|
VALIDATION_ERROR | Invalid input | Request parameters failed validation | Check parameter format and requirements |
{ "error": "Internal server error", "code": "ERROR_500", "timestamp": "2026-01-15T12:00:00.000Z"}SDK Usage
Section titled “SDK Usage”const result = await client.exec.validate.validateSyntax({ code: "function add(a, b) { return a + b; }"});Validate Type Script
Section titled “Validate Type Script”POST /api/v1/exec/validate/typescript
Section titled “POST /api/v1/exec/validate/typescript”Transpile TypeScript to JavaScript and return the transpiled output alongside original and transpiled lengths.
This endpoint takes no parameters.
Request Body
Section titled “Request Body”| Name | Type | Required | Description |
|---|---|---|---|
code | string | Yes | TypeScript source code to validate |
Response
Section titled “Response”{ "valid": true, "javascript": "export default function greet(name) { return \"Hello, \" + name; }", "originalLength": 64, "transpiledLength": 72, "normalized": false, "transformations": [], "message": "TypeScript validation successful"}{ "error": "VALIDATION_ERROR", "code": "VALIDATION_ERROR", "timestamp": "2026-01-15T12:00:00.000Z", "details": { "field": "code", "reason": "code is required" }}| Error Code | Title | Description | Resolution |
|---|---|---|---|
VALIDATION_ERROR | Invalid input | Request parameters failed validation | Check parameter format and requirements |
{ "error": "Internal server error", "code": "ERROR_500", "timestamp": "2026-01-15T12:00:00.000Z"}SDK Usage
Section titled “SDK Usage”const result = await client.exec.validate.validateTypeScript({ code: "function greet(name: string): string { return `Hello, ${name}`; }"});Validate Dependencies
Section titled “Validate Dependencies”POST /api/v1/exec/validate/dependencies
Section titled “POST /api/v1/exec/validate/dependencies”Detect import and require statements in the provided source, compare them against installed modules, and produce an install command for any missing packages.
This endpoint takes no parameters.
Request Body
Section titled “Request Body”| Name | Type | Required | Description |
|---|---|---|---|
code | string | Yes | Source code whose imports will be checked |
Response
Section titled “Response”{ "totalModules": 4, "allInstalled": false, "missingCount": 2, "missingModules": ["lodash", "dayjs"], "dependencies": [ { "name": "lodash", "declared": true, "installed": false }, { "name": "dayjs", "declared": true, "installed": false }, { "name": "fs", "declared": true, "installed": true }, { "name": "path", "declared": true, "installed": true } ], "message": "2 of 4 modules are missing", "installCommand": "npm install lodash dayjs"}{ "error": "VALIDATION_ERROR", "code": "VALIDATION_ERROR", "timestamp": "2026-01-15T12:00:00.000Z", "details": { "field": "code", "reason": "code is required" }}| Error Code | Title | Description | Resolution |
|---|---|---|---|
VALIDATION_ERROR | Invalid input | Request parameters failed validation | Check parameter format and requirements |
{ "error": "Internal server error", "code": "ERROR_500", "timestamp": "2026-01-15T12:00:00.000Z"}SDK Usage
Section titled “SDK Usage”const result = await client.exec.validate.validateDependencies({ code: "import _ from 'lodash'; import dayjs from 'dayjs'; import fs from 'fs';"});Validate Magic Comments
Section titled “Validate Magic Comments”POST /api/v1/exec/validate/magic-comments
Section titled “POST /api/v1/exec/validate/magic-comments”Parse magic comments and the declared return type embedded in the source. Magic comments are short directives prefixed with /* hoody */ style markers that configure execution behavior.
This endpoint takes no parameters.
Request Body
Section titled “Request Body”| Name | Type | Required | Description |
|---|---|---|---|
code | string | Yes | Source code containing magic comments |
Response
Section titled “Response”{ "magicComments": { "returns": "{ status: number, body: string }", "timeout": 30000 }, "returnType": { "definition": "{ status: number, body: string }", "mode": "inline", "location": "line:1 col:18" }, "message": "Magic comments parsed successfully"}{ "error": "VALIDATION_ERROR", "code": "VALIDATION_ERROR", "timestamp": "2026-01-15T12:00:00.000Z", "details": { "field": "code", "reason": "code is required" }}| Error Code | Title | Description | Resolution |
|---|---|---|---|
VALIDATION_ERROR | Invalid input | Request parameters failed validation | Check parameter format and requirements |
{ "error": "Internal server error", "code": "ERROR_500", "timestamp": "2026-01-15T12:00:00.000Z"}SDK Usage
Section titled “SDK Usage”const result = await client.exec.validate.validateMagicComments({ code: "/* hoody returns { status: number, body: string} */ export default async function() { return { status: 200, body: 'ok' }; }"});Validate Return Type
Section titled “Validate Return Type”POST /api/v1/exec/validate/return-type
Section titled “POST /api/v1/exec/validate/return-type”Validate an arbitrary JSON value against a TypeScript-style typeDefinition. Use this to confirm that a script’s return value conforms to the contract declared in its magic comments.
This endpoint takes no parameters.
Request Body
Section titled “Request Body”| Name | Type | Required | Description |
|---|---|---|---|
typeDefinition | string | Yes | TypeScript-style type definition (e.g. { status: number, body: string }) |
value | any | Yes | Arbitrary JSON value to validate against the declared return type |
Response
Section titled “Response”{ "valid": true, "errors": [], "typeDefinition": "{ status: number, body: string }", "parsedType": { "kind": "object", "properties": { "status": { "kind": "primitive", "type": "number" }, "body": { "kind": "primitive", "type": "string" } } }, "message": "Value matches type definition"}{ "error": "VALIDATION_ERROR", "code": "VALIDATION_ERROR", "timestamp": "2026-01-15T12:00:00.000Z", "details": { "field": "value", "reason": "value is required" }}| Error Code | Title | Description | Resolution |
|---|---|---|---|
VALIDATION_ERROR | Invalid input | Request parameters failed validation | Check parameter format and requirements |
{ "error": "Internal server error", "code": "ERROR_500", "timestamp": "2026-01-15T12:00:00.000Z"}SDK Usage
Section titled “SDK Usage”const result = await client.exec.validate.validateReturnType({ typeDefinition: "{ status: number, body: string }", value: { status: 200, body: "ok" }});