Skip to content

API 레퍼런스

Wireweave API 서버의 완전한 API 문서입니다.

기본 URL

https://api.wireweave.dev

인증

모든 /tools/* 엔드포인트는 인증이 필요합니다. API 키를 다음 방법으로 제공합니다:

헤더 (권장)

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

Authorization 헤더

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

쿼리 파라미터

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

요청 제한

등급분당일일월간 할당량
Free101001,000
Basic3050010,000
Pro602,00050,000
Enterprise12010,000무제한

요청 제한 헤더

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

엔드포인트


GET /health

헬스 체크 엔드포인트 (인증 불필요).

응답:

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

POST /tools/parse

Wireweave DSL 소스 코드를 AST로 파싱합니다.

요청:

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

요청 본문:

필드타입필수설명
sourcestringWireweave DSL 소스 코드

응답:

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

POST /tools/validate

Wireweave DSL 문법을 검증합니다.

요청:

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

요청 본문:

필드타입필수설명
sourcestringWireweave DSL 소스 코드

성공 응답:

json
{
  "valid": true
}

오류 응답:

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

POST /tools/render/html

Wireweave DSL을 HTML로 렌더링합니다.

요청:

bash
curl -X POST https://api.wireweave.dev/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
  }'

요청 본문:

필드타입필수기본값설명
sourcestring-Wireweave DSL 소스
themestring아니오"light""light" 또는 "dark"
fullDocumentboolean아니오false완전한 HTML 문서 반환

응답:

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

fullDocument: true 인 경우:

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

POST /tools/render/svg

Wireweave DSL을 SVG로 렌더링합니다.

요청:

bash
curl -X POST https://api.wireweave.dev/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"
  }'

요청 본문:

필드타입필수기본값설명
sourcestring-Wireweave DSL 소스
widthnumber아니오1200SVG 너비 (픽셀)
paddingnumber아니오24콘텐츠 주위 패딩
themestring아니오"light""light" 또는 "dark"

응답:

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

GET /tools/grammar

DSL 문법 문서를 가져옵니다.

요청:

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

응답:

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

오류 응답

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"
}

SDK

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)

웹훅

Dashboard에서 웹훅을 설정하여 알림을 받을 수 있습니다:

  • usage.quota_warning - 할당량 80% 사용
  • usage.quota_exceeded - 할당량 초과
  • api_key.rotated - API 키 갱신됨

다음 단계

Released under the MIT License.