---
estimated_steps: 7
estimated_files: 4
skills_used: []
---

# T05: Wire up /engine/trace endpoint

1. Create engine/api/routes.py with trace endpoint
2. POST /engine/trace accepts multipart/form-data:
   - file (image), mode (potrace|vtracer), output_format (svg only for now), preset (ignored for now), params (JSON override)
3. Wire pipeline: receive file → preprocess → vectorize (mode-dependent) → return SVG + metadata
4. Response shape: {output: '<svg>...', format: 'svg', metadata: {path_count, node_count_total, open_paths, warnings, processing_ms}}
5. Add basic metadata extraction from SVG output
6. Integration test: upload PNG → get SVG back

## Inputs

- `engine/pipeline/preprocessing.py`
- `engine/pipeline/vectorize.py`

## Expected Output

- `engine/api/routes.py`
- `engine/tests/test_api.py`

## Verification

cd engine && python -m pytest tests/test_api.py -v
