Quickstart
Send a PDF drawing set, wait for the takeoff, and read every insulation quantity back page by page with where it sits on the drawing. This page takes you from nothing to quantities in about 20 lines, in curl, Python or Node.js.
1. Get an API key
A company admin signs in and opens Settings → API & webhooks → Make a key. The key starts
with ie_live_ and is shown once. Keep it on your server, for example in the environment variable
INSULENGINE_API_KEY, and never in a web page or a mobile app. Check that it works:
curl "https://insulengine.com/v1/jobs?limit=1" \
-H "Authorization: Bearer $INSULENGINE_API_KEY"
import os, requests
r = requests.get("https://insulengine.com/v1/jobs", params={"limit": 1},
headers={"Authorization": f"Bearer {os.environ['INSULENGINE_API_KEY']}"})
print(r.status_code, r.json())
const r = await fetch("https://insulengine.com/v1/jobs?limit=1", {
headers: { Authorization: `Bearer ${process.env.INSULENGINE_API_KEY}` },
});
console.log(r.status, await r.json());
200 with {"jobs": […]} means the key works. 401 means it is mistyped or
revoked. See Authentication.
2. Send the drawings and read the takeoff
The takeoff starts as soon as the drawings arrive. Most sets finish in a few minutes; large or scanned sets take longer. These scripts check once a minute. In production, use a webhook instead, so InsulEngine tells you when the takeoff is ready.
# Send the drawings: the answer carries the job's id.
curl -X POST https://insulengine.com/v1/jobs \
-H "Authorization: Bearer $INSULENGINE_API_KEY" \
-F name="Hope 4 Youth" -F systems=CW,HW,HWR,STORM \
-F drawings=@plumbing.pdf
# Ask until "status" is no longer "analyzing".
curl https://insulengine.com/v1/jobs/JOB_ID \
-H "Authorization: Bearer $INSULENGINE_API_KEY"
# Every quantity, page by page.
curl https://insulengine.com/v1/jobs/JOB_ID/takeoff \
-H "Authorization: Bearer $INSULENGINE_API_KEY"
import os
import time
import requests
BASE = "https://insulengine.com"
auth = {"Authorization": f"Bearer {os.environ['INSULENGINE_API_KEY']}"}
# Send the drawings: the takeoff starts at once.
with open("plumbing.pdf", "rb") as drawings:
response = requests.post(f"{BASE}/v1/jobs", headers=auth,
data={"name": "Hope 4 Youth", "systems": "CW,HW,HWR,STORM"},
files={"drawings": drawings})
response.raise_for_status()
job = response.json()
job_id = job["job"]["id"]
# Wait for it (or let a webhook tell you).
while job["status"] == "analyzing":
time.sleep(60)
job = requests.get(f"{BASE}/v1/jobs/{job_id}", headers=auth).json()
print(job["status"], job["estimate"] and job["estimate"]["sell_price"])
# Every quantity, page by page, with where it is on the drawing.
takeoff = requests.get(f"{BASE}/v1/jobs/{job_id}/takeoff", headers=auth).json()
for page in takeoff["pages"]:
for item in page["items"]:
print(page["sheet_number"], item["service"], item["size"],
item["quantity"], item["unit"], item.get("points"))
// Node.js 20 or later: fetch, FormData and openAsBlob are built in.
const { openAsBlob } = require("node:fs");
const BASE = "https://insulengine.com";
const auth = { Authorization: `Bearer ${process.env.INSULENGINE_API_KEY}` };
async function api(path, options = {}) {
const response = await fetch(BASE + path, { ...options, headers: auth });
if (!response.ok) throw new Error(`${path}: ${response.status} ${await response.text()}`);
return response.json();
}
async function main() {
// Send the drawings: the takeoff starts at once.
const form = new FormData();
form.append("name", "Hope 4 Youth");
form.append("systems", "CW,HW,HWR,STORM");
form.append("drawings", await openAsBlob("plumbing.pdf"), "plumbing.pdf");
let job = await api("/v1/jobs", { method: "POST", body: form });
const jobId = job.job.id;
// Wait for it (or let a webhook tell you).
while (job.status === "analyzing") {
await new Promise((resolve) => setTimeout(resolve, 60_000));
job = await api(`/v1/jobs/${jobId}`);
}
console.log(job.status, job.estimate && job.estimate.sell_price);
// Every quantity, page by page, with where it is on the drawing.
const takeoff = await api(`/v1/jobs/${jobId}/takeoff`);
for (const page of takeoff.pages) {
for (const item of page.items) {
console.log(page.sheet_number, item.service, item.size, item.quantity, item.unit,
JSON.stringify(item.points));
}
}
}
main().catch((error) => { console.error(error); process.exit(1); });
Each line printed is one measured run: the sheet it is on, its system and size, its footage, and its points on the page. For example:
P1 HW 1-1/4" 147.2 LF [[812.4, 1103.0], [1290.7, 1103.0], [1290.7, 1388.2]]
3. Next
- How it works: jobs, takeoff versions and what each status means.
- Show quantities on your drawings: draw the takeoff over your own rendering of the plans, in the browser or on a server.
- Keep your system in sync: webhooks, new versions and your own review.
- Endpoints: every request and answer.