PDF report
Room material takeoff
Flooring, wall paint and trim from one measured room.
Room Studio has no public screen on htcalc.com. Its renovation handoff uses this planner for project costs. This HT Calc screen includes a Plus sample for visitors.
- Cost per success
- 1 calculation credit + 1 PDF report
- Production plans
- Business, Scale, Enterprise
Plan allowances - Free sandbox
- Not available
Integration example
Request a PDF
Before your first report
- Open Widgets & reports in your paid workspace.
Save your brand name, accent and at least one exact HTTPS origin, such as
https://app.example.com. The origins identify sites allowed to embed your widgets. - Under Report credentials, name a credential, select
room-studio-room-takeoffand choose Create report credential. Save the secret shown once in your server’sHT_REPORT_KEY. - Run the example on your server against
accounts.hasstechapi.com, without anOriginheader. A successful request returns a PDF and uses 1 calculation credit and 1 PDF report. Running the example again starts a new paid request.
What if the PDF doesn’t arrive?
For 400 INVALID_INPUT, inspect error.details when present. Paths for template fields start with input. Fix the indicated field and send a new request. This validation error uses zero credits and zero reports.
Open the .pdf.request.json file the example saved before sending. Within 24 hours, open
Request lookup in the same workspace, choose
Production, and paste the file’s requestId. The response’s X-Request-Id is a separate support identifier.
A settled request shows the calculation credits and report used. The service doesn’t keep the PDF for download. Check your saved file first. A replacement with a new ID uses 1 calculation credit and 1 PDF report on success.
If the outcome is unclear, check the workspace and ID, then look it up again before requesting a replacement.
Set HT_REPORT_KEY on your server. Save as example.mjs and run node example.mjs with Node.js 18 or later.
import { randomUUID } from "node:crypto";
import { writeFile } from "node:fs/promises";
const key = process.env.HT_REPORT_KEY;
if (!key) throw new Error("Set HT_REPORT_KEY on your server.");
const endpoint = "https://accounts.hasstechapi.com/v2/reports/room-studio-room-takeoff";
const input = {
"room": {
"id": "A",
"label": "Hall",
"unit": "ft",
"height": 8,
"shape": {
"type": "rectangle",
"width": 10,
"depth": 12
},
"fixtureCount": 2,
"openings": [
{
"type": "door",
"width": 3,
"height": 7,
"wallIndex": 0
},
{
"type": "window",
"width": 2,
"height": 3,
"wallIndex": 1,
"sillHeight": 3
},
{
"type": "opening",
"width": 2,
"height": 7,
"wallIndex": 2
}
]
}
};
const requestId = Date.now() + "." + randomUUID();
const output = "room-studio-room-takeoff-" + requestId + ".pdf";
await writeFile(output + ".request.json", JSON.stringify({ requestId, endpoint }), {
flag: "wx", mode: 0o600
});
console.error("Usage lookup ID:", requestId);
const response = await fetch(endpoint, {
method: "POST",
redirect: "error",
headers: {
"Authorization": "Bearer " + key,
"Content-Type": "application/json"
},
body: JSON.stringify({ requestId, input })
});
if (!response.ok) {
const problem = await response.json().catch(() => null);
const code = problem?.error?.code || response.statusText;
const delay = response.headers.get("retry-after");
if (delay) console.error("Retry-After (seconds):", delay);
console.error("HTTP " + response.status + " " + code + ". Usage lookup ID: " + requestId);
if (Array.isArray(problem?.error?.details)) {
for (const issue of problem.error.details) console.error("Input issue:", JSON.stringify(issue));
}
process.exitCode = 1;
} else {
if (response.headers.get("content-type")?.split(";")[0] !== "application/pdf") {
throw new Error("Expected a PDF. Look up request " + requestId);
}
await writeFile(output, new Uint8Array(await response.arrayBuffer()), { flag: "wx" });
console.log("Saved", output);
} Output
PDF output
A successful request returns the PDF file as application/pdf. The example writes a file named room-studio-room-takeoff-<requestId>.pdf.
See the Room material takeoff calculation and example result.
Request contract
Accepted inputs
Fields for this example. Expand the schema for all supported combinations and limits.
FieldType, units and limits
roomRequiredroom.idRequiredCaller-assigned stable room identifier, unique in the plan.
Min length 1 · Max length 80room.labelRequiredDisplay label for the room.
Min length 1 · Max length 160room.unitRequiredUnit of every input coordinate, length, height, sill and offset in this room. Use decimal feet for feet/inches (6 ft 8 in = 6 + 8/12).
Allowed: "ft", "m"room.heightOptionalCeiling height in input units; defaults to 8 feet if omitted.
Max 1000 · Greater than 0room.shapeRequiredRectangle, right-angle perimeter walk, or measured ordered polygon.
room.shape.typeRequiredroom.shape.widthRequiredLength in room input units.
Max 1000 · Greater than 0room.shape.depthRequiredLength in room input units.
Max 1000 · Greater than 0room.openingsOptionalCaller-measured apertures. Missing list means none.
Min items 0 · Max items 32room.openings[].typeRequiredA hinged door, window or uncased pass-through.
Allowed: "door", "window", "opening"room.openings[].wallIndexRequiredZero-based host wall index in the room.
Min 0 · Max 63room.openings[].widthRequiredLength in room input units.
Max 1000 · Greater than 0room.openings[].heightRequiredLength in room input units.
Max 1000 · Greater than 0room.openings[].offsetOptionalOffset from the start of the host wall in input units. Defaults to 0.
Min 0 · Max 1000room.openings[].sillHeightOptionalDistance above the floor in input units. Defaults to 0. The manual wizard uses a sill only for windows.
Min 0 · Max 1000room.fixtureCountOptionalCount of caller-identified fixtures; defaults to 0.
Min 0 · Max 64Example input (JSON)
The server example adds a fresh requestId to this input.
{
"input": {
"room": {
"id": "A",
"label": "Hall",
"unit": "ft",
"height": 8,
"shape": {
"type": "rectangle",
"width": 10,
"depth": 12
},
"fixtureCount": 2,
"openings": [
{
"type": "door",
"width": 3,
"height": 7,
"wallIndex": 0
},
{
"type": "window",
"width": 2,
"height": 3,
"wallIndex": 1,
"sillHeight": 3
},
{
"type": "opening",
"width": 2,
"height": 7,
"wallIndex": 2
}
]
}
}
} Full JSON schema
{
"type": "object",
"properties": {
"room": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Caller-assigned stable room identifier, unique in the plan.",
"minLength": 1,
"maxLength": 80
},
"label": {
"type": "string",
"description": "Display label for the room.",
"minLength": 1,
"maxLength": 160
},
"unit": {
"type": "string",
"description": "Unit of every input coordinate, length, height, sill and offset in this room. Use decimal feet for feet/inches (6 ft 8 in = 6 + 8/12).",
"enum": [
"ft",
"m"
]
},
"height": {
"type": "number",
"description": "Ceiling height in input units; defaults to 8 feet if omitted.",
"exclusiveMinimum": 0,
"maximum": 1000
},
"shape": {
"description": "Rectangle, right-angle perimeter walk, or measured ordered polygon.",
"oneOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "rectangle"
},
"width": {
"type": "number",
"description": "Length in room input units.",
"exclusiveMinimum": 0,
"maximum": 1000
},
"depth": {
"type": "number",
"description": "Length in room input units.",
"exclusiveMinimum": 0,
"maximum": 1000
}
},
"required": [
"type",
"width",
"depth"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "perimeter"
},
"segments": {
"type": "array",
"description": "Ordered wall lengths; start along positive X and turn after each wall.",
"items": {
"type": "object",
"properties": {
"length": {
"type": "number",
"description": "Length in room input units.",
"exclusiveMinimum": 0,
"maximum": 1000
},
"turn": {
"type": "string",
"description": "Turn after the segment.",
"enum": [
"left",
"right"
]
}
},
"required": [
"length",
"turn"
],
"additionalProperties": false
},
"minItems": 3,
"maxItems": 64
}
},
"required": [
"type",
"segments"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "polygon"
},
"corners": {
"type": "array",
"description": "Ordered corners (clockwise or counterclockwise); omit the repeated final vertex. Wall i connects corner i to the next corner.",
"items": {
"type": "array",
"description": "Wall-start point [x,y] on the floor plane.",
"items": {
"type": "number",
"description": "Signed coordinate in room input units.",
"minimum": -1000,
"maximum": 1000
},
"minItems": 2,
"maxItems": 2
},
"minItems": 3,
"maxItems": 64
},
"wallHeights": {
"type": "array",
"description": "Optional per-wall heights in input units, one per corner. A zero wall height falls back to room height in the takeoff.",
"items": {
"type": "number",
"description": "Wall height in input units.",
"minimum": 0,
"maximum": 1000
},
"minItems": 3,
"maxItems": 64
}
},
"required": [
"type",
"corners"
],
"additionalProperties": false
}
]
},
"openings": {
"type": "array",
"description": "Caller-measured apertures. Missing list means none.",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "A hinged door, window or uncased pass-through.",
"enum": [
"door",
"window",
"opening"
]
},
"wallIndex": {
"type": "integer",
"description": "Zero-based host wall index in the room.",
"minimum": 0,
"maximum": 63
},
"width": {
"type": "number",
"description": "Length in room input units.",
"exclusiveMinimum": 0,
"maximum": 1000
},
"height": {
"type": "number",
"description": "Length in room input units.",
"exclusiveMinimum": 0,
"maximum": 1000
},
"offset": {
"type": "number",
"description": "Offset from the start of the host wall in input units. Defaults to 0.",
"minimum": 0,
"maximum": 1000
},
"sillHeight": {
"type": "number",
"description": "Distance above the floor in input units. Defaults to 0. The manual wizard uses a sill only for windows.",
"minimum": 0,
"maximum": 1000
}
},
"required": [
"type",
"wallIndex",
"width",
"height"
],
"additionalProperties": false
},
"minItems": 0,
"maxItems": 32
},
"fixtureCount": {
"type": "integer",
"description": "Count of caller-identified fixtures; defaults to 0.",
"minimum": 0,
"maximum": 64
}
},
"required": [
"id",
"label",
"unit",
"shape"
],
"additionalProperties": false
}
},
"required": [
"room"
],
"additionalProperties": false
}Production endpoint: POST https://accounts.hasstechapi.com/v2/reports/room-studio-room-takeoff
Formula: room-studio-v1 · Report version: 1.0.0