SVG layout check: clipping, overlaps and empty shapes from supplied geometry

$0.005 USDC per call · Developer and security · POST /api/v1/svg-geometry · Id svg-geometry

Checks up to 200 SVG shapes you describe (rect, circle, ellipse, line, polygon, polyline, text, or a path's bounding box) against the viewBox and viewport the way an SVG renderer would: finds shapes clipped or entirely outside the drawn region, shapes that render nothing (zero or negative size, unstroked line), partial overlaps between shapes, and a zero, negative or malformed viewBox, for agents that generate diagrams, charts or icons. It does not parse SVG markup or path data, apply transforms, CSS or clip-paths, or render anything; text boxes are ESTIMATES from the character count and font size (no font metrics), and any finding that depends on an estimate or on bounding boxes of round or polygonal shapes yields `unknown`, not `fail`.

What you get

Labels that spill off the canvas and overlapping shapes are the usual flaws in generated diagrams; the coordinates of each violation come back without rendering.

Call it

Send the JSON body below to https://agents.writerslogic.com/api/v1/svg-geometry. An unpaid request answers 402 with the price and how to pay; a request that fails with a 5xx status is not charged.

curl -i -X POST https://agents.writerslogic.com/api/v1/svg-geometry \
  -H 'content-type: application/json' \
  -d '{"viewBox":"0 0 200 100","shapes":[{"id":"card","type":"rect","x":10,"y":10,"width":120,"height":60},{"id":"badge","type":"circle","cx":120,"cy":40,"r":25},{"id":"title","type":"text","x":150,"y":90,"text":"Quarterly revenue","fontSize":14}]}'

Input

FieldTypeRequiredDescription
viewBoxstring; length 0..120noThe viewBox attribute value, e.g. "0 0 800 600".
widthnumber; 0.001..10000000noViewport width in px (the svg width attribute).
heightnumber; 0.001..10000000noViewport height in px.
preserveAspectRatiostring; length 0..40noDefault xMidYMid meet.
shapesarray<object>; max 200 itemsyesShapes in user coordinates (no transform). rect: x,y,width,height. circle: cx,cy,r. ellipse: cx,cy,rx,ry. line: x1,y1,x2,y2,strokeWidth. polygon/polyline: points. text: x,y,text,fontSize,textAnchor. bbox: bbox [minX,minY,maxX,maxY] for a path you measured yourself.
checksarray<string; one of "clip", "empty", "overlap">; max 3 itemsnoSubset of clip, empty, overlap; default all. Overlap reports partial overlaps only; a shape fully inside another (a label on a card) is listed as nested and never fails.

Example request body

{
  "viewBox": "0 0 200 100",
  "shapes": [
    {
      "id": "card",
      "type": "rect",
      "x": 10,
      "y": 10,
      "width": 120,
      "height": 60
    },
    {
      "id": "badge",
      "type": "circle",
      "cx": 120,
      "cy": 40,
      "r": 25
    },
    {
      "id": "title",
      "type": "text",
      "x": 150,
      "y": 90,
      "text": "Quarterly revenue",
      "fontSize": 14
    }
  ]
}

Result

The response is { "data": ..., "_provenance": ... }. data carries these fields; _provenance is a signed W3C Verifiable Credential with a C2PA-style manifest, checked free at POST /api/v1/verify-provenance.

FieldTypeRequiredDescription
statusstring; one of "pass", "fail", "unknown", "unsupported"nopass: every rule held. fail: a rule was violated (see witnesses). unknown: the input lacks the evidence to decide. unsupported: outside what this engine covers. Missing evidence is never a pass.
visibleRegionarray<number>no[minX, minY, maxX, maxY] in user units that the viewport displays; empty when it cannot be determined.
visibleNotestringno
shapesarray<object>no
pairsarray<object>no
witnessesarray<object>no
versionsobjectnoEvery semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile).
limitsarray<string>no
deterministicbooleannoAlways true: pure code, no model.

Pay and connect

Available through: x402 (USDC on Base), MCP. MCP clients reach it through the infra-preflight-kit package.

Machine-readable