POST /API/V1/CAD/EXTRACT

CAD and drawing extraction

Turn native CAD files and 2D drawings into structured, agent-readable JSON. Upload STEP, IGES, DXF, PDF, or SVG and receive four-cad.extraction.v1: solids with topology and mass properties, drawing entities, measured dimensions, annotations, and an optional Rowe-ready point_cloud_scene.

POST /api/v1/cad/extract

Authenticate with your API key, upload a file up to 25 MB, and pick a target_contract: structured (default) for the agent-readable extraction, point_cloud_scene for Rowe-ready geometry, or both. The endpoint accepts multipart uploads and JSON with base64 content.

POST → https://fourechelon.com/api/v1/cad/extract
Terminal
curl https://fourechelon.com/api/v1/cad/extract \
  -H "Authorization: Bearer $FOUR_ECHELON_API_KEY" \
  -F "file=@bracket.step" \
  -F "target_contract=both"

The same request as JSON with base64-encoded content:

Terminal
curl https://fourechelon.com/api/v1/cad/extract \
  -H "Authorization: Bearer $FOUR_ECHELON_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"file_name\": \"drawing.dxf\",
    \"target_contract\": \"structured\",
    \"content_base64\": \"$(base64 -i drawing.dxf | tr -d '\n')\"
  }"

Response schema

Successful extractions return four-cad.extraction.v1. 3D sources fill structure.solids with topology and mass properties; 2D drawings fill structure.entities and structure.dimensions. Sections that do not apply to the source are omitted.

schemastring

Always four-cad.extraction.v1 for successful extractions.

source_formatstring

Detected input format (step, stp, iges, igs, dxf, pdf, svg).

unitsstring

Length unit of the extraction, for example millimeter.

structure.kindstring

brep for 3D solids, drawing2d for DXF/PDF/SVG drawings.

structure.assembly / structure.solidsarray

3D topology: per-solid bbox, volume, surface_area, center_of_mass, face/edge/vertex counts, typed faces (plane, cylinder, ...), and edge_types.

structure.layers / structure.entitiesarray

2D drawing content: layers plus typed entities (line, circle, arc, polyline, text, ...) with geometry, layer, and text.

structure.dimensionsarray

Measured drawing dimensions: dim_type, numeric measurement, display text, and definition points.

structure.annotations / structure.blocks / structure.pagesarray

Notes, reusable block definitions, and page structure when the source has them.

point_cloud_sceneobject

Rowe-ready point_clouds[] sampled from the geometry. Present when target_contract is point_cloud_scene or both.

statisticsobject

Converter statistics about the parsed file.

warningsarray

Non-fatal parse warnings. Sections that do not apply to the source format are omitted.

usageobject

Metered spatial tokens: input from uploaded bytes, output from the extraction JSON.

request_idstring

Request id for support and debugging.

Terminal
{
  "schema": "four-cad.extraction.v1",
  "source_format": "dxf",
  "units": "millimeter",
  "structure": {
    "kind": "drawing2d",
    "layers": ["0", "DIMENSIONS"],
    "entities": [
      {
        "id": "e1",
        "type": "line",
        "layer": "0",
        "geometry": { "start": [0, 0], "end": [120, 0] }
      },
      {
        "id": "e2",
        "type": "circle",
        "layer": "0",
        "geometry": { "center": [60, 40], "radius": 8 }
      }
    ],
    "dimensions": [
      {
        "id": "d1",
        "dim_type": "linear",
        "measurement": 120.0,
        "text": "120",
        "defpoints": [[0, 0], [120, 0]]
      }
    ],
    "annotations": [],
    "blocks": []
  },
  "point_cloud_scene": {
    "point_clouds": [
      {
        "object_id": "drawing",
        "kind": "surface",
        "points": [{ "x": 0, "y": 0, "z": 0 }]
      }
    ]
  },
  "statistics": { "entity_count": 2, "dimension_count": 1 },
  "warnings": [],
  "file_name": "drawing.dxf",
  "target_contract": "both",
  "usage": {
    "input_tokens": 20890,
    "output_tokens": 512,
    "estimated_input_cost_usd": 0.02089,
    "estimated_output_cost_usd": 0.002048,
    "estimated_cost_usd": 0.022938
  },
  "request_id": "req_..."
}

Supported formats

step / stp3D CAD

ISO 10303 STEP solids and assemblies. Preferred 3D input.

iges / igs3D CAD

IGES solids and surfaces.

dxf2D drawing

AutoCAD DXF: layers, entities, dimensions, blocks, annotations.

pdf2D drawing

Vector PDF drawings parsed into pages and entities.

svg2D drawing

SVG vector drawings parsed into entities.

sldprt / sldasmrejected (415)

SolidWorks native files are not parsed. Export as STEP and upload the .step file.

Errors and pricing

Extraction is metered like every Rowe request: uploaded bytes count as input spatial tokens and the extraction JSON counts as output spatial tokens at the standard token rates. Only 2xx extractions are billed; converter and validation failures are recorded but never charged.

400invalid_request_error

Missing file/file_name, invalid base64 content, or invalid target_contract.

401authentication_error

Missing, revoked, or invalid API key.

402payment_required

An active or trialing paid API subscription is required.

413request_too_large

The uploaded file exceeds the 25 MB limit.

415unsupported_file_type

Format outside STEP/STP/IGES/IGS/DXF/PDF/SVG, including SolidWorks files (export STEP).

422converter error (passed through)

The converter parsed the request but could not extract the file; its error body is returned unchanged.

502/503converter_unavailable

No converter is configured or the converter cannot be reached. Non-2xx responses are never billed.