---
id: T05
parent: S01
milestone: M001
provides: []
requires: []
affects: []
key_files: ["engine/api/routes.py", "engine/tests/test_api.py", "engine/main.py"]
key_decisions: ["SVG metadata via regex - lightweight, no XML parser needed", "Vectorize params filtered by known param names per mode"]
patterns_established: []
drill_down_paths: []
observability_surfaces: []
duration: ""
verification_result: "cd engine && .venv/bin/python -m pytest tests/test_api.py -v (14 passed), full suite 76 passed"
completed_at: 2026-03-26T04:21:26.227Z
blocker_discovered: false
---

# T05: Wired POST /engine/trace endpoint with preprocess + vectorize pipeline, SVG metadata, and 14 integration tests

> Wired POST /engine/trace endpoint with preprocess + vectorize pipeline, SVG metadata, and 14 integration tests

## What Happened
---
id: T05
parent: S01
milestone: M001
key_files:
  - engine/api/routes.py
  - engine/tests/test_api.py
  - engine/main.py
key_decisions:
  - SVG metadata via regex - lightweight, no XML parser needed
  - Vectorize params filtered by known param names per mode
duration: ""
verification_result: passed
completed_at: 2026-03-26T04:21:26.233Z
blocker_discovered: false
---

# T05: Wired POST /engine/trace endpoint with preprocess + vectorize pipeline, SVG metadata, and 14 integration tests

**Wired POST /engine/trace endpoint with preprocess + vectorize pipeline, SVG metadata, and 14 integration tests**

## What Happened

Created engine/api/routes.py with POST /engine/trace endpoint accepting multipart form-data (file, mode, output_format, preset, params). Wires full pipeline: decode → preprocess → vectorize (potrace or vtracer) → extract SVG metadata → return JSON. Updated main.py to include the router. Created 14 integration tests covering both modes, metadata shape, custom params, and validation errors.

## Verification

cd engine && .venv/bin/python -m pytest tests/test_api.py -v (14 passed), full suite 76 passed

## Verification Evidence

| # | Command | Exit Code | Verdict | Duration |
|---|---------|-----------|---------|----------|
| 1 | `cd engine && .venv/bin/python -m pytest tests/test_api.py -v` | 0 | ✅ pass | 430ms |
| 2 | `cd engine && .venv/bin/python -m pytest tests/ -v` | 0 | ✅ pass | 470ms |


## Deviations

None.

## Known Issues

None.

## Files Created/Modified

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


## Deviations
None.
