WitGen.dev API Documentation

APIs for WebAssembly Interface Type (WIT) Development

WIT Validate API

The WIT Validate API provides tools to validate WebAssembly Interface Type (WIT) files for syntax, structure, and best practices.

Documentation

Endpoints

GET

/api/health

Health check endpoint to verify API status.

Example
curl -X GET https://witgen.dev/api/health
POST

/api/validate

Validates WIT content provided in JSON format.

Example
curl -X POST https://witgen.dev/api/validate \
  -H "Content-Type: application/json" \
  -H "WITGEN_API_KEY: test-api-key" \
  -d '{"content": "package example:math; interface calculator { add: func(a: u32, b: u32) -> u32; }"}'
POST

/api/validate-file

Validates a WIT file uploaded as form data.

Example
curl -X POST https://witgen.dev/api/validate-file \
  -H "WITGEN_API_KEY: test-api-key" \
  -F "file=@path/to/your.wit"

Rust Client

For a more convenient integration, use our Rust client:

git clone https://github.com/username/wit-validator-api
cd wit-validator-api/test_client
cargo run -- --url https://witgen.dev --file path/to/your.wit

Response Format

{
  "valid": true,
  "errors": [],
  "warnings": [
    "No world declaration found",
    "Some statements may be missing semicolons"
  ]
}

Wrangler.toml Validator API

The Wrangler.toml Validator API provides tools to validate Cloudflare Workers configuration files for syntax, structure, and best practices.

Documentation

  • API Documentation View

Endpoints

GET

/api/wrangler/health

Health check endpoint to verify API status.

Example
curl -X GET https://witgen.dev/api/wrangler/health
POST

/api/wrangler/validate

Validates wrangler.toml content provided in JSON format.

Example
curl -X POST https://witgen.dev/api/wrangler/validate \
  -H "Content-Type: application/json" \
  -H "WITGEN_API_KEY: test-api-key" \
  -d '{"content": "name = \"my-worker\"\nmain = \"build/worker/shim.mjs\"\ncompatibility_date = \"2025-03-31\""}'
POST

/api/wrangler/validate-file

Validates a wrangler.toml file uploaded as form data.

Example
curl -X POST https://witgen.dev/api/wrangler/validate-file \
  -H "WITGEN_API_KEY: test-api-key" \
  -F "file=@path/to/your/wrangler.toml"

Response Format

{
  "valid": true,
  "errors": [],
  "warnings": [
    "Missing 'build' section with 'command' field",
    "Missing [[rules]] section for WebAssembly handling",
    "No 'routes' or 'triggers' defined for this worker"
  ]
}

More APIs Coming Soon

We're actively developing additional APIs for the WebAssembly component model ecosystem. Check back soon for updates!