{
  "info": {
    "name": "CADLens API",
    "description": "Official Postman collection for the CADLens REST API.\n\nUpload CAD files (DWG, DXF, DWF) and get back structured vector JSON + PNG previews.\n\n**Setup:**\n1. Set `{{baseUrl}}` to `https://api.cadlens.co` (or your local dev URL).\n2. Set `{{apiKey}}` to your CADLens API key (starts with `cadl_`).\n3. Use `POST /v1/parse` to upload a file — `job_id` is auto-saved to `{{jobId}}`.\n4. Poll `GET /v1/jobs/:jobId` until `status` is `COMPLETED`, then fetch the result.\n\nDocs: https://cadlens.co/docs\nSupport: hello@cadlens.co",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{apiKey}}",
        "type": "string"
      }
    ]
  },
  "item": [
    {
      "name": "Parse",
      "description": "Upload a CAD file for parsing. Returns a `job_id` to track progress.",
      "item": [
        {
          "name": "POST /v1/parse — Upload CAD file",
          "event": [
            {
              "listen": "test",
              "script": {
                "type": "text/javascript",
                "exec": [
                  "if (pm.response.code === 200 || pm.response.code === 202) {",
                  "  pm.collectionVariables.set('jobId', pm.response.json().job_id);",
                  "}"
                ]
              }
            }
          ],
          "request": {
            "method": "POST",
            "header": [],
            "body": {
              "mode": "formdata",
              "formdata": [
                {
                  "key": "file",
                  "type": "file",
                  "src": [],
                  "description": "Required. DWG, DXF, DWF, DWFx, DGN, or PDF file (max 100 MB). Validated by magic bytes."
                },
                {
                  "key": "mode",
                  "type": "text",
                  "value": "async",
                  "description": "Optional. `async` (default) returns 202 immediately. `sync` holds up to 60s and returns 200 with full result if ready."
                },
                {
                  "key": "webhookUrl",
                  "type": "text",
                  "value": "",
                  "description": "Optional. HTTPS URL to receive job lifecycle events (job.processing, job.completed, job.failed).",
                  "disabled": true
                }
              ]
            },
            "url": {
              "raw": "{{baseUrl}}/v1/parse",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "parse"]
            },
            "description": "Upload a CAD file for parsing.\n\n**Async mode** (default): returns `202` with `{ job_id, status, fileName, fileSize, createdAt }`. Poll `/v1/jobs/:jobId` or use a webhook.\n\n**Sync mode** (`mode=sync`): holds the connection up to 60s. Returns `200` with full result if the worker finishes in time, otherwise `202`.\n\nThe test script auto-saves `job_id` to `{{jobId}}`."
          },
          "response": [
            {
              "name": "202 Accepted (async)",
              "status": "Accepted",
              "code": 202,
              "header": [{"key": "Content-Type", "value": "application/json"}],
              "body": "{\n  \"job_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n  \"status\": \"PENDING\",\n  \"fileName\": \"floorplan.dwg\",\n  \"fileSize\": 2457600,\n  \"createdAt\": \"2026-05-29T10:00:00.000Z\"\n}"
            },
            {
              "name": "200 OK (sync — completed)",
              "status": "OK",
              "code": 200,
              "header": [{"key": "Content-Type", "value": "application/json"}],
              "body": "{\n  \"job_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n  \"status\": \"COMPLETED\",\n  \"fileName\": \"floorplan.dwg\",\n  \"fileSize\": 2457600,\n  \"createdAt\": \"2026-05-29T10:00:00.000Z\",\n  \"completedAt\": \"2026-05-29T10:00:02.410Z\",\n  \"vectorJson\": { ... },\n  \"layersJson\": { ... },\n  \"metadata\": { ... },\n  \"imageUrl\": \"https://cdn.cadlens.co/preview/a1b2c3d4.png?X-Amz-Expires=3600\"\n}"
            }
          ]
        }
      ]
    },
    {
      "name": "Jobs",
      "description": "Poll job status, fetch parsed results, get the PNG preview, or delete a job.",
      "item": [
        {
          "name": "GET /v1/jobs — List recent jobs",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/v1/jobs",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "jobs"]
            },
            "description": "Returns the 100 most recent jobs for the authenticated API key, ordered by `createdAt` descending.\n\nEach job includes `imageUrl` (signed S3 URL, 1-hour TTL) when `status === 'COMPLETED'`, otherwise `null`."
          },
          "response": []
        },
        {
          "name": "GET /v1/jobs/:jobId — Get job status",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/v1/jobs/:jobId",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "jobs", ":jobId"],
              "variable": [{"key": "jobId", "value": "{{jobId}}"}]
            },
            "description": "Fetch a single job's status and metadata.\n\nStatus progression: `PENDING` → `PROCESSING` → `COMPLETED` or `FAILED`.\n\nIncludes `imageUrl` when completed."
          },
          "response": [
            {
              "name": "200 OK — completed",
              "status": "OK",
              "code": 200,
              "header": [{"key": "Content-Type", "value": "application/json"}],
              "body": "{\n  \"id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n  \"status\": \"COMPLETED\",\n  \"fileName\": \"floorplan.dwg\",\n  \"fileSize\": 2457600,\n  \"createdAt\": \"2026-05-29T10:00:00.000Z\",\n  \"completedAt\": \"2026-05-29T10:00:02.410Z\",\n  \"imageUrl\": \"https://cdn.cadlens.co/preview/a1b2c3d4.png?X-Amz-Expires=3600\"\n}"
            }
          ]
        },
        {
          "name": "GET /v1/jobs/:jobId/result — Get parsed result",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/v1/jobs/:jobId/result",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "jobs", ":jobId", "result"],
              "variable": [{"key": "jobId", "value": "{{jobId}}"}]
            },
            "description": "Returns the full parsed result once `status` is `COMPLETED`.\n\nIncludes:\n- `vectorJson` — all parsed entities (polylines, arcs, circles, text, etc.)\n- `layersJson` — layer metadata (name, color, entity count)\n- `metadata` — drawing info (units, bounding box, format)\n- `imageUrl` — signed PNG preview URL (1-hour TTL)"
          },
          "response": [
            {
              "name": "200 OK",
              "status": "OK",
              "code": 200,
              "header": [{"key": "Content-Type", "value": "application/json"}],
              "body": "{\n  \"jobId\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n  \"status\": \"COMPLETED\",\n  \"metadata\": {\n    \"units\": \"mm\",\n    \"boundingBox\": { \"width\": 12000, \"height\": 7200 }\n  },\n  \"layersJson\": [\n    { \"name\": \"WALL\", \"colorHex\": \"#00ff00\", \"entityCount\": 842 },\n    { \"name\": \"DOOR\", \"colorHex\": \"#ffaa00\", \"entityCount\": 96 }\n  ],\n  \"vectorJson\": [\n    {\n      \"type\": \"POLYLINE\",\n      \"layer\": \"WALL\",\n      \"vertices\": [{ \"x\": 10, \"y\": 20 }, { \"x\": 40, \"y\": 20 }],\n      \"closed\": false\n    }\n  ],\n  \"imageUrl\": \"https://cdn.cadlens.co/preview/a1b2c3d4.png?X-Amz-Expires=3600\",\n  \"createdAt\": \"2026-05-29T10:00:02.410Z\"\n}"
            }
          ]
        },
        {
          "name": "GET /v1/jobs/:jobId/image — Get PNG preview URL",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/v1/jobs/:jobId/image",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "jobs", ":jobId", "image"],
              "variable": [{"key": "jobId", "value": "{{jobId}}"}]
            },
            "description": "Returns a signed S3 URL for the rendered PNG preview. URL expires after 1 hour — re-call to refresh."
          },
          "response": [
            {
              "name": "200 OK",
              "status": "OK",
              "code": 200,
              "header": [{"key": "Content-Type", "value": "application/json"}],
              "body": "{\n  \"imageUrl\": \"https://cdn.cadlens.co/preview/a1b2c3d4.png?X-Amz-Expires=3600\"\n}"
            }
          ]
        },
        {
          "name": "DELETE /v1/jobs/:jobId — Delete job",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/v1/jobs/:jobId",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "jobs", ":jobId"],
              "variable": [{"key": "jobId", "value": "{{jobId}}"}]
            },
            "description": "Delete a job and its S3 artifacts (vector JSON, PNG preview). Returns 204 on success."
          },
          "response": []
        }
      ]
    }
  ],
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://api.cadlens.co",
      "type": "string"
    },
    {
      "key": "apiKey",
      "value": "",
      "type": "string"
    },
    {
      "key": "jobId",
      "value": "",
      "type": "string"
    }
  ]
}
