WASM Validator

Validator API Reference

Official HTTP, CLI, and Node.js API documentation for the WebAssembly Validator Toolchain. Integrate validation, verification, and analysis capabilities into your tools and applications.

📚 Overview

The Validator API provides programmatic access to the full WebAssembly validation suite's capabilities. You can validate, optimize, and audit WebAssembly modules through HTTP endpoints, command-line interface (CLI), or direct Node.js integration. This API reference documents all available endpoints, methods, and usage patterns.

REST HTTP

Validate modules via HTTP endpoints for web or API integrations

CLI

Command-line interface for local validation, automation, and scripting

Node.js API

Direct JavaScript/TypeScript integration in tools and applications

🚀 Getting Started

Install CLI

wget /wasm-validator-toolchain.download.html/cli-validator.zip -O validator.zip
unzip validator.zip
./validator help
                    

Run Web Validator

unzip /wasm-validator-toolchain.download.html/web-validator.zip
cd validator-web
npm install
npm start
                    

Next Steps

Validate WebAssembly files with:

  • â–¶ validator validate myfile.wasm
  • â–¶ validator wasi mymodule.wats
  • â–¶ validator report --output /path/to/report.json

📎 HTTP API Endpoints

Access the HTTP API by running the web validator server locally. All endpoints accept WAT or binary module files and return structured JSON validation responses.

POST /validate

Validate a WebAssembly module file.

Parameters

  • file: WASM/WAT file contents (multipart/form-data)
  • report: Optional JSON report generation format (true/false)

Example Request

curl -X POST http://localhost:8080/validate \
     -F "file=@myfile.wasm" \
     -F "report=true"
                

Response

{
  "valid": true,
  "format": "binary",
  "size": 3072,
  "issues": [],
  "report": {
    "memory": {
      "min_pages": 256,
      "max_pages": 65535
    }
  }
}
                

GET /health

Check the status of the validator server and runtime version.

Response

{
  "status": "healthy",
  "version": "v2.5.1",
  "build_date": "2025-03-15T14:30:00Z"
}
                

🔧 Advanced Integration

Embed the validator core into your toolchains using Node.js or CLI automation.

Node.js Integration

const validator = require('wasm-validator');
const fs = require('fs');

validator.validateFileSync('module.wasm');
console.log(validator.getReport());
                    

Custom Validation Rules

{
  "max_instructions": 5e6,
  "required_exports": ["_start"],
  "forbidden_imports": ["env.abort"]
}