Skip to content

API Reference

Complete API documentation for the Wireweave API Server.

Base URL

https://api.wireweave.org

Authentication

All /tools/* endpoints require authentication. Provide your API key via:

bash
curl -H "x-api-key: your-api-key" https://api.wireweave.org/tools/parse

Authorization Header

bash
curl -H "Authorization: Bearer your-api-key" https://api.wireweave.org/tools/parse

Query Parameter

bash
curl "https://api.wireweave.org/tools/parse?api_key=your-api-key"

Rate Limits

TierPer MinutePer DayMonthly Quota
Free101001,000
Basic3050010,000
Pro602,00050,000
Enterprise12010,000Unlimited

Rate Limit Headers

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Reset: 1699999999

Endpoints


GET /health

Health check endpoint (no authentication required).

Response:

json
{
  "status": "ok",
  "version": "1.0.0"
}

POST /tools/parse

Parse Wireweave DSL source code into an AST.

Request:

bash
curl -X POST https://api.wireweave.org/tools/parse \
  -H "Content-Type: application/json" \
  -H "x-api-key: your-api-key" \
  -d '{"source": "page { button \"Click\" primary }"}'

Request Body:

FieldTypeRequiredDescription
sourcestringYesWireweave DSL source code

Response:

json
{
  "ast": {
    "type": "Document",
    "children": [
      {
        "type": "Page",
        "children": [
          {
            "type": "Button",
            "label": "Click",
            "modifiers": ["primary"]
          }
        ]
      }
    ]
  }
}

POST /tools/validate

Validate Wireweave DSL syntax.

Request:

bash
curl -X POST https://api.wireweave.org/tools/validate \
  -H "Content-Type: application/json" \
  -H "x-api-key: your-api-key" \
  -d '{"source": "page { button \"Click\" }"}'

Request Body:

FieldTypeRequiredDescription
sourcestringYesWireweave DSL source code

Success Response:

json
{
  "valid": true
}

Error Response:

json
{
  "valid": false,
  "errors": [
    {
      "message": "Unexpected token",
      "line": 1,
      "column": 10
    }
  ]
}

POST /tools/render/html

Render Wireweave DSL to HTML.

Request:

bash
curl -X POST https://api.wireweave.org/tools/render/html \
  -H "Content-Type: application/json" \
  -H "x-api-key: your-api-key" \
  -d '{
    "source": "page { card { heading \"Hello\" } }",
    "theme": "light",
    "fullDocument": false
  }'

Request Body:

FieldTypeRequiredDefaultDescription
sourcestringYes-Wireweave DSL source
themestringNo"light""light" or "dark"
fullDocumentbooleanNofalseReturn complete HTML document

Response:

json
{
  "html": "<div class=\"page\">...</div>",
  "css": ".page { ... }"
}

When fullDocument: true:

json
{
  "html": "<!DOCTYPE html><html>...</html>"
}

POST /tools/render/svg

Render Wireweave DSL to SVG.

Request:

bash
curl -X POST https://api.wireweave.org/tools/render/svg \
  -H "Content-Type: application/json" \
  -H "x-api-key: your-api-key" \
  -d '{
    "source": "page { button \"Click\" primary }",
    "width": 800,
    "padding": 24,
    "theme": "light"
  }'

Request Body:

FieldTypeRequiredDefaultDescription
sourcestringYes-Wireweave DSL source
widthnumberNo1200SVG width in pixels
paddingnumberNo24Padding around content
themestringNo"light""light" or "dark"

Response:

json
{
  "svg": "<svg xmlns=\"http://www.w3.org/2000/svg\">...</svg>",
  "width": 800,
  "height": 600
}

GET /tools/grammar

Get DSL grammar documentation.

Request:

bash
curl https://api.wireweave.org/tools/grammar \
  -H "x-api-key: your-api-key"

Response:

json
{
  "grammar": "...",
  "version": "1.0.0",
  "components": ["page", "card", "button", ...],
  "modifiers": ["primary", "secondary", ...]
}

Error Responses

400 Bad Request

json
{
  "error": "Invalid source code",
  "details": "Syntax error at line 1, column 5"
}

401 Unauthorized

json
{
  "error": "API key required"
}

403 Forbidden

json
{
  "error": "Invalid API key"
}

429 Too Many Requests

json
{
  "error": "Rate limit exceeded",
  "retryAfter": 60
}

500 Internal Server Error

json
{
  "error": "Internal server error"
}

SDKs

JavaScript/TypeScript

typescript
import { WireweaveClient } from '@wireweave/client';

const client = new WireweaveClient({
  apiKey: 'your-api-key',
});

const result = await client.renderHtml({
  source: 'page { button "Click" primary }',
  theme: 'light',
});

console.log(result.html);

Python

python
from wireweave import WireweaveClient

client = WireweaveClient(api_key="your-api-key")

result = client.render_html(
    source='page { button "Click" primary }',
    theme="light"
)

print(result.html)

Webhooks

Configure webhooks in the Dashboard to receive notifications:

  • usage.quota_warning - 80% of quota used
  • usage.quota_exceeded - Quota exceeded
  • api_key.rotated - API key rotated

Next Steps

Released under the MIT License.