Format Guide · DWG to JSON API

Parse AutoCAD DWG files into structured vector JSON.

The CADLens REST API accepts DWG files (AutoCAD R14 through 2025) and returns a complete, machine-readable description of the drawing: entity geometry, layer metadata, drawing extents, and a PNG preview. No AutoCAD license, no ODA setup, no conversion pipeline to maintain.

Join the beta · Free 50/mo →Read the docs
01THE PROBLEM

DWG is proprietary — parsing it is hard.

DWG is AutoCAD's native binary format and has never been publicly documented by Autodesk. Every version of the format — R14, 2000, 2004, 2007, 2010, 2013, 2018, 2021, 2024, 2025 — uses a different binary structure. Building reliable DWG parsing means either licensing a commercial SDK or maintaining a reverse-engineered reader against a moving target.

CADLens handles this for you. Submit a DWG file; receive clean JSON. The conversion and parsing infrastructure runs on our end.

02WHEN TO USE IT

Designed for software that needs CAD data.

Common use cases for DWG parsing via the API:

  • Quoting and estimating tools — extract geometry to calculate material lengths, areas, or cut counts automatically from customer-uploaded drawings.
  • CNC and laser cutting software — read polylines and arcs as toolpaths without requiring the operator to export to another format first.
  • Construction tech — parse floor plans to extract room boundaries, dimensions, and layer-based object counts.
  • Document automation — index drawing metadata (units, extents, layer names) into a database without opening a CAD application.
  • Preview generation — render a PNG thumbnail of any DWG file uploaded by your users, at scale.
03API WORKFLOW

Three endpoints, one complete result.

Authentication is an API key in the Authorization: Bearer header. The base URL is https://api.cadlens.co/v1.

Step 1 — Upload the DWG file:

POST /v1/parse
Content-Type: multipart/form-data
Authorization: Bearer <api_key>

file=<your-drawing.dwg>

// Response
{ "jobId": "job_01hw..." }

Add wait=true as a query parameter for files under roughly 2 MB to receive the full result in the same response. For larger files, the job is queued and typically completes within 30 seconds on standard plans.

Step 2 — Poll for completion (or use a webhook):

GET /v1/jobs/job_01hw...
Authorization: Bearer <api_key>

// Response
{
  "jobId": "job_01hw...",
  "status": "COMPLETED",   // PENDING | PROCESSING | COMPLETED | FAILED
  "fileName": "floor-plan.dwg",
  "fileSize": 284521,
  "createdAt": "2024-10-14T09:12:00Z",
  "completedAt": "2024-10-14T09:12:08Z"
}

Pass webhook_url in the initial upload to receive a POST callback when the job completes — no polling required.

Step 3 — Fetch the result:

GET /v1/jobs/job_01hw.../result
Authorization: Bearer <api_key>
04EXAMPLE OUTPUT

What a DWG parse returns.

The result schema is versioned at 2024-01. Every field below is present for a successful DWG parse:

{
  "jobId": "job_01hw...",
  "status": "COMPLETED",
  "metadata": {
    "units": "mm",
    "boundingBox": { "width": 4200, "height": 2970 }
  },
  "layersJson": [
    { "name": "WALLS",      "colorHex": "#ffffff", "entityCount": 142 },
    { "name": "DIMENSIONS", "colorHex": "#00ff00", "entityCount": 38  },
    { "name": "TEXT",       "colorHex": "#ff0000", "entityCount": 21  }
  ],
  "vectorJson": [
    {
      "type": "POLYLINE",
      "layer": "WALLS",
      "closed": true,
      "vertices": [
        { "x": 0,    "y": 0    },
        { "x": 4200, "y": 0    },
        { "x": 4200, "y": 2970 },
        { "x": 0,    "y": 2970 }
      ]
    }
  ],
  "imageUrl": "https://cdn.cadlens.co/results/job_01hw.../preview.png?..."
}
05LIMITATIONS

Fair-use and known constraints.

DWG is the most complex format CADLens supports. A few constraints apply:

  • File size: approximately 10 MB per file on standard plans.
  • Entity count: up to approximately 50,000 entities per drawing.
  • Processing time: up to 30 seconds on standard plans; typically faster.
  • 3D geometry: CADLens extracts 2D projections of 3D entities; full 3D mesh extraction is not currently supported.
  • External references (Xrefs): referenced drawings are not resolved. Only geometry embedded in the submitted file is parsed.
  • Password-protected DWG: not supported. The file must be unlocked before submission.
06 — FAQ

Common questions.

CADLens supports DWG files from AutoCAD R14 through AutoCAD 2025. Files saved in any of these versions can be submitted to POST /v1/parse without pre-conversion.

DWG is a proprietary binary format. CADLens uses a licensed conversion path (ODA File Converter) to translate DWG to an intermediate format before extracting vector data. The conversion happens transparently on our infrastructure — you just upload the file.

Yes. Every successful parse produces a vectorJson result at /v1/jobs/:job_id/result and a signed PNG URL at /v1/jobs/:job_id/image. There is no extra flag or separate call required.

CADLens extracts polylines, lines, arcs, circles, splines, text, hatches, and block inserts. Each entity carries its layer name, geometry coordinates, and optional color. The full list is in the API schema documentation.

No. Only successful parses count toward your monthly quota. A job that ends in FAILED status is never billed.

The practical limit is approximately 10 MB per file. Files with up to ~50,000 entities are supported on standard plans. Larger files may require an Enterprise plan with dedicated processing capacity.

JOIN THE BETA

Get an API key. Parse your first drawing today.

Free tier includes 50 parse requests per month. No credit card required.

Join the beta · Free 50/mo Read the docs
— RELATED

Keep reading.