API reference
Analysis lives behind a single endpoint. You can call it directly to integrate Weftmap into your own tooling.
POST /api/analyze
Send code and receive a { nodes, edges } graph. Accepts a snippet or multiple files.
Request โ snippet
POST /api/analyze
Content-Type: application/json
{
"language": "python",
"code": "def main():\n helper()\n\ndef helper():\n pass"
}Request โ project (multiple files)
{
"language": "python",
"files": [
{ "path": "main.py", "content": "from util import work\n..." },
{ "path": "util.py", "content": "def work(): ..." }
]
}Response 200
{
"nodes": [
{ "id": "main.py::main", "label": "main", "type": "function", "parent": "mod::main.py" }
],
"edges": [
{ "source": "main.py::main", "target": "util.py::work", "kind": "calls" }
]
}Fields
languageโ one of the supported languages (python,javascript,typescript,go,rust,sql).codeโ the snippet to analyze (snippet mode).filesโ an array of{ path, content }(project mode). When present, it takes precedence overcode.
Limits
- Up to 2 MB of total content per request.
- Up to 400 files in project mode.
Errors
400โ invalid JSON or unsupported language.413โ size or file-count limit exceeded.
Code is sent to the server to be parsed with Tree-sitter and discarded after the response. Nothing is stored.