/api/svg-to-png
Server rasterization for SVG → PNG (used when the browser tool or integrations need a validated conversion path). The public SVG Converter page at /svg-converter is primarily client-side; this route is the HTTP API.
POST — convert
- Content-Type:
application/jsonrequired; else400INVALID_CONTENT_TYPE. - Body (single):
{ svgContent, options?, filename?, format?: 'json' | 'binary' } - Body (batch):
{ conversions: [...] }whenconversionskey present →handleBatchConversion. - Uses
createSvgToPngConverterfrom@lib/services/svg-conversionwithenableSecurityValidation: true, logging enabled.
GET — health
Returns service metadata: singleConversion, batchConversion, maxBatchSize: 10, maxSvgSize: '10MB', securityValidation: true, plus converter.getStatus().
Errors
JSON parse failures → INVALID_JSON 400. Missing svgContent → MISSING_SVG_CONTENT 400.
Sources: src/app/api/svg-to-png/route.ts, @lib/services/svg-conversion