# Cada ruta de la API de las calculadoras de construcción, lista para enviar

> Cada ruta de la API JSON del motor de las calculadoras: parámetros, un formulario de solicitud y código en curl, JavaScript y Python. Sin clave.

Página: https://craftquantities.com/es/developers/api-reference/ (documentación para desarrolladores, en español (es-US)). Esta es la copia en Markdown de la página; la página HTML es la versión canónica.

Generada a partir de la descripción OpenAPI del motor cuando se construye el sitio: qué acepta cada ruta, una solicitud resuelta, la misma solicitud en tres lenguajes y un formulario que la envía al motor desde esta página.

- 65 Operaciones
- 14 Grupos
- 3.1 OpenAPI
- Ninguna Clave o cuenta

**En esta página Antes de la primera solicitud**

## Antes de la primera solicitud

**Dirección base**

`https://api.craftquantities.com/v1`

**Inicio de sesión**

Ninguno: sin clave, sin cuenta, sin cookie. Las solicitudes tienen un límite por dirección, para un uso justo.

**Rechazos**

`application/problem+json`: un título, el estado y cada problema por entrada, con los valores que acepta.

**Respuestas**

JSON, o el informe Markdown del motor con `format=md`. Cantidades en unidades métricas y de EE. UU., nunca un precio.

**Versión**

Motor 1.9.1. [El registro de cambios](https://craftquantities.com/es/developers/changelog/)

- [Descripción OpenAPI](https://api.craftquantities.com/openapi.json)
- [Colección de Postman (Insomnia y Bruno también la importan)](https://craftquantities.com/developers/craftquantities.postman_collection.json)

### Los parámetros que acepta toda ruta

| Parámetro | Descripción |
|---|---|
| `detail` | summary: the result lines, the citation and the page only (fewer tokens); full, the default: the whole answer. A POST body may carry detail instead.Uno de: `full, summary`Predeterminado: `full` |
| `format` | md: the engine's Markdown report as text/markdown (or send Accept: text/markdown); json, the default.Uno de: `json, md` |

Ejemplos de código en

**Abierto:** las respuestas del motor (su API JSON, su servidor MCP y su paquete npm), los archivos de datos bajo /api/v1/ y la biblioteca de fórmulas (/formulas/) se publican bajo [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/): reutilícelos, también con fines comerciales, con el crédito “Craft Quantities” y un enlace. **Reservado:** el texto de las páginas, el diseño y el software, incluido el código del motor. [Los términos de uso](https://craftquantities.com/terms/)

## Búsqueda

Find a calculator, takeoff or worked example by what the job is.

### GET`/v1/search`

Find a calculator

| Parámetro | En | Tipo | Descripción |
|---|---|---|---|
| `q`obligatorio | query | `string` | What the job is, in US, UK or Australian words (or in Spanish, with lang=es). |
| `limit` | query | `integer` | Predeterminado: `10` |
| `lang` | query | `string` | es or es-US: the answer in US Spanish (labels, units, result lines, the honest machine-translation label; /es/ links once the site publishes them). en, the default.Uno de: `en, es, es-US, fr, fr-CA, pt, pt-BR`Predeterminado: `en` |

También acepta `format`: los parámetros que acepta toda ruta.

_curl_

```
curl -s "https://api.craftquantities.com/v1/search?q=concrete%20slab&limit=3"
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/search?q=concrete%20slab&limit=3");
const answer = await response.json();
```

_Python_

```
import requests

response = requests.get(
    "https://api.craftquantities.com/v1/search",
    params={
        "q": "concrete slab",
        "limit": "3",
    },
)
answer = response.json()
```

## Calculadoras

One calculator: what it asks, its answer in both systems, its sources and a link to its page.

### GET`/v1/calculate/{slug}`

Run a calculator (inputs in the query)

Every other query parameter is an input id, its value written with its unit where it measures something: slabLength=3%20m, slabThickness=4%20in.

| Parámetro | En | Tipo | Descripción |
|---|---|---|---|
| `slug`obligatorio | path | `string` | The calculator's slug, such as concrete-calculator. |
| `system` | query | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both.Uno de: `metric, imperial`Predeterminado: `metric` |
| `market` | query | `string` | Optional. A market whose own opening choice some inputs take (a UK reader's code, an IEC motor), and whose currency symbol prints the caller's own money figures.Uno de: `US, CA, UK, AU, INTL` |
| `inputUnits` | query | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit.Uno de: `base` |
| `explain` | query | `boolean` | true adds the working: the inputs as the calculator received them, every intermediate figure its own compute reports with its unit, the range check and the unit restatement, ending on the same figures. The answer's figures are identical either way.Predeterminado: `false` |
| `drawing` | query | `boolean` | true adds the page's drawing as SVG, for the calculators that draw one: the tile set-out (tile-layout-calculator), the deck plan with joists, butt joints and fixings (deck-board-calculator), the wall elevation course by course with its cuts, openings and lintels (brick-calculator, cmu-block-grout-calculator), the drywall hanging layout (drywall-calculator), the stud and plate layout (framing-stud-calculator), the siding face with its trim runs (siding-calculator), the gutter runs with joints and downspouts (gutter-calculator) and the fence elevation with posts, rails, gates and post concrete (fence-calculator). Worded in the system asked for; a setting-out aid, nothing sized. Other calculators refuse it.Predeterminado: `false` |
| `lang` | query | `string` | es or es-US: the answer in US Spanish (labels, units, result lines, the honest machine-translation label; /es/ links once the site publishes them). en, the default.Uno de: `en, es, es-US, fr, fr-CA, pt, pt-BR`Predeterminado: `en` |

También acepta `detail, format`: los parámetros que acepta toda ruta.

_curl_

```
curl -s "https://api.craftquantities.com/v1/calculate/concrete-calculator?slabLength=10%20ft&slabWidth=10%20ft&slabThickness=4%20in&system=imperial"
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/calculate/concrete-calculator?slabLength=10%20ft&slabWidth=10%20ft&slabThickness=4%20in&system=imperial");
const answer = await response.json();
```

_Python_

```
import requests

response = requests.get(
    "https://api.craftquantities.com/v1/calculate/concrete-calculator",
    params={
        "slabLength": "10 ft",
        "slabWidth": "10 ft",
        "slabThickness": "4 in",
        "system": "imperial",
    },
)
answer = response.json()
```

### POST`/v1/calculate/{slug}`

Run a calculator

| Parámetro | En | Tipo | Descripción |
|---|---|---|---|
| `slug`obligatorio | path | `string` | The calculator's slug, such as concrete-calculator. |

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON)

| Campo | Tipo | Descripción |
|---|---|---|
| `inputs` | `object` | The calculator's input values, by input id (an unknown id is refused with the accepted ids). A length, area, volume or other measured input takes "12 ft", "3.5 m", "8' 3 1/2\\"" or {"value": 12, "unit": "ft"}; a count or percentage takes a number; a select takes one of its option values. Inputs left out take the value the calculator's page opens on. |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `market` | `string` | Optional. A market whose own opening choice some inputs take (a UK reader's code, an IEC motor), and whose currency symbol prints the caller's own money figures. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |
| `explain` | `boolean` | true adds the working: the inputs as the calculator received them, every intermediate figure its own compute reports with its unit, the range check and the unit restatement, ending on the same figures. The answer's figures are identical either way. |
| `drawing` | `boolean` | true adds the page's drawing as SVG, for the calculators that draw one: the tile set-out (tile-layout-calculator), the deck plan with joists, butt joints and fixings (deck-board-calculator), the wall elevation course by course with its cuts, openings and lintels (brick-calculator, cmu-block-grout-calculator), the drywall hanging layout (drywall-calculator), the stud and plate layout (framing-stud-calculator), the siding face with its trim runs (siding-calculator), the gutter runs with joints and downspouts (gutter-calculator) and the fence elevation with posts, rails, gates and post concrete (fence-calculator). Worded in the system asked for; a setting-out aid, nothing sized. Other calculators refuse it. |
| `lang` | `string` | The answer's language. en (the default): as ever. es or es-US: US Spanish — labels, units, result lines and the honest machine-translation label from the site's Spanish pages, Spanish words read in a question or a trade term, and links to the /es/ pages once the site publishes them (until then the links stay English). fr or fr-CA (Canadian French, /fr/) and pt or pt-BR (Brazilian Portuguese, /pt/): the same from the site's French and Portuguese pages, figures with a decimal comma; each link names the translated page only once that page is published, otherwise the English page. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/calculate/concrete-calculator" \
  -H "Content-Type: application/json" \
  -d '{"inputs":{"slabLength":"10 ft","slabWidth":"10 ft","slabThickness":"4 in"},"system":"imperial"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/calculate/concrete-calculator", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "inputs": {
      "slabLength": "10 ft",
      "slabWidth": "10 ft",
      "slabThickness": "4 in"
    },
    "system": "imperial"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/calculate/concrete-calculator",
    json={
        "inputs": {
            "slabLength": "10 ft",
            "slabWidth": "10 ft",
            "slabThickness": "4 in",
        },
        "system": "imperial",
    },
)
answer = response.json()
```

### GET`/v1/describe/{slug}`

A calculator's inputs, units, opening values, sources and version

| Parámetro | En | Tipo | Descripción |
|---|---|---|---|
| `slug`obligatorio | path | `string` | The calculator's slug, such as concrete-calculator. |

También acepta `detail, format`: los parámetros que acepta toda ruta.

_curl_

```
curl -s "https://api.craftquantities.com/v1/describe/paint-calculator"
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/describe/paint-calculator");
const answer = await response.json();
```

_Python_

```
import requests

response = requests.get("https://api.craftquantities.com/v1/describe/paint-calculator")
answer = response.json()
```

### GET`/v1/sources/{slug}`

A calculator's sources and a citation

| Parámetro | En | Tipo | Descripción |
|---|---|---|---|
| `slug`obligatorio | path | `string` | The calculator's slug, such as concrete-calculator. |

También acepta `detail, format`: los parámetros que acepta toda ruta.

_curl_

```
curl -s "https://api.craftquantities.com/v1/sources/concrete-calculator"
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/sources/concrete-calculator");
const answer = await response.json();
```

_Python_

```
import requests

response = requests.get("https://api.craftquantities.com/v1/sources/concrete-calculator")
answer = response.json()
```

### GET`/v1/link/{slug}`

A link that opens the page with these inputs

Every other query parameter is an input id, its value written with its unit where it measures something: slabLength=3%20m, slabThickness=4%20in.

| Parámetro | En | Tipo | Descripción |
|---|---|---|---|
| `slug`obligatorio | path | `string` | The calculator's slug, such as concrete-calculator. |
| `system` | query | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both.Uno de: `metric, imperial`Predeterminado: `metric` |
| `market` | query | `string` | Optional. A market whose own opening choice some inputs take (a UK reader's code, an IEC motor), and whose currency symbol prints the caller's own money figures.Uno de: `US, CA, UK, AU, INTL` |
| `inputUnits` | query | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit.Uno de: `base` |
| `lang` | query | `string` | es or es-US: the answer in US Spanish (labels, units, result lines, the honest machine-translation label; /es/ links once the site publishes them). en, the default.Uno de: `en, es, es-US, fr, fr-CA, pt, pt-BR`Predeterminado: `en` |

También acepta `detail, format`: los parámetros que acepta toda ruta.

_curl_

```
curl -s "https://api.craftquantities.com/v1/link/concrete-calculator?slabLength=3%20m&slabWidth=3%20m&slabThickness=10%20cm"
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/link/concrete-calculator?slabLength=3%20m&slabWidth=3%20m&slabThickness=10%20cm");
const answer = await response.json();
```

_Python_

```
import requests

response = requests.get(
    "https://api.craftquantities.com/v1/link/concrete-calculator",
    params={
        "slabLength": "3 m",
        "slabWidth": "3 m",
        "slabThickness": "10 cm",
    },
)
answer = response.json()
```

### POST`/v1/optimise-cuts`

Optimise a cut list: pieces from stock lengths, or rectangles nested on sheets

Stateless: the cut list arrives and the plan goes back. The site's own optimiser, as its cut-list tool and the Construction Canvas run it.

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `kind`obligatorio | `any` | linear: lengths cut from stock lengths (studs, plates, joists, rafters, bars, trim, boards). sheet: rectangles nested on sheets (plasterboard or drywall, plywood, OSB, tiles). |
| `material` | `any` | What is cut, for the market's stock lengths or sheet sizes, saw kerf and grain when they are left out: timber (the default for linear), rebar or casing; plasterboard (the default for sheet), plywood, OSB or tile. |
| `pieces`obligatorio | `array of object` | The cut list: up to 200 lines and 3000 pieces (1500 for sheets) in all. |
| `stock` | `array of number \| string \| object` | linear: the stock lengths on offer, each in any number, with units ("4.8 m", "16 ft"). Left out, the market's usual lengths for the material in the system asked for. |
| `sheets` | `array of object` | sheet: the sheet sizes on offer (the plan takes the one that buys the least area). Left out, the market's usual size for the material. |
| `kerf` | `number \| string \| object` | The saw's kerf, charged on every piece (both ways on a sheet). Left out, the material's: 3 mm or 1/8 in for a saw, none for a bar shear or a board knife. |
| `minOffcut` | `number \| string \| object` | linear: the shortest offcut worth keeping; shorter ones count as waste. sheet: the smallest offcut (either way round) listed for reuse; left out, 300 mm (12 in) square. |
| `trim` | `number \| string \| object` | sheet: cut off every sheet edge before nesting (a factory edge that is not clean). Left out, none. |
| `mode` | `any` | sheet: guillotine (the default), every cut edge to edge for a panel or track saw, with the cuts in order; free, also layouts needing plunge cuts (CNC). |
| `bandAllowance` | `number \| string \| object` | sheet: tape added to every banded edge for trimming flush. Left out, none. |
| `rotate` | `boolean` | sheet: whether pieces may turn a quarter (no grain or strength axis to keep). Left out: yes for plasterboard and tiles, no for plywood and OSB. |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/optimise-cuts" \
  -H "Content-Type: application/json" \
  -d '{"kind":"linear","material":"timber","pieces":[{"length":"2.326 m","count":24,"label":"stud"},{"length":"1.225 m","count":3,"label":"sill"},{"length":"8.9 m","count":3,"label":"plate","join":true}],"stock":["2.4 m","3 m","3.6 m","4.8 m"],"kerf":"3 mm","system":"metric"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/optimise-cuts", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "kind": "linear",
    "material": "timber",
    "pieces": [
      {
        "length": "2.326 m",
        "count": 24,
        "label": "stud"
      },
      {
        "length": "1.225 m",
        "count": 3,
        "label": "sill"
      },
      {
        "length": "8.9 m",
        "count": 3,
        "label": "plate",
        "join": true
      }
    ],
    "stock": [
      "2.4 m",
      "3 m",
      "3.6 m",
      "4.8 m"
    ],
    "kerf": "3 mm",
    "system": "metric"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/optimise-cuts",
    json={
        "kind": "linear",
        "material": "timber",
        "pieces": [
            {
                "length": "2.326 m",
                "count": 24,
                "label": "stud",
            },
            {
                "length": "1.225 m",
                "count": 3,
                "label": "sill",
            },
            {
                "length": "8.9 m",
                "count": 3,
                "label": "plate",
                "join": True,
            },
        ],
        "stock": [
            "2.4 m",
            "3 m",
            "3.6 m",
            "4.8 m",
        ],
        "kerf": "3 mm",
        "system": "metric",
    },
)
answer = response.json()
```

### POST`/v1/compare-on-job`

Compare two options on one job, with the crossover

Works both sides of a comparison page (LVP vs tile, paint vs wallpaper …) on one job: each side's quantity in both unit systems, allowance, weight and person-hours, the difference, and the crossover as one job figure is swept. Each calculator runs as its page runs it. No prices. Stateless: the request arrives and the answer goes back; nothing is stored. The body is at most 65,536 bytes (413 above it).

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `comparison`obligatorio | `string` | A comparison page's slug, such as lvp-vs-tile or paint-vs-wallpaper. |
| `job` | `object` | The job's figures by field id, each length or area with its unit ("14 ft", {"value": 4.2, "unit": "m"}), a count or pitch as a number, a choice as its option value. Fields left out open at the page's own figure. |
| `sweep` | `string` | The job field the crossover chart sweeps; the page's own when left out. |
| `points` | `integer` | Sample points across the swept field's range. |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `market` | `string` | Optional. A market whose own opening choice some inputs take (a UK reader's code, an IEC motor), and whose currency symbol prints the caller's own money figures. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/compare-on-job" \
  -H "Content-Type: application/json" \
  -d '{"comparison":"paint-vs-wallpaper","job":{"roomLength":"4 m","roomWidth":"3.5 m","wallHeight":"2.4 m"},"system":"metric"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/compare-on-job", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "comparison": "paint-vs-wallpaper",
    "job": {
      "roomLength": "4 m",
      "roomWidth": "3.5 m",
      "wallHeight": "2.4 m"
    },
    "system": "metric"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/compare-on-job",
    json={
        "comparison": "paint-vs-wallpaper",
        "job": {
            "roomLength": "4 m",
            "roomWidth": "3.5 m",
            "wallHeight": "2.4 m",
        },
        "system": "metric",
    },
)
answer = response.json()
```

### POST`/v1/guide-chain`

Run a guide's "Try the calculation" with your figures

Runs a how-to guide's "Try the calculation" block on the figures given: each step's calculator in the guide's order, what to buy with waste and order quantities, both unit systems, person-hours, and the guide's link opening the block on these figures. No prices; nothing sized. Stateless: the request arrives and the answer goes back; nothing is stored. The body is at most 65,536 bytes (413 above it).

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `guide`obligatorio | `string` | A guide's slug whose page has a "Try the calculation" block, such as how-to-board-a-loft-over-insulation. |
| `measurements` | `object` | Measurement id → value, each length, area or volume with its unit; counts as numbers. Any left out opens at the guide's own figure. |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `market` | `string` | Optional. A market whose own opening choice some inputs take (a UK reader's code, an IEC motor), and whose currency symbol prints the caller's own money figures. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/guide-chain" \
  -H "Content-Type: application/json" \
  -d '{"guide":"how-to-board-a-loft-over-insulation","measurements":{"length":"5 m","width":"2.4 m","centres":"600 mm"},"system":"metric"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/guide-chain", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "guide": "how-to-board-a-loft-over-insulation",
    "measurements": {
      "length": "5 m",
      "width": "2.4 m",
      "centres": "600 mm"
    },
    "system": "metric"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/guide-chain",
    json={
        "guide": "how-to-board-a-loft-over-insulation",
        "measurements": {
            "length": "5 m",
            "width": "2.4 m",
            "centres": "600 mm",
        },
        "system": "metric",
    },
)
answer = response.json()
```

### POST`/v1/stair`

Stair layout: straight, turned, concrete or steel

Lays out a flight as built: risers, goings, pitch, 2R+G, the floor opening for a headroom, the stringer as cut, timber and fixings (straight, landing or winders), or concrete and bars, or steel mass; both systems, limits read against a named code, a canvas link. Not sized. Stateless: the request arrives and the answer goes back; nothing is stored. The body is at most 65,536 bytes (413 above it).

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `kind`obligatorio | `any` | straight: one timber flight; turned: an L or U on a landing or winders; concrete: a cast flight; steel: steel stringers with treads. |
| `inputs` | `object` | The stair page's inputs by id (totalRise, targetRiser, going, buildingCode …), each length with its unit; any left out opens at the page's own figure. |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `market` | `string` | Optional. A market whose own opening choice some inputs take (a UK reader's code, an IEC motor), and whose currency symbol prints the caller's own money figures. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/stair" \
  -H "Content-Type: application/json" \
  -d '{"kind":"straight","inputs":{"totalRise":"2.8 m","buildingCode":"uk"},"system":"metric"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/stair", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "kind": "straight",
    "inputs": {
      "totalRise": "2.8 m",
      "buildingCode": "uk"
    },
    "system": "metric"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/stair",
    json={
        "kind": "straight",
        "inputs": {
            "totalRise": "2.8 m",
            "buildingCode": "uk",
        },
        "system": "metric",
    },
)
answer = response.json()
```

## Unidades

Conversions by the exact factors the calculators use.

### GET`/v1/convert`

Convert a value between units with the site's exact factors

| Parámetro | En | Tipo | Descripción |
|---|---|---|---|
| `value`obligatorio | query | `number` |  |
| `from`obligatorio | query | `string` |  |
| `to`obligatorio | query | `string` |  |
| `dimension` | query | `string` |  |

También acepta `detail, format`: los parámetros que acepta toda ruta.

_curl_

```
curl -s "https://api.craftquantities.com/v1/convert?value=10&from=ft&to=m"
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/convert?value=10&from=ft&to=m");
const answer = await response.json();
```

_Python_

```
import requests

response = requests.get(
    "https://api.craftquantities.com/v1/convert",
    params={
        "value": "10",
        "from": "ft",
        "to": "m",
    },
)
answer = response.json()
```

## Cuantificaciones

A whole job worked row by row, as its takeoff page works it.

### GET`/v1/takeoff/{id}`

A whole-job takeoff's measurements, build-up choices and calculators

| Parámetro | En | Tipo | Descripción |
|---|---|---|---|
| `id`obligatorio | path | `string` |  |

También acepta `detail, format`: los parámetros que acepta toda ruta.

_curl_

```
curl -s "https://api.craftquantities.com/v1/takeoff/concrete-slab"
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/takeoff/concrete-slab");
const answer = await response.json();
```

_Python_

```
import requests

response = requests.get("https://api.craftquantities.com/v1/takeoff/concrete-slab")
answer = response.json()
```

### GET`/v1/takeoff/{id}/run`

Work a takeoff (measurements in the query, build-up choices as v.{choice})

The same query the takeoff page's own link carries: each measurement under its id, written with its unit; each build-up choice as v.{choice}={option}.

| Parámetro | En | Tipo | Descripción |
|---|---|---|---|
| `id`obligatorio | path | `string` |  |
| `system` | query | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both.Uno de: `metric, imperial`Predeterminado: `metric` |
| `market` | query | `string` | Optional. A market whose own opening choice some inputs take (a UK reader's code, an IEC motor), and whose currency symbol prints the caller's own money figures.Uno de: `US, CA, UK, AU, INTL` |
| `inputUnits` | query | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit.Uno de: `base` |

También acepta `detail, format`: los parámetros que acepta toda ruta.

_curl_

```
curl -s "https://api.craftquantities.com/v1/takeoff/concrete-slab/run?length=6%20m&width=4%20m&thickness=100%20mm&system=metric"
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/takeoff/concrete-slab/run?length=6%20m&width=4%20m&thickness=100%20mm&system=metric");
const answer = await response.json();
```

_Python_

```
import requests

response = requests.get(
    "https://api.craftquantities.com/v1/takeoff/concrete-slab/run",
    params={
        "length": "6 m",
        "width": "4 m",
        "thickness": "100 mm",
        "system": "metric",
    },
)
answer = response.json()
```

### POST`/v1/takeoff/{id}/run`

Work a takeoff

| Parámetro | En | Tipo | Descripción |
|---|---|---|---|
| `id`obligatorio | path | `string` |  |

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON)

| Campo | Tipo | Descripción |
|---|---|---|
| `measurements` | `object` | Measurement id → value, each length, area or volume with its unit ("12 ft", {"value": 3.6, "unit": "m"}); counts as numbers. Ids are those of the takeoff; any left out opens at the page's own figure. |
| `selection` | `object` | Build-up choice id → option id, the takeoff's own (a stud size, an insulation, a cladding). Choices left out take the page's own for the system. |
| `allowances` | `object` | Row → an allowance the reader sets: a percentage (cutting waste, overlap), or the option an allowance follows (a lay pattern). Row names are the takeoff's steps (the calculator slug, or the step key where one runs twice). |
| `leaveOut` | `array of string` | Rows the reader leaves out of the job: still worked and shown, not put in the project or counted in labour. |
| `addOns` | `array of string` | Optional add-on rows to turn on (gutters on a roof job). Add-ons are off unless named here; an add-on's own followers (downspouts with the gutters) come in with it. |
| `supplyOwnFixings` | `boolean` | True leaves every accessory row (fixings, sealants, trims, tapes, primers…) out of the job: still worked and shown, not put in the project or counted in labour. |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `market` | `string` | Optional. A market whose own opening choice some inputs take (a UK reader's code, an IEC motor), and whose currency symbol prints the caller's own money figures. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/takeoff/concrete-slab/run" \
  -H "Content-Type: application/json" \
  -d '{"measurements":{"length":"6 m","width":"4 m","thickness":"100 mm"},"system":"metric"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/takeoff/concrete-slab/run", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "measurements": {
      "length": "6 m",
      "width": "4 m",
      "thickness": "100 mm"
    },
    "system": "metric"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/takeoff/concrete-slab/run",
    json={
        "measurements": {
            "length": "6 m",
            "width": "4 m",
            "thickness": "100 mm",
        },
        "system": "metric",
    },
)
answer = response.json()
```

### POST`/v1/job-sheet`

One-page job sheet for the van

The one-page job sheet a takeoff page prints for the van: the job's picture as SVG, key dimensions in metric and imperial, the build-up, each line going in with what to buy, labour hours by trade, and the link reopening the page on these figures. Words and figures for the PDF; no prices. Stateless: the request arrives and the answer goes back; nothing is stored. The body is at most 65,536 bytes (413 above it).

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `takeoff`obligatorio | `string` | The takeoff's id, such as concrete-slab or stud-wall. |
| `measurements` | `object` | Measurement id → value, each length, area or volume with its unit ("12 ft", {"value": 3.6, "unit": "m"}); counts as numbers. Ids are those of the takeoff; any left out opens at the page's own figure. |
| `selection` | `object` | Build-up choice id → option id, the takeoff's own (a stud size, an insulation, a cladding). Choices left out take the page's own for the system. |
| `leaveOut` | `array of string` | Rows the reader leaves out of the job: still worked and shown, not put in the project or counted in labour. |
| `addOns` | `array of string` | Optional add-on rows to turn on (gutters on a roof job). Add-ons are off unless named here; an add-on's own followers (downspouts with the gutters) come in with it. |
| `supplyOwnFixings` | `boolean` | True leaves every accessory row (fixings, sealants, trims, tapes, primers…) out of the job: still worked and shown, not put in the project or counted in labour. |
| `paper` | `any` | The sheet's paper; the market's when left out. |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `market` | `string` | Optional. A market whose own opening choice some inputs take (a UK reader's code, an IEC motor), and whose currency symbol prints the caller's own money figures. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/job-sheet" \
  -H "Content-Type: application/json" \
  -d '{"takeoff":"concrete-slab","measurements":{"length":"6 m","width":"4 m","thickness":"100 mm"},"system":"metric"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/job-sheet", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "takeoff": "concrete-slab",
    "measurements": {
      "length": "6 m",
      "width": "4 m",
      "thickness": "100 mm"
    },
    "system": "metric"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/job-sheet",
    json={
        "takeoff": "concrete-slab",
        "measurements": {
            "length": "6 m",
            "width": "4 m",
            "thickness": "100 mm",
        },
        "system": "metric",
    },
)
answer = response.json()
```

### POST`/v1/plan-set-takeoff`

Take off plan sheets: counts, lengths, areas per layer

Totals a set of drawing sheets as the plan takeoff does: each sheet with its own scale (from a known line, or pixels per mm), counts, lengths and areas read off them in the sheet's pixels, layers adding up across the sheets; returns each layer's total and each sheet's share in metric and US units, unscaled marks left out and named. Points in, no picture; not sized. Stateless: the request arrives and the answer goes back; nothing is stored.

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `name` | `string` | The set's name (default Plan set). |
| `sheets`obligatorio | `array of object` | The sheets, each with its scale and its marks. At most 500 marks and 20,000 points in all. |
| `system` | `string` | The system lengths are read in (both are returned). |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/plan-set-takeoff" \
  -H "Content-Type: application/json" \
  -d '{"name":"House A","sheets":[{"name":"Ground floor","scale":{"line":[[100,100],[1100,100]],"length":"5 m"},"marks":[{"layer":"Outlets","kind":"count","countType":"outlet","points":[[200,300],[400,300],[600,300],[800,500]]},{"layer":"Partition walls","kind":"length","points":[[100,600],[1100,600],[1100,1000]]}]},{"name":"First floor","scale":{"pixelsPerMm":0.1},"marks":[{"layer":"Outlets","kind":"count","countType":"outlet","points":[[150,150],[450,150],[750,150]]},{"layer":"Partition walls","kind":"length","points":[[0,0],[400,0]]}]}],"system":"metric"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/plan-set-takeoff", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "name": "House A",
    "sheets": [
      {
        "name": "Ground floor",
        "scale": {
          "line": [
            [
              100,
              100
            ],
            [
              1100,
              100
            ]
          ],
          "length": "5 m"
        },
        "marks": [
          {
            "layer": "Outlets",
            "kind": "count",
            "countType": "outlet",
            "points": [
              [
                200,
                300
              ],
              [
                400,
                300
              ],
              [
                600,
                300
              ],
              [
                800,
                500
              ]
            ]
          },
          {
            "layer": "Partition walls",
            "kind": "length",
            "points": [
              [
                100,
                600
              ],
              [
                1100,
                600
              ],
              [
                1100,
                1000
              ]
            ]
          }
        ]
      },
      {
        "name": "First floor",
        "scale": {
          "pixelsPerMm": 0.1
        },
        "marks": [
          {
            "layer": "Outlets",
            "kind": "count",
            "countType": "outlet",
            "points": [
              [
                150,
                150
              ],
              [
                450,
                150
              ],
              [
                750,
                150
              ]
            ]
          },
          {
            "layer": "Partition walls",
            "kind": "length",
            "points": [
              [
                0,
                0
              ],
              [
                400,
                0
              ]
            ]
          }
        ]
      }
    ],
    "system": "metric"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/plan-set-takeoff",
    json={
        "name": "House A",
        "sheets": [
            {
                "name": "Ground floor",
                "scale": {
                    "line": [
                        [
                            100,
                            100,
                        ],
                        [
                            1100,
                            100,
                        ],
                    ],
                    "length": "5 m",
                },
                "marks": [
                    {
                        "layer": "Outlets",
                        "kind": "count",
                        "countType": "outlet",
                        "points": [
                            [
                                200,
                                300,
                            ],
                            [
                                400,
                                300,
                            ],
                            [
                                600,
                                300,
                            ],
                            [
                                800,
                                500,
                            ],
                        ],
                    },
                    {
                        "layer": "Partition walls",
                        "kind": "length",
                        "points": [
                            [
                                100,
                                600,
                            ],
                            [
                                1100,
                                600,
                            ],
                            [
                                1100,
                                1000,
                            ],
                        ],
                    },
                ],
            },
            {
                "name": "First floor",
                "scale": {
                    "pixelsPerMm": 0.1,
                },
                "marks": [
                    {
                        "layer": "Outlets",
                        "kind": "count",
                        "countType": "outlet",
                        "points": [
                            [
                                150,
                                150,
                            ],
                            [
                                450,
                                150,
                            ],
                            [
                                750,
                                150,
                            ],
                        ],
                    },
                    {
                        "layer": "Partition walls",
                        "kind": "length",
                        "points": [
                            [
                                0,
                                0,
                            ],
                            [
                                400,
                                0,
                            ],
                        ],
                    },
                ],
            },
        ],
        "system": "metric",
    },
)
answer = response.json()
```

## Ejemplos resueltos

The site's published examples, re-run now against their pinned figures.

### GET`/v1/example/{slug}`

A worked example as published

| Parámetro | En | Tipo | Descripción |
|---|---|---|---|
| `slug`obligatorio | path | `string` | The calculator's slug, such as concrete-calculator. |

También acepta `detail, format`: los parámetros que acepta toda ruta.

_curl_

```
curl -s "https://api.craftquantities.com/v1/example/bathroom-gutted-and-retiled"
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/example/bathroom-gutted-and-retiled");
const answer = await response.json();
```

_Python_

```
import requests

response = requests.get("https://api.craftquantities.com/v1/example/bathroom-gutted-and-retiled")
answer = response.json()
```

### GET`/v1/example/{slug}/run`

Re-run a worked example's pinned steps

| Parámetro | En | Tipo | Descripción |
|---|---|---|---|
| `slug`obligatorio | path | `string` | The calculator's slug, such as concrete-calculator. |

También acepta `detail, format`: los parámetros que acepta toda ruta.

_curl_

```
curl -s "https://api.craftquantities.com/v1/example/bathroom-gutted-and-retiled/run"
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/example/bathroom-gutted-and-retiled/run");
const answer = await response.json();
```

_Python_

```
import requests

response = requests.get("https://api.craftquantities.com/v1/example/bathroom-gutted-and-retiled/run")
answer = response.json()
```

### POST`/v1/example-live`

Re-run a worked example with changed figures

Re-runs a worked example with the job's figures changed: each change follows down every step that reads it, each step beside its published figure with the difference, both unit systems, the project lines with offered hours, and a link reopening it. A modelled job; no prices. Stateless: the request arrives and the answer goes back; nothing is stored. The body is at most 65,536 bytes (413 above it).

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `example`obligatorio | `string` | A worked example's slug, such as attached-deck-built. |
| `figures` | `object` | The job's own figures by id (a deck's length, a room's height), each length or area with its unit; a count as a number. They follow down every step that reads them. |
| `inputs` | `object` | One step's own input, keyed "<step index>.<input id>" ("3.wastePercent"), each with its unit where it has one. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/example-live" \
  -H "Content-Type: application/json" \
  -d '{"example":"bathroom-gutted-and-retiled","figures":{"length":"4.5 m","width":"3 m"}}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/example-live", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "example": "bathroom-gutted-and-retiled",
    "figures": {
      "length": "4.5 m",
      "width": "3 m"
    }
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/example-live",
    json={
        "example": "bathroom-gutted-and-retiled",
        "figures": {
            "length": "4.5 m",
            "width": "3 m",
        },
    },
)
answer = response.json()
```

## Planificador

The room-by-room planner: one space, or several and a roof.

### GET`/v1/planner/{kind}`

The planner's ids for one kind of space

| Parámetro | En | Tipo | Descripción |
|---|---|---|---|
| `kind`obligatorio | path | `string` | The kind of space: a room or a bathroom (from its size, doors and windows), or a slab, deck, driveway, fence, loft, retaining wall, exterior wall, stair, patio, lawn, raised bed (garden-bed), pergola, garden wall, shed, gutter run, partition wall, basement wall, kitchen run, pitched roof, garage floor, closet, strip footing, pond or swimming pool (pool).Uno de: `room, bathroom, slab, deck, driveway, fence, loft, retaining-wall, exterior-wall, stair, patio, lawn, garden-bed, pergola, garden-wall, shed, gutter, partition-wall, basement-wall, kitchen, pitched-roof, garage-floor, closet, strip-footing, pond, pool` |

También acepta `detail, format`: los parámetros que acepta toda ruta.

_curl_

```
curl -s "https://api.craftquantities.com/v1/planner/deck"
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/planner/deck");
const answer = await response.json();
```

_Python_

```
import requests

response = requests.get("https://api.craftquantities.com/v1/planner/deck")
answer = response.json()
```

### POST`/v1/plan`

Plan a room or another space

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `kind`obligatorio | `string` | The kind of space: a room or a bathroom (from its size, doors and windows), or a slab, deck, driveway, fence, loft, retaining wall, exterior wall, stair, patio, lawn, raised bed (garden-bed), pergola, garden wall, shed, gutter run, partition wall, basement wall, kitchen run, pitched roof, garage floor, closet, strip footing, pond or swimming pool (pool). |
| `figures`obligatorio | `object` | The space's figures, by the planner's ids, each a length with its unit (a room: length, width, height, wallThickness; a fence: length, height; a stair: totalRise, width …). |
| `doors` | `object` |  |
| `windows` | `object` |  |
| `finishes` | `object` | Surface role → finish id, by the planner's ids. |
| `scope` | `object` | Scope question name → answer value, by the planner's ids. |
| `intent` | `string` | A trade, or everything. |
| `leaveOut` | `array of string` | Branch ids to leave out. |
| `inputs` | `object` | Branch id → { calculator input id: value in its base unit }. |
| `name` | `string` |  |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/plan" \
  -H "Content-Type: application/json" \
  -d '{"kind":"room","figures":{"length":"4 m","width":"3 m","height":"2.4 m"},"doors":{"count":1},"windows":{"count":2},"name":"Bedroom"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/plan", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "kind": "room",
    "figures": {
      "length": "4 m",
      "width": "3 m",
      "height": "2.4 m"
    },
    "doors": {
      "count": 1
    },
    "windows": {
      "count": 2
    },
    "name": "Bedroom"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/plan",
    json={
        "kind": "room",
        "figures": {
            "length": "4 m",
            "width": "3 m",
            "height": "2.4 m",
        },
        "doors": {
            "count": 1,
        },
        "windows": {
            "count": 2,
        },
        "name": "Bedroom",
    },
)
answer = response.json()
```

### POST`/v1/plan-project`

Plan several spaces and a roof together

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `spaces`obligatorio | `array of object` | The spaces, in order, each one planned space. |
| `roof` | `object` |  |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/plan-project" \
  -H "Content-Type: application/json" \
  -d '{"spaces":[{"kind":"room","name":"Bedroom","figures":{"length":"4 m","width":"3 m","height":"2.4 m"},"doors":{"count":1},"windows":{"count":2}},{"kind":"bathroom","figures":{"length":"2.5 m","width":"2 m","height":"2.4 m"},"doors":{"count":1}}],"roof":{"pitch":6}}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/plan-project", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "spaces": [
      {
        "kind": "room",
        "name": "Bedroom",
        "figures": {
          "length": "4 m",
          "width": "3 m",
          "height": "2.4 m"
        },
        "doors": {
          "count": 1
        },
        "windows": {
          "count": 2
        }
      },
      {
        "kind": "bathroom",
        "figures": {
          "length": "2.5 m",
          "width": "2 m",
          "height": "2.4 m"
        },
        "doors": {
          "count": 1
        }
      }
    ],
    "roof": {
      "pitch": 6
    }
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/plan-project",
    json={
        "spaces": [
            {
                "kind": "room",
                "name": "Bedroom",
                "figures": {
                    "length": "4 m",
                    "width": "3 m",
                    "height": "2.4 m",
                },
                "doors": {
                    "count": 1,
                },
                "windows": {
                    "count": 2,
                },
            },
            {
                "kind": "bathroom",
                "figures": {
                    "length": "2.5 m",
                    "width": "2 m",
                    "height": "2.4 m",
                },
                "doors": {
                    "count": 1,
                },
            },
        ],
        "roof": {
            "pitch": 6,
        },
    },
)
answer = response.json()
```

### POST`/v1/sketch-room`

Measure a sketched room from its corners, and its materials

Measures a room drawn as a polygon of corners (any shape: L, U, angled walls) with its doors, windows and ceiling height, as the Sketch-to-Takeoff page does: floor and ceiling area, perimeter, each wall's length, gross and net wall area, in metric and imperial; a link that opens it drawn on the site; and, for four to eight square corners, the room planner's material lines (paint, flooring, skirting, plasterboard). Quantities only: no prices. Stateless: the request arrives and the answer goes back; nothing is stored.

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `corners`obligatorio | `array of object` | The room's corners in order round the room, in \`unit\` (walls run corner to corner and back to the first). Example, a 4 × 3 m room: \[{x:0,y:0},{x:4,y:0},{x:4,y:3},{x:0,y:3}\]. |
| `unit` | `any` | The unit of every coordinate, the height and the openings: m for metric and ft for imperial when left out. |
| `yAxis` | `any` | down (the default): y grows down the page, as a screen draws it; up: as a drawing's grid. Only the drawing's mirror changes, not a figure. |
| `height` | `number` | The ceiling height in \`unit\` (2.5 m or 8 ft when left out). |
| `openings` | `array of object` | Doors and windows, each on one wall. |
| `finish` | `object` | What the room planner works out for the room, as the sketch page's own finish choices. |
| `materials` | `boolean` | Also run the room planner on the room (four to eight square corners) for every material line. false: the measurements only. |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/sketch-room" \
  -H "Content-Type: application/json" \
  -d '{"corners":[{"x":0,"y":0},{"x":5,"y":0},{"x":5,"y":2},{"x":3,"y":2},{"x":3,"y":4},{"x":0,"y":4}],"unit":"m","height":2.5,"openings":[{"kind":"door","wall":5},{"kind":"window","wall":0}],"finish":{"walls":"paint","ceiling":"paint","floor":"click","board":"none"},"system":"metric"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/sketch-room", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "corners": [
      {
        "x": 0,
        "y": 0
      },
      {
        "x": 5,
        "y": 0
      },
      {
        "x": 5,
        "y": 2
      },
      {
        "x": 3,
        "y": 2
      },
      {
        "x": 3,
        "y": 4
      },
      {
        "x": 0,
        "y": 4
      }
    ],
    "unit": "m",
    "height": 2.5,
    "openings": [
      {
        "kind": "door",
        "wall": 5
      },
      {
        "kind": "window",
        "wall": 0
      }
    ],
    "finish": {
      "walls": "paint",
      "ceiling": "paint",
      "floor": "click",
      "board": "none"
    },
    "system": "metric"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/sketch-room",
    json={
        "corners": [
            {
                "x": 0,
                "y": 0,
            },
            {
                "x": 5,
                "y": 0,
            },
            {
                "x": 5,
                "y": 2,
            },
            {
                "x": 3,
                "y": 2,
            },
            {
                "x": 3,
                "y": 4,
            },
            {
                "x": 0,
                "y": 4,
            },
        ],
        "unit": "m",
        "height": 2.5,
        "openings": [
            {
                "kind": "door",
                "wall": 5,
            },
            {
                "kind": "window",
                "wall": 0,
            },
        ],
        "finish": {
            "walls": "paint",
            "ceiling": "paint",
            "floor": "click",
            "board": "none",
        },
        "system": "metric",
    },
)
answer = response.json()
```

## Casa y lienzo

The House Estimator and the Construction Canvas: a drawn house and everything it is built from, a sketch measured from its points, a drawing as DXF and SVG, and a reinforcement layout.

### GET`/v1/house`

Estimate a house (example, system and figures in the query)

Every parameter other than example, system, storeys, family, pitch, roofFamily and inputUnits is a figure of the form, written with its unit.

| Parámetro | En | Tipo | Descripción |
|---|---|---|---|
| `example` | query | `string` |  |
| `system` | query | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both.Uno de: `metric, imperial`Predeterminado: `metric` |
| `storeys` | query | `integer` | Uno de: `1, 2` |
| `family` | query | `string` | Uno de: `wall.framed-exterior, wall.masonry, wall.sip` |
| `pitch` | query | `string` | Roof pitch, rise in 12.Uno de: `4, 6, 8, 10, 12` |
| `roofFamily` | query | `string` | Uno de: `roof.asphalt-shingle, roof.tile-slate` |

También acepta `detail, format`: los parámetros que acepta toda ruta.

_curl_

```
curl -s "https://api.craftquantities.com/v1/house?length=12%20m&width=8%20m&windows=6&outsideDoors=2&storeys=1&system=metric"
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/house?length=12%20m&width=8%20m&windows=6&outsideDoors=2&storeys=1&system=metric");
const answer = await response.json();
```

_Python_

```
import requests

response = requests.get(
    "https://api.craftquantities.com/v1/house",
    params={
        "length": "12 m",
        "width": "8 m",
        "windows": "6",
        "outsideDoors": "2",
        "storeys": "1",
        "system": "metric",
    },
)
answer = response.json()
```

### POST`/v1/house`

Estimate a house

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON)

| Campo | Tipo | Descripción |
|---|---|---|
| `example` | `string` | Start from one of the site's example houses (its slug) in place of the estimator's opening house. |
| `values` | `object` | The form's figures, each length with its unit: length, width, storeyHeight, eaveOverhang, rakeOverhang, slabThickness, footingWidth, footingDepth, trenchDepth, windowWidth, windowHeight, doorWidth, doorHeight ("12 m", "40 ft"); and the counts partitions, windows, outsideDoors, interiorDoors, iceDamEaves. Any left out opens where the page opens it. |
| `storeys` | `integer` |  |
| `family` | `string` |  |
| `selection` | `object` | The exterior wall's build-up choices. |
| `pitch` | `string` | Roof pitch, rise in 12. |
| `roofFamily` | `string` |  |
| `roofSelection` | `object` |  |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/house" \
  -H "Content-Type: application/json" \
  -d '{"storeys":1,"system":"metric"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/house", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "storeys": 1,
    "system": "metric"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/house",
    json={
        "storeys": 1,
        "system": "metric",
    },
)
answer = response.json()
```

### POST`/v1/drawing`

Draw a house on the Construction Canvas

Exactly one of house, commands or document. Returns the canvas document, everything the canvas lists for it, and a My Project file carrying the drawing.

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `house` | `object` | The House Estimator's form: the house drawn as the estimator draws it. |
| `commands` | `array of object` | Drawing commands, in order, on the canvas's blank drawing (one storey; the wall, partition, window and door types). The whole request is at most 64 KiB. |
| `document` | `object` | A Construction Canvas document (schema 1 to the canvas's current), opened and checked by the canvas's own opener. |
| `shapes` | `array of object` | Simple shapes the assistant has read from the reader's words — a room, a deck, a patio, a bed, a path, a fence of legs and turns — compiled into the canvas's own commands. Every length with its unit. |
| `layout` | `object` | Rooms by name, size and which room each stands against, laid out on a grid: shared walls drawn once as partitions, every snap or move reported, and each room checked to close. |
| `template` | `string` | A Construction Canvas template's slug (the template index lists them: single-room, deck, two-car-garage …): the drawing its page shows, in the reader's system, with a link that opens it. |
| `variant` | `string` | With template: one of its two "what changes if" variants, by id; a wrong one is refused with the template's own list. |
| `name` | `string` | The project's name in the file. |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/drawing" \
  -H "Content-Type: application/json" \
  -d '{"commands":[{"op":"wall","ref":"south","from":{"x":"0 m","y":"0 m"},"to":{"x":"6 m","y":"0 m"}},{"op":"wall","from":{"x":"6 m","y":"0 m"},"to":{"x":"6 m","y":"4 m"}},{"op":"wall","from":{"x":"6 m","y":"4 m"},"to":{"x":"0 m","y":"4 m"}},{"op":"wall","from":{"x":"0 m","y":"4 m"},"to":{"x":"0 m","y":"0 m"}},{"op":"opening","kind":"door","wall":"south","offset":"1.5 m","p":{"exterior":true}},{"op":"opening","kind":"window","wall":"south","offset":"4 m"},{"op":"room","name":"Studio","at":{"x":"3 m","y":"2 m"}}],"name":"Studio","system":"metric"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/drawing", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "commands": [
      {
        "op": "wall",
        "ref": "south",
        "from": {
          "x": "0 m",
          "y": "0 m"
        },
        "to": {
          "x": "6 m",
          "y": "0 m"
        }
      },
      {
        "op": "wall",
        "from": {
          "x": "6 m",
          "y": "0 m"
        },
        "to": {
          "x": "6 m",
          "y": "4 m"
        }
      },
      {
        "op": "wall",
        "from": {
          "x": "6 m",
          "y": "4 m"
        },
        "to": {
          "x": "0 m",
          "y": "4 m"
        }
      },
      {
        "op": "wall",
        "from": {
          "x": "0 m",
          "y": "4 m"
        },
        "to": {
          "x": "0 m",
          "y": "0 m"
        }
      },
      {
        "op": "opening",
        "kind": "door",
        "wall": "south",
        "offset": "1.5 m",
        "p": {
          "exterior": true
        }
      },
      {
        "op": "opening",
        "kind": "window",
        "wall": "south",
        "offset": "4 m"
      },
      {
        "op": "room",
        "name": "Studio",
        "at": {
          "x": "3 m",
          "y": "2 m"
        }
      }
    ],
    "name": "Studio",
    "system": "metric"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/drawing",
    json={
        "commands": [
            {
                "op": "wall",
                "ref": "south",
                "from": {
                    "x": "0 m",
                    "y": "0 m",
                },
                "to": {
                    "x": "6 m",
                    "y": "0 m",
                },
            },
            {
                "op": "wall",
                "from": {
                    "x": "6 m",
                    "y": "0 m",
                },
                "to": {
                    "x": "6 m",
                    "y": "4 m",
                },
            },
            {
                "op": "wall",
                "from": {
                    "x": "6 m",
                    "y": "4 m",
                },
                "to": {
                    "x": "0 m",
                    "y": "4 m",
                },
            },
            {
                "op": "wall",
                "from": {
                    "x": "0 m",
                    "y": "4 m",
                },
                "to": {
                    "x": "0 m",
                    "y": "0 m",
                },
            },
            {
                "op": "opening",
                "kind": "door",
                "wall": "south",
                "offset": "1.5 m",
                "p": {
                    "exterior": True,
                },
            },
            {
                "op": "opening",
                "kind": "window",
                "wall": "south",
                "offset": "4 m",
            },
            {
                "op": "room",
                "name": "Studio",
                "at": {
                    "x": "3 m",
                    "y": "2 m",
                },
            },
        ],
        "name": "Studio",
        "system": "metric",
    },
)
answer = response.json()
```

### POST`/v1/sketch`

Areas, perimeters and lengths from points read off a plan, sketch or photo, scaled by one known reference

Points in the image's pixels and one reference; no image is sent. Returns the figures in both systems with an uncertainty band, closure and crossing checks, and a link that opens the scaled shapes on the canvas.

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `shapes`obligatorio | `array of object` | The outlines and lines read off the image, in its pixels. |
| `reference`obligatorio | `object` | ONE known size in the same image: a figured dimension, or an object of known size by its four corners. |
| `pixelError` | `number` | How far any point may be off, in pixels: it sets the band. |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/sketch" \
  -H "Content-Type: application/json" \
  -d '{"reference":{"dimension":{"from":{"x":100,"y":80},"to":{"x":700,"y":80},"length":"6 m"}},"shapes":[{"name":"Living room","kind":"area","points":[{"x":100,"y":100},{"x":700,"y":100},{"x":700,"y":500},{"x":400,"y":500},{"x":400,"y":350},{"x":100,"y":350}],"calculator":{"slug":"self-leveling-underlayment-calculator","input":"floorArea"}},{"name":"Garden fence","kind":"length","as":"fence","points":[{"x":100,"y":600},{"x":700,"y":600},{"x":700,"y":800}]}],"system":"metric"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/sketch", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "reference": {
      "dimension": {
        "from": {
          "x": 100,
          "y": 80
        },
        "to": {
          "x": 700,
          "y": 80
        },
        "length": "6 m"
      }
    },
    "shapes": [
      {
        "name": "Living room",
        "kind": "area",
        "points": [
          {
            "x": 100,
            "y": 100
          },
          {
            "x": 700,
            "y": 100
          },
          {
            "x": 700,
            "y": 500
          },
          {
            "x": 400,
            "y": 500
          },
          {
            "x": 400,
            "y": 350
          },
          {
            "x": 100,
            "y": 350
          }
        ],
        "calculator": {
          "slug": "self-leveling-underlayment-calculator",
          "input": "floorArea"
        }
      },
      {
        "name": "Garden fence",
        "kind": "length",
        "as": "fence",
        "points": [
          {
            "x": 100,
            "y": 600
          },
          {
            "x": 700,
            "y": 600
          },
          {
            "x": 700,
            "y": 800
          }
        ]
      }
    ],
    "system": "metric"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/sketch",
    json={
        "reference": {
            "dimension": {
                "from": {
                    "x": 100,
                    "y": 80,
                },
                "to": {
                    "x": 700,
                    "y": 80,
                },
                "length": "6 m",
            },
        },
        "shapes": [
            {
                "name": "Living room",
                "kind": "area",
                "points": [
                    {
                        "x": 100,
                        "y": 100,
                    },
                    {
                        "x": 700,
                        "y": 100,
                    },
                    {
                        "x": 700,
                        "y": 500,
                    },
                    {
                        "x": 400,
                        "y": 500,
                    },
                    {
                        "x": 400,
                        "y": 350,
                    },
                    {
                        "x": 100,
                        "y": 350,
                    },
                ],
                "calculator": {
                    "slug": "self-leveling-underlayment-calculator",
                    "input": "floorArea",
                },
            },
            {
                "name": "Garden fence",
                "kind": "length",
                "as": "fence",
                "points": [
                    {
                        "x": 100,
                        "y": 600,
                    },
                    {
                        "x": 700,
                        "y": 600,
                    },
                    {
                        "x": 700,
                        "y": 800,
                    },
                ],
            },
        ],
        "system": "metric",
    },
)
answer = response.json()
```

### POST`/v1/drawing-export`

A Construction Canvas drawing as DXF (CQ-\* layers) and SVG plan files

The drawing as create_drawing takes it; one file per drawn level, by the canvas's own plan painters. A file too large to return inline is rebuilt from the drawing's link.

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `house` | `object` | The House Estimator's form: the house drawn as the estimator draws it. |
| `commands` | `array of object` | Drawing commands, in order, on the canvas's blank drawing (one storey; the wall, partition, window and door types). The whole request is at most 64 KiB. |
| `document` | `object` | A Construction Canvas document (schema 1 to the canvas's current), opened and checked by the canvas's own opener. |
| `shapes` | `array of object` | Simple shapes the assistant has read from the reader's words — a room, a deck, a patio, a bed, a path, a fence of legs and turns — compiled into the canvas's own commands. Every length with its unit. |
| `layout` | `object` | Rooms by name, size and which room each stands against, laid out on a grid: shared walls drawn once as partitions, every snap or move reported, and each room checked to close. |
| `template` | `string` | A Construction Canvas template's slug (the template index lists them: single-room, deck, two-car-garage …): the drawing its page shows, in the reader's system, with a link that opens it. |
| `variant` | `string` | With template: one of its two "what changes if" variants, by id; a wrong one is refused with the template's own list. |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |
| `formats` | `array of any` | dxf, svg, ifc (openBIM IFC4: one file for the whole drawing, every level, with quantity sets), or several; left out, dxf and svg. |
| `level` | `string` | One level by its id or name; left out, every level with something on its plan. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/drawing-export" \
  -H "Content-Type: application/json" \
  -d '{"template":"single-room","system":"metric"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/drawing-export", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "template": "single-room",
    "system": "metric"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/drawing-export",
    json={
        "template": "single-room",
        "system": "metric",
    },
)
answer = response.json()
```

### POST`/v1/rebar-layout`

A bar layout drawing and counts for a rectangular slab or footing, from the bar size, spacing and cover given

A quantity layout, not a design: the engineer chooses bar size, spacing and cover. Counts by the site's Rebar Calculator's method inside the cover; weight by its Rebar Weight Calculator where it carries the size.

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `element` | `any` | A slab, or a pad or strip footing, as a rectangle on plan. |
| `length`obligatorio | `number \| string \| object` | Along x, with its unit. |
| `width`obligatorio | `number \| string \| object` | Along y, with its unit. |
| `cover`obligatorio | `number \| string \| object` | The cover to the bars on plan, as the engineer gives it. |
| `barSize`obligatorio | `string` | As the engineer gives it: #4, 15M, N12, H12, T12 or 12 mm. |
| `spacing` | `number \| string \| object` | The spacing both ways, as the engineer gives it. |
| `lengthwise` | `object` | The bars running along the length (spaced across the width): a spacing of their own, or a count. |
| `widthwise` | `object` | The bars running along the width (spaced along the length): a spacing of their own, or a count. |
| `mats` | `any` | One mat, or two (top and bottom) laid out alike. |
| `lapPercent` | `number` | The lap-splice allowance on the total; left out, the Rebar Calculator's own default. |
| `lapLength` | `number \| string \| object` | The lap length at each splice, as the engineer gives it, for the bar schedule's laps bar by bar (a bar longer than the stock length is joined). Left out, the schedule counts the laps but adds no length for them. |
| `chairs` | `object` | Count the bar supports too, from the supplier's support spacing. |
| `formats` | `array of any` | The drawing's files: svg, dxf or both (the default). |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/rebar-layout" \
  -H "Content-Type: application/json" \
  -d '{"element":"slab","length":"20 ft","width":"12 ft","cover":"2 in","barSize":"#4","spacing":"12 in","system":"imperial"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/rebar-layout", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "element": "slab",
    "length": "20 ft",
    "width": "12 ft",
    "cover": "2 in",
    "barSize": "#4",
    "spacing": "12 in",
    "system": "imperial"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/rebar-layout",
    json={
        "element": "slab",
        "length": "20 ft",
        "width": "12 ft",
        "cover": "2 in",
        "barSize": "#4",
        "spacing": "12 in",
        "system": "imperial",
    },
)
answer = response.json()
```

### POST`/v1/drawing-edit`

Edit a canvas drawing: move walls, add doors and windows

Changes a Construction Canvas drawing (its link, its document or any form a new drawing takes) by simple edits through the canvas's own commands: move a wall (joined walls follow), set a length, add a door or window, set properties or type, remove, add, set a level; returns the drawing, its revision, the link, the diff and the quantities that changed. baseRev refuses a stale drawing. Not sized. Stateless: the request arrives and the answer goes back; nothing is stored.

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `link` | `string` | A Construction Canvas drawing link (https://craftquantities.com/construction-canvas/#d=…, as the engine and the canvas's Share give it), or its code. |
| `document` | `object` | A Construction Canvas document (schema 1 to the canvas's current), opened by the canvas's own opener. Its JSON Schema: https://craftquantities.com/schemas/canvas-drawing-5.json. |
| `drawing` | `object` | A drawing in any form the engine draws from: house, commands, document, shapes, layout or template. |
| `operations`obligatorio | `array of object` | The edits, in order, each through the canvas's own commands. One that the canvas refuses refuses the whole request, with every problem: nothing is half-applied. |
| `system` | `string` | The system lengths are read in and the quantities listed in (both are listed); default the drawing's own. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |
| `baseRev` | `string` | The revision the edits are meant for (a rev or baseRev an earlier answer gave). When the drawing sent is not that revision (somebody changed it since), the request is refused with 409 and nothing is applied, as an If-Match. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/drawing-edit" \
  -H "Content-Type: application/json" \
  -d '{"drawing":{"template":"single-room"},"operations":[{"op":"move","target":{"side":"east"},"direction":"east","distance":"300 mm"},{"op":"add_opening","target":{"side":"north"},"kind":"window"}],"system":"metric"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/drawing-edit", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "drawing": {
      "template": "single-room"
    },
    "operations": [
      {
        "op": "move",
        "target": {
          "side": "east"
        },
        "direction": "east",
        "distance": "300 mm"
      },
      {
        "op": "add_opening",
        "target": {
          "side": "north"
        },
        "kind": "window"
      }
    ],
    "system": "metric"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/drawing-edit",
    json={
        "drawing": {
            "template": "single-room",
        },
        "operations": [
            {
                "op": "move",
                "target": {
                    "side": "east",
                },
                "direction": "east",
                "distance": "300 mm",
            },
            {
                "op": "add_opening",
                "target": {
                    "side": "north",
                },
                "kind": "window",
            },
        ],
        "system": "metric",
    },
)
answer = response.json()
```

## Presupuestos

A contractor's quote read against the job; the reader's own quote turned into a project.

### POST`/v1/check/{slug}`

Read a quote against the reader's job

Money in the quote is taken out before reading and never judged. A difference from a range is a question to ask, not a verdict. Nothing is kept.

| Parámetro | En | Tipo | Descripción |
|---|---|---|---|
| `slug`obligatorio | path | `string` | bathroom-quote, plastering-quote, or {takeoff id}-quote |

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `quote`obligatorio | `string` |  |
| `measurements` | `object` | Measurement id → value, each length, area or volume with its unit ("12 ft", {"value": 3.6, "unit": "m"}); counts as numbers. Ids are those of the takeoff; any left out opens at the page's own figure. |
| `selection` | `object` | Build-up choice id → option id, the takeoff's own (a stud size, an insulation, a cladding). Choices left out take the page's own for the system. |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `market` | `string` | Optional. A market whose own opening choice some inputs take (a UK reader's code, an IEC motor), and whose currency symbol prints the caller's own money figures. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/check/bathroom-quote" \
  -H "Content-Type: application/json" \
  -d '{"quote":"Wall and floor tiles 12 m2\nTile adhesive 6 bags\nGrout 3 bags"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/check/bathroom-quote", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "quote": "Wall and floor tiles 12 m2\nTile adhesive 6 bags\nGrout 3 bags"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/check/bathroom-quote",
    json={
        "quote": "Wall and floor tiles 12 m2\nTile adhesive 6 bags\nGrout 3 bags",
    },
)
answer = response.json()
```

### POST`/v1/quote-import`

The reader's own quote, prices and all, as a My Project file

The prices are the reader's own figures from the quote they supply, never the site's. Nothing is stored.

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `quote`obligatorio | `string` |  |
| `supplier` | `string` |  |
| `currency` | `string` |  |
| `market` | `string` | Optional. A market whose own opening choice some inputs take (a UK reader's code, an IEC motor), and whose currency symbol prints the caller's own money figures. |
| `name` | `string` |  |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/quote-import" \
  -H "Content-Type: application/json" \
  -d '{"quote":"Plasterboard 12.5 mm 30 sheets @ 9.50\nJointing compound 4 bags @ 12.00","currency":"£","supplier":"Builders'\'' merchant"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/quote-import", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "quote": "Plasterboard 12.5 mm 30 sheets @ 9.50\nJointing compound 4 bags @ 12.00",
    "currency": "£",
    "supplier": "Builders' merchant"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/quote-import",
    json={
        "quote": "Plasterboard 12.5 mm 30 sheets @ 9.50\nJointing compound 4 bags @ 12.00",
        "currency": "£",
        "supplier": "Builders' merchant",
    },
)
answer = response.json()
```

### POST`/v1/supplier-quote-request`

A request for quote to merchants from a bill of materials, with no price

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `items`obligatorio | `array of object` |  |
| `project` | `string` | The project's name, as the merchants will see it. |
| `currency` | `string` | The currency prices are asked in; left out, the market's. |
| `market` | `string` | Optional. A market whose own opening choice some inputs take (a UK reader's code, an IEC motor), and whose currency symbol prints the caller's own money figures. |
| `note` | `string` | A note to the merchants: delivery address area, dates, access. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/supplier-quote-request" \
  -H "Content-Type: application/json" \
  -d '{"project":"Garage slab","market":"UK","items":[{"description":"Ready-mix concrete, C25/30","quantity":2.64,"unit":"m³","notes":"Pump access from the drive"},{"description":"Rebar, 12 mm, 12 m lengths","quantity":11,"unit":"sticks"},{"description":"Formwork boards, 2.4 m","quantity":10,"unit":"boards"}]}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/supplier-quote-request", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "project": "Garage slab",
    "market": "UK",
    "items": [
      {
        "description": "Ready-mix concrete, C25/30",
        "quantity": 2.64,
        "unit": "m³",
        "notes": "Pump access from the drive"
      },
      {
        "description": "Rebar, 12 mm, 12 m lengths",
        "quantity": 11,
        "unit": "sticks"
      },
      {
        "description": "Formwork boards, 2.4 m",
        "quantity": 10,
        "unit": "boards"
      }
    ]
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/supplier-quote-request",
    json={
        "project": "Garage slab",
        "market": "UK",
        "items": [
            {
                "description": "Ready-mix concrete, C25/30",
                "quantity": 2.64,
                "unit": "m³",
                "notes": "Pump access from the drive",
            },
            {
                "description": "Rebar, 12 mm, 12 m lengths",
                "quantity": 11,
                "unit": "sticks",
            },
            {
                "description": "Formwork boards, 2.4 m",
                "quantity": 10,
                "unit": "boards",
            },
        ],
    },
)
answer = response.json()
```

### POST`/v1/level-quotes`

Level two to six quotes for one job, line by line

Levels two to six contractors' quotes for one job against the job's own lines: per line, whether each includes it (its quantity against the job's range, both systems), leaves it out, excludes it or offers an alternative; what each adds; questions to ask. Money is taken out: no total, no ranking. Stateless: the request arrives and the answer goes back; nothing is stored. The body is at most 69,632 bytes (413 above it).

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `job`obligatorio | `string` | The job the quotes are for: a quote check (bathroom-quote, plastering-quote, concrete-slab-quote …) or a takeoff id that has one. |
| `measurements` | `object` | Measurement id → value, each length, area or volume with its unit ("12 ft", {"value": 3.6, "unit": "m"}); counts as numbers. Ids are those of the takeoff; any left out opens at the page's own figure. |
| `selection` | `object` | Build-up choice id → option id, the takeoff's own (a stud size, an insulation, a cladding). Choices left out take the page's own for the system. |
| `quotes`obligatorio | `array of object` | Two to six quotes for the same job. Money in them is taken out before reading. |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `market` | `string` | Optional. A market whose own opening choice some inputs take (a UK reader's code, an IEC motor), and whose currency symbol prints the caller's own money figures. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/level-quotes" \
  -H "Content-Type: application/json" \
  -d '{"job":"bathroom-quote","quotes":[{"name":"Quote A","text":"Wall and floor tiles 12 m2\nTile adhesive 6 bags\nGrout 3 bags\nTanking membrane 8 m2"},{"name":"Quote B","text":"Tiles 11 m2\nAdhesive 5 bags\nExclusions: grout, skip hire"}]}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/level-quotes", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "job": "bathroom-quote",
    "quotes": [
      {
        "name": "Quote A",
        "text": "Wall and floor tiles 12 m2\nTile adhesive 6 bags\nGrout 3 bags\nTanking membrane 8 m2"
      },
      {
        "name": "Quote B",
        "text": "Tiles 11 m2\nAdhesive 5 bags\nExclusions: grout, skip hire"
      }
    ]
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/level-quotes",
    json={
        "job": "bathroom-quote",
        "quotes": [
            {
                "name": "Quote A",
                "text": "Wall and floor tiles 12 m2\nTile adhesive 6 bags\nGrout 3 bags\nTanking membrane 8 m2",
            },
            {
                "name": "Quote B",
                "text": "Tiles 11 m2\nAdhesive 5 bags\nExclusions: grout, skip hire",
            },
        ],
    },
)
answer = response.json()
```

## Archivos de proyecto

A My Project file the reader restores on the site. Nothing is stored.

### POST`/v1/my-project-file`

A My Project file from calculators and takeoffs

Returns the file in \`file.content\`; with ?download=1, the file itself as an attachment. The reader imports it in My Project with Restore from a backup.

| Parámetro | En | Tipo | Descripción |
|---|---|---|---|
| `download` | query | `string` | Uno de: `1` |

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `name` | `string` |  |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `market` | `string` | Optional. A market whose own opening choice some inputs take (a UK reader's code, an IEC motor), and whose currency symbol prints the caller's own money figures. |
| `calculators` | `array of object` |  |
| `takeoffs` | `array of object` |  |
| `houses` | `array of object` |  |
| `plan` | `object` | One planned space as plan_room takes it, or a whole project (spaces, roof) as plan_project takes it. |
| `drawing` | `object` | A drawing as create_drawing takes it; the file carries the drawing itself, which the canvas reopens. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/my-project-file" \
  -H "Content-Type: application/json" \
  -d '{"name":"Garage slab","system":"metric","calculators":[{"slug":"concrete-calculator","inputs":{"slabLength":"6 m","slabWidth":"4 m","slabThickness":"100 mm"}}]}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/my-project-file", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "name": "Garage slab",
    "system": "metric",
    "calculators": [
      {
        "slug": "concrete-calculator",
        "inputs": {
          "slabLength": "6 m",
          "slabWidth": "4 m",
          "slabThickness": "100 mm"
        }
      }
    ]
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/my-project-file",
    json={
        "name": "Garage slab",
        "system": "metric",
        "calculators": [
            {
                "slug": "concrete-calculator",
                "inputs": {
                    "slabLength": "6 m",
                    "slabWidth": "4 m",
                    "slabThickness": "100 mm",
                },
            },
        ],
    },
)
answer = response.json()
```

### POST`/v1/programme`

A build programme from a project's labour hours: tasks by trade, stage and level, working days, CSV and calendar

Stateless: the project comes as a state token, a My Project file, takeoffs or a drawing. Durations are the labour hours over the crew and working day given; no dates without a start date; hours and days only.

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `token` | `string` | A project state token (cqp1.…) from a project-file answer or an update: the project whose lines are put in order. |
| `file` | `object` | A My Project file (the backup a project-file answer returns, or one the reader exported): its active project's lines and any hours typed on them. |
| `takeoffs` | `array of object` | Whole-job takeoffs, each an id and its measurements, as a project file takes them. |
| `drawing` | `object` | A Construction Canvas drawing (a template, a house form, shapes, drawing commands or a canvas document), as a project file takes it; its levels set the level-by-level order. |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `market` | `string` | Optional. A market whose own opening choice some inputs take (a UK reader's code, an IEC motor), and whose currency symbol prints the caller's own money figures. |
| `crew` | `integer` | People in each trade's crew, unless named in crews. |
| `crews` | `object` | People in a trade's crew, by trade id (carpentry, drywall, electrical, roofing …). |
| `hoursPerDay` | `number` | Working hours in a crew's day. |
| `startDate` | `string` | Optional first day (YYYY-MM-DD): the working days are then given dates and a calendar file is returned. No date is assumed without it. |
| `workDays` | `array of integer` | The days of the week worked, 1 Monday to 7 Sunday. |
| `daysOff` | `array of string` | Dates not worked (holidays, a shutdown), YYYY-MM-DD. |
| `name` | `string` | The project's name, for the files. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/programme" \
  -H "Content-Type: application/json" \
  -d '{"drawing":{"template":"two-storey-house"},"crew":2,"hoursPerDay":8,"startDate":"2026-11-02"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/programme", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "drawing": {
      "template": "two-storey-house"
    },
    "crew": 2,
    "hoursPerDay": 8,
    "startDate": "2026-11-02"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/programme",
    json={
        "drawing": {
            "template": "two-storey-house",
        },
        "crew": 2,
        "hoursPerDay": 8,
        "startDate": "2026-11-02",
    },
)
answer = response.json()
```

### POST`/v1/hours`

Estimated labour hours per line of a project

Estimated person-hours on each line of a project, as My Project shows them: hours typed on the line, else a production rate's band for its quantity, else the reason for none; with the project's crew-days. From a token, a file, calculators, takeoffs or a drawing. Hours only: no prices. Stateless: the request arrives and the answer goes back; nothing is stored. The body is at most 65,536 bytes (413 above it).

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `token` | `string` | A project state token (cqp1.…) from a project-file answer or an update. |
| `file` | `object` | A My Project file (the backup a project-file answer returns, or one the reader exported): its active project's lines, with any hours and rates typed on them. |
| `calculators` | `array of object` | Calculator lines, each a slug and its inputs, as a project file takes them. |
| `takeoffs` | `array of object` | Whole-job takeoffs, each an id and its measurements, as a project file takes them. |
| `drawing` | `object` | A Construction Canvas drawing (a template, a house form, shapes, drawing commands or a canvas document), as a project file takes it. |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `market` | `string` | Optional. A market whose own opening choice some inputs take (a UK reader's code, an IEC motor), and whose currency symbol prints the caller's own money figures. |
| `crew` | `integer` | People on site, for the crew-days. |
| `hoursPerDay` | `number` | Working hours in a day, for the crew-days. |
| `name` | `string` | The project's name. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/hours" \
  -H "Content-Type: application/json" \
  -d '{"name":"Garage","system":"metric","crew":2,"takeoffs":[{"takeoff":"concrete-slab","measurements":{"length":"6 m","width":"4 m","thickness":"100 mm"}},{"takeoff":"stud-wall","measurements":{"length":"6 m","height":"2.4 m"}}]}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/hours", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "name": "Garage",
    "system": "metric",
    "crew": 2,
    "takeoffs": [
      {
        "takeoff": "concrete-slab",
        "measurements": {
          "length": "6 m",
          "width": "4 m",
          "thickness": "100 mm"
        }
      },
      {
        "takeoff": "stud-wall",
        "measurements": {
          "length": "6 m",
          "height": "2.4 m"
        }
      }
    ]
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/hours",
    json={
        "name": "Garage",
        "system": "metric",
        "crew": 2,
        "takeoffs": [
            {
                "takeoff": "concrete-slab",
                "measurements": {
                    "length": "6 m",
                    "width": "4 m",
                    "thickness": "100 mm",
                },
            },
            {
                "takeoff": "stud-wall",
                "measurements": {
                    "length": "6 m",
                    "height": "2.4 m",
                },
            },
        ],
    },
)
answer = response.json()
```

### POST`/v1/variation`

Variation (change order) between two versions of a project

Writes the variation (change order) between an agreed and a proposed version of a project: each line added, removed or changed, its quantity in metric and imperial, the labour hours, and the signed document as My Project prints it. Money only from the reader's own rates; with none, unpriced. Stateless: the request arrives and the answer goes back; nothing is stored. The body is at most 69,632 bytes (413 above it).

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `before`obligatorio | `object` | The agreed version: one of token, file, calculators, takeoffs or drawing. |
| `after`obligatorio | `object` | The proposed version, given the same ways. |
| `rates` | `object` | The reader's own unit rates (the site holds no price), by line id or calculator slug: a number, or { low, high }. A line's own rate in a file stays unless its id is named here. |
| `currency` | `string` | The label the reader's rates are in ("$", "£", "lei"); the market's when left out. A label only: no currency is converted. |
| `name` | `string` | The project's name on the document. |
| `reason` | `string` | Why the job changed, in the reader's words. |
| `number` | `string` | The variation's number (V-0003). |
| `preparedBy` | `string` |  |
| `client` | `string` |  |
| `paymentTerms` | `string` |  |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `market` | `string` | Optional. A market whose own opening choice some inputs take (a UK reader's code, an IEC motor), and whose currency symbol prints the caller's own money figures. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/variation" \
  -H "Content-Type: application/json" \
  -d '{"name":"Garage slab","system":"metric","market":"UK","before":{"calculators":[{"slug":"concrete-calculator","inputs":{"slabLength":"6 m","slabWidth":"4 m","slabThickness":"100 mm"}}]},"after":{"calculators":[{"slug":"concrete-calculator","inputs":{"slabLength":"7 m","slabWidth":"4 m","slabThickness":"100 mm"}}]},"rates":{"concrete-calculator":120},"reason":"Slab extended by 1 m for a workbench bay."}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/variation", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "name": "Garage slab",
    "system": "metric",
    "market": "UK",
    "before": {
      "calculators": [
        {
          "slug": "concrete-calculator",
          "inputs": {
            "slabLength": "6 m",
            "slabWidth": "4 m",
            "slabThickness": "100 mm"
          }
        }
      ]
    },
    "after": {
      "calculators": [
        {
          "slug": "concrete-calculator",
          "inputs": {
            "slabLength": "7 m",
            "slabWidth": "4 m",
            "slabThickness": "100 mm"
          }
        }
      ]
    },
    "rates": {
      "concrete-calculator": 120
    },
    "reason": "Slab extended by 1 m for a workbench bay."
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/variation",
    json={
        "name": "Garage slab",
        "system": "metric",
        "market": "UK",
        "before": {
            "calculators": [
                {
                    "slug": "concrete-calculator",
                    "inputs": {
                        "slabLength": "6 m",
                        "slabWidth": "4 m",
                        "slabThickness": "100 mm",
                    },
                },
            ],
        },
        "after": {
            "calculators": [
                {
                    "slug": "concrete-calculator",
                    "inputs": {
                        "slabLength": "7 m",
                        "slabWidth": "4 m",
                        "slabThickness": "100 mm",
                    },
                },
            ],
        },
        "rates": {
            "concrete-calculator": 120,
        },
        "reason": "Slab extended by 1 m for a workbench bay.",
    },
)
answer = response.json()
```

### POST`/v1/proposal`

Client proposal from a project, unpriced unless rates given

Writes the client proposal My Project prints: scope by line or trade division, quantities in metric and imperial, assumptions, exclusions, terms, payment stages and the signature block. From a token, a file, calculators, takeoffs or a drawing. "Not priced" unless the reader's own rates are given. Stateless: the request arrives and the answer goes back; nothing is stored. The body is at most 69,632 bytes (413 above it).

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `token` | `string` | A project state token (cqp1.…) from a project-file answer or an update. |
| `file` | `object` | A My Project file (the backup a project-file answer returns, or one the reader exported): its active project's lines, with any hours and rates typed on them. |
| `calculators` | `array of object` | Calculator lines, each a slug and its inputs, as a project file takes them. |
| `takeoffs` | `array of object` | Whole-job takeoffs, each an id and its measurements, as a project file takes them. |
| `drawing` | `object` | A Construction Canvas drawing (a template, a house form, shapes, drawing commands or a canvas document), as a project file takes it. |
| `rates` | `object` | The reader's own unit rates (the site holds no price), by line id or calculator slug: a number, or { low, high }. A line's own rate in a file stays unless its id is named here. |
| `currency` | `string` | The label the reader's rates are in ("$", "£", "lei"); the market's when left out. A label only: no currency is converted. |
| `name` | `string` | The project's name on the document. |
| `reference` | `string` |  |
| `companyName` | `string` | The contractor's name for the letterhead; blank prints none. |
| `preparedBy` | `string` |  |
| `client` | `string` |  |
| `intro` | `string` | A covering note in the contractor's words. |
| `terms` | `string` |  |
| `exclusions` | `string` |  |
| `validUntil` | `string` | The date the proposal is valid until, as it is to print. |
| `paymentSchedule` | `array of object` | Stages of payment as the reader sets them; none is suggested. |
| `groupByDivision` | `boolean` | Group the scope by MasterFormat division. |
| `includeNotes` | `boolean` |  |
| `showQuantities` | `boolean` |  |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `market` | `string` | Optional. A market whose own opening choice some inputs take (a UK reader's code, an IEC motor), and whose currency symbol prints the caller's own money figures. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/proposal" \
  -H "Content-Type: application/json" \
  -d '{"name":"Garage","system":"metric","takeoffs":[{"takeoff":"concrete-slab","measurements":{"length":"6 m","width":"4 m","thickness":"100 mm"}},{"takeoff":"stud-wall","measurements":{"length":"6 m","height":"2.4 m"}}],"companyName":"Example Builders","reference":"Q-0001"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/proposal", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "name": "Garage",
    "system": "metric",
    "takeoffs": [
      {
        "takeoff": "concrete-slab",
        "measurements": {
          "length": "6 m",
          "width": "4 m",
          "thickness": "100 mm"
        }
      },
      {
        "takeoff": "stud-wall",
        "measurements": {
          "length": "6 m",
          "height": "2.4 m"
        }
      }
    ],
    "companyName": "Example Builders",
    "reference": "Q-0001"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/proposal",
    json={
        "name": "Garage",
        "system": "metric",
        "takeoffs": [
            {
                "takeoff": "concrete-slab",
                "measurements": {
                    "length": "6 m",
                    "width": "4 m",
                    "thickness": "100 mm",
                },
            },
            {
                "takeoff": "stud-wall",
                "measurements": {
                    "length": "6 m",
                    "height": "2.4 m",
                },
            },
        ],
        "companyName": "Example Builders",
        "reference": "Q-0001",
    },
)
answer = response.json()
```

### POST`/v1/scope-of-work`

Scope of work from a project (three-part template)

Writes My Project's scope of work: Part 1 General (scope, work not included, submittals, the documents the lines' calculators cite in the market, site), Part 2 Products by trade with quantities, Part 3 Execution in the takeoffs' order with notices and inspections. A template for the parties; no prices. Stateless: the request arrives and the answer goes back; nothing is stored. The body is at most 69,632 bytes (413 above it).

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `token` | `string` | A project state token (cqp1.…) from a project-file answer or an update. |
| `file` | `object` | A My Project file (the backup a project-file answer returns, or one the reader exported): its active project's lines, with any hours and rates typed on them. |
| `calculators` | `array of object` | Calculator lines, each a slug and its inputs, as a project file takes them. |
| `takeoffs` | `array of object` | Whole-job takeoffs, each an id and its measurements, as a project file takes them. |
| `drawing` | `object` | A Construction Canvas drawing (a template, a house form, shapes, drawing commands or a canvas document), as a project file takes it. |
| `name` | `string` | The project's name on the document. |
| `takeoff` | `string` | One takeoff of the project (its name or id): the scope of that job alone. Left out: the whole project. |
| `style` | `any` | The headings: csi (North American three-part section format) or nbs (UK and Australian practice). The market's when left out. |
| `reference` | `string` |  |
| `siteAddress` | `string` |  |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `market` | `string` | Optional. A market whose own opening choice some inputs take (a UK reader's code, an IEC motor), and whose currency symbol prints the caller's own money figures. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/scope-of-work" \
  -H "Content-Type: application/json" \
  -d '{"name":"Garage","system":"metric","market":"UK","takeoffs":[{"takeoff":"concrete-slab","measurements":{"length":"6 m","width":"4 m","thickness":"100 mm"}},{"takeoff":"stud-wall","measurements":{"length":"6 m","height":"2.4 m"}}]}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/scope-of-work", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "name": "Garage",
    "system": "metric",
    "market": "UK",
    "takeoffs": [
      {
        "takeoff": "concrete-slab",
        "measurements": {
          "length": "6 m",
          "width": "4 m",
          "thickness": "100 mm"
        }
      },
      {
        "takeoff": "stud-wall",
        "measurements": {
          "length": "6 m",
          "height": "2.4 m"
        }
      }
    ]
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/scope-of-work",
    json={
        "name": "Garage",
        "system": "metric",
        "market": "UK",
        "takeoffs": [
            {
                "takeoff": "concrete-slab",
                "measurements": {
                    "length": "6 m",
                    "width": "4 m",
                    "thickness": "100 mm",
                },
            },
            {
                "takeoff": "stud-wall",
                "measurements": {
                    "length": "6 m",
                    "height": "2.4 m",
                },
            },
        ],
    },
)
answer = response.json()
```

### POST`/v1/share-link`

Share a project as a link (no account, nothing uploaded)

Makes a share link to a whole project, as My Project's Share key does: https://craftquantities.com/project/shared/#s=… opens every line, quantity, unit, calculator, takeoff setup and planned room for anyone, without an account; the project rides in the link's fragment, so no server receives it. From a token, a project file, calculators, takeoffs or a drawing. No prices travel, nor the client's name and address. Stateless: the request arrives and the answer goes back; nothing is stored.

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `token` | `string` | A project state token (cqp1.…) from a project-file answer or an update. |
| `file` | `object` | A My Project file (the backup a project-file answer returns, or one the reader exported): its active project's lines, with any hours and rates typed on them. |
| `calculators` | `array of object` | Calculator lines, each a slug and its inputs, as a project file takes them. |
| `takeoffs` | `array of object` | Whole-job takeoffs, each an id and its measurements, as a project file takes them. |
| `drawing` | `object` | A Construction Canvas drawing (a template, a house form, shapes, drawing commands or a canvas document), as a project file takes it. |
| `mode` | `any` | view (the default) opens the read-only summary; edit offers the reader a copy to change first. Either way the reader may take a copy: a link is not a permission. |
| `name` | `string` | The project's name as the link shows it. |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `market` | `string` | Optional. A market whose own opening choice some inputs take (a UK reader's code, an IEC motor), and whose currency symbol prints the caller's own money figures. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/share-link" \
  -H "Content-Type: application/json" \
  -d '{"name":"Garage","system":"metric","takeoffs":[{"takeoff":"concrete-slab","measurements":{"length":"6 m","width":"4 m","thickness":"100 mm"}}]}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/share-link", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "name": "Garage",
    "system": "metric",
    "takeoffs": [
      {
        "takeoff": "concrete-slab",
        "measurements": {
          "length": "6 m",
          "width": "4 m",
          "thickness": "100 mm"
        }
      }
    ]
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/share-link",
    json={
        "name": "Garage",
        "system": "metric",
        "takeoffs": [
            {
                "takeoff": "concrete-slab",
                "measurements": {
                    "length": "6 m",
                    "width": "4 m",
                    "thickness": "100 mm",
                },
            },
        ],
    },
)
answer = response.json()
```

### POST`/v1/share-link/open`

Read a shared project, plan or sketch link

Reads a Craft Quantities share link someone pasted — a shared project (/project/shared/#s=…), a planner's plan (/plan/<kind>/#s=p…) or a sketched room (/plan/sketch/#s=…) — and returns what it holds: the project's lines with quantities, units and calculators; the plan's spaces; or the room measured (areas, perimeter, walls). Decoded here and stored nowhere; prices in a link are not read out. Stateless: the request arrives and the answer goes back; nothing is stored.

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `link`obligatorio | `string` | A Craft Quantities share link as the reader pasted it: a project (/project/shared/#s=v1… or #s=e1…), a planner's plan (/plan/<kind>/#s=p1…) or a sketch (/plan/sketch/#s=…). The fragment alone (#s=…) is read too. |
| `system` | `string` | Only for a sketch: the system its figures print first in (the sketch's own when left out). |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/share-link/open" \
  -H "Content-Type: application/json" \
  -d '{"link":"https://craftquantities.com/plan/sketch/#s=AQDEEwYAAJBOAACgH58fAACgH-8uAAIKjgyEB4IQAAHsDrAJsAmEBwA"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/share-link/open", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "link": "https://craftquantities.com/plan/sketch/#s=AQDEEwYAAJBOAACgH58fAACgH-8uAAIKjgyEB4IQAAHsDrAJsAmEBwA"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/share-link/open",
    json={
        "link": "https://craftquantities.com/plan/sketch/#s=AQDEEwYAAJBOAACgH58fAACgH-8uAAIKjgyEB4IQAAHsDrAJsAmEBwA",
    },
)
answer = response.json()
```

## Resolver al revés

What the material the reader already has will cover, as the site's Solve Backwards pages work it.

### GET`/v1/solve/{page}`

What an amount of material covers, on one Solve Backwards page

Every other query parameter is a calculator setting, with its unit.

| Parámetro | En | Tipo | Descripción |
|---|---|---|---|
| `page`obligatorio | path | `string` | A Solve Backwards page's slug, such as wall-paint, drywall-sheets, bricks, concrete-bags, ready-mix-concrete. |
| `have`obligatorio | query | `string` | How much: 20, or 24%20gal. |
| `system` | query | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both.Uno de: `metric, imperial`Predeterminado: `metric` |

También acepta `detail, format`: los parámetros que acepta toda ruta.

_curl_

```
curl -s "https://api.craftquantities.com/v1/solve/wall-paint?have=24%20gal"
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/solve/wall-paint?have=24%20gal");
const answer = await response.json();
```

_Python_

```
import requests

response = requests.get(
    "https://api.craftquantities.com/v1/solve/wall-paint",
    params={
        "have": "24 gal",
    },
)
answer = response.json()
```

### POST`/v1/solve`

What an amount of material covers

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `page` | `string` | A Solve Backwards page's slug, such as wall-paint, drywall-sheets, bricks, concrete-bags, ready-mix-concrete. |
| `query` | `string` | Or what the reader has, in words ("sheets of drywall", "bags of concrete"), when the slug is not known. |
| `have`obligatorio | `number \| string \| object` | How much the reader has: a count for counted things (20, "20 sheets"); a measure with its unit for paint, concrete, soil ("24 gal", "2 m3", {"value": 90, "unit": "L"}). |
| `system` | `string` | The page's system; it sets the market's product (a 4 × 8 ft sheet in imperial). Left out: the unit's system, else metric. |
| `settings` | `object` | Optional: another calculator input, with its unit (a slab's thickness "4 in", coats 3). The inputs the page grows cannot be set. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/solve" \
  -H "Content-Type: application/json" \
  -d '{}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/solve", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({}),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/solve",
    json={},
)
answer = response.json()
```

## Diagnósticos y documentos

Faults by symptom, the documents each market uses, and trade words across markets.

### GET`/v1/diagnose`

Diagnosis pages that match a symptom, with candidate causes and how to tell them apart

| Parámetro | En | Tipo | Descripción |
|---|---|---|---|
| `symptom`obligatorio | query | `string` | What the reader sees, hears or smells, in their own words: "my breaker keeps tripping when the kettle is on". |
| `market` | query | `string` | Optional. A market whose own opening choice some inputs take (a UK reader's code, an IEC motor), and whose currency symbol prints the caller's own money figures.Uno de: `US, CA, UK, AU, INTL` |
| `limit` | query | `integer` | How many diagnoses at most. Left out: one when the match is clear, up to three when it is not. |

También acepta `detail, format`: los parámetros que acepta toda ruta.

_curl_

```
curl -s "https://api.craftquantities.com/v1/diagnose?symptom=breaker%20keeps%20tripping"
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/diagnose?symptom=breaker%20keeps%20tripping");
const answer = await response.json();
```

_Python_

```
import requests

response = requests.get(
    "https://api.craftquantities.com/v1/diagnose",
    params={
        "symptom": "breaker keeps tripping",
    },
)
answer = response.json()
```

### POST`/v1/diagnose`

Diagnosis pages that match a symptom

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `symptom`obligatorio | `string` | What the reader sees, hears or smells, in their own words: "my breaker keeps tripping when the kettle is on". |
| `market` | `string` | Optional. A market whose own opening choice some inputs take (a UK reader's code, an IEC motor), and whose currency symbol prints the caller's own money figures. |
| `limit` | `integer` | How many diagnoses at most. Left out: one when the match is clear, up to three when it is not. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/diagnose" \
  -H "Content-Type: application/json" \
  -d '{"symptom":"breaker keeps tripping"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/diagnose", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "symptom": "breaker keeps tripping"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/diagnose",
    json={
        "symptom": "breaker keeps tripping",
    },
)
answer = response.json()
```

### GET`/v1/documents`

The document family that governs a subject in a market, and who publishes it

Never an edition or a date: adoption is local, and the answer names who decides.

| Parámetro | En | Tipo | Descripción |
|---|---|---|---|
| `market`obligatorio | query | `string` | US, CA, UK, AU or INTL — or a country's name ("England", "Canada"); a country the site has no market for answers as INTL. |
| `subject` | query | `string` | The work, in words: "kitchen wiring", "stair handrails", "gas boiler flue". |
| `calculator` | query | `string` | Or a calculator's slug: the subjects its own sources name. |

También acepta `detail, format`: los parámetros que acepta toda ruta.

_curl_

```
curl -s "https://api.craftquantities.com/v1/documents?market=England&subject=kitchen%20wiring"
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/documents?market=England&subject=kitchen%20wiring");
const answer = await response.json();
```

_Python_

```
import requests

response = requests.get(
    "https://api.craftquantities.com/v1/documents",
    params={
        "market": "England",
        "subject": "kitchen wiring",
    },
)
answer = response.json()
```

### GET`/v1/term`

A trade word in each market's usage, with the false-friend warning

| Parámetro | En | Tipo | Descripción |
|---|---|---|---|
| `term`obligatorio | query | `string` | A trade word or phrase as one market says it, a brand name said for the product, or a misspelling: "plasterboard", "gyprock", "casing", "skirting", "eavestrough", "a yard of concrete". |
| `from` | query | `string` | The market whose word it is, where known.Uno de: `US, CA, UK, AU` |
| `to` | query | `string` | The market to say it in.Uno de: `US, CA, UK, AU` |

También acepta `detail, format`: los parámetros que acepta toda ruta.

_curl_

```
curl -s "https://api.craftquantities.com/v1/term?term=casing&from=US&to=UK"
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/term?term=casing&from=US&to=UK");
const answer = await response.json();
```

_Python_

```
import requests

response = requests.get(
    "https://api.craftquantities.com/v1/term",
    params={
        "term": "casing",
        "from": "US",
        "to": "UK",
    },
)
answer = response.json()
```

## Banco de pruebas

The Construction Quantities Benchmark: the calculators' test vectors as questions in both unit systems, with their answers, CC BY 4.0.

### GET`/v1/benchmark`

A page of the Construction Quantities Benchmark, or one calculator's items

| Parámetro | En | Tipo | Descripción |
|---|---|---|---|
| `page` | query | `integer` | Which page of the benchmark, from 1: each page holds the items of a few calculators, in slug order. 1 when left out. |
| `calculator` | query | `string` | One calculator's items only, by its slug, such as concrete-calculator. |

También acepta `detail, format`: los parámetros que acepta toda ruta.

_curl_

```
curl -s "https://api.craftquantities.com/v1/benchmark?calculator=concrete-calculator"
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/benchmark?calculator=concrete-calculator");
const answer = await response.json();
```

_Python_

```
import requests

response = requests.get(
    "https://api.craftquantities.com/v1/benchmark",
    params={
        "calculator": "concrete-calculator",
    },
)
answer = response.json()
```

## Herramientas para agentes

Many calculations in one request, a project changed through its state token, a list grouped by MasterFormat division, and permanent ids.

### POST`/v1/calculate-batch`

Several calculator runs in one request, each answered or refused on its own

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `items`obligatorio | `array of object` | The runs, 1 to 25, each one calculator and its inputs; answered in the same order. |
| `system` | `string` | The unit system for every run that does not name its own. |
| `market` | `string` | The market for every run that does not name its own. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/calculate-batch" \
  -H "Content-Type: application/json" \
  -d '{"system":"metric","items":[{"ref":"Slab","slug":"concrete-calculator","inputs":{"slabLength":"6 m","slabWidth":"4 m","slabThickness":"100 mm"}},{"ref":"Walls","slug":"drywall-calculator"},{"ref":"Paint","slug":"cq-c0656"}]}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/calculate-batch", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "system": "metric",
    "items": [
      {
        "ref": "Slab",
        "slug": "concrete-calculator",
        "inputs": {
          "slabLength": "6 m",
          "slabWidth": "4 m",
          "slabThickness": "100 mm"
        }
      },
      {
        "ref": "Walls",
        "slug": "drywall-calculator"
      },
      {
        "ref": "Paint",
        "slug": "cq-c0656"
      }
    ]
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/calculate-batch",
    json={
        "system": "metric",
        "items": [
            {
                "ref": "Slab",
                "slug": "concrete-calculator",
                "inputs": {
                    "slabLength": "6 m",
                    "slabWidth": "4 m",
                    "slabThickness": "100 mm",
                },
            },
            {
                "ref": "Walls",
                "slug": "drywall-calculator",
            },
            {
                "ref": "Paint",
                "slug": "cq-c0656",
            },
        ],
    },
)
answer = response.json()
```

### POST`/v1/project-update`

Change a project held in a state token: spaces, dimensions, takeoffs, calculator lines, roof pitch

Stateless: the token carries the project's inputs (compressed, not encrypted), and the answer carries the new token. Every line is rebuilt.

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `token`obligatorio | `string` | A project state token from a project-file answer or an earlier update. |
| `operations` | `array of object` | The changes, applied in order (0 to 20); none returns the project as the token holds it. |
| `file` | `boolean` | true: the updated My Project file as well. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/project-update" \
  -H "Content-Type: application/json" \
  -d '{"token":"cqp1.zZYtBDsIgEEWvYv6amFRdzdKb1M4IxMIYoDZNw90NRBfG5fv_vR0v0GDw8JFBeM5jhEEcg4BwFU6qAQZ5y0UCCEFK8hMMbsobaP-GH-8vvHu7JMnNnCXa4kC4HNqzeu507uTEW1dAOB3bXQ1YNfVu0iUW0FBbE1nX37XWNw.a6887bd2","operations":[{"op":"set_dimension","target":"space","index":0,"field":"length","value":"4.5 m"},{"op":"add_space","space":{"kind":"bathroom","name":"Bathroom","figures":{"length":"2.5 m","width":"2 m","height":"2.4 m"},"doors":{"count":1}}},{"op":"set_roof_pitch","pitch":6}]}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/project-update", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "token": "cqp1.zZYtBDsIgEEWvYv6amFRdzdKb1M4IxMIYoDZNw90NRBfG5fv_vR0v0GDw8JFBeM5jhEEcg4BwFU6qAQZ5y0UCCEFK8hMMbsobaP-GH-8vvHu7JMnNnCXa4kC4HNqzeu507uTEW1dAOB3bXQ1YNfVu0iUW0FBbE1nX37XWNw.a6887bd2",
    "operations": [
      {
        "op": "set_dimension",
        "target": "space",
        "index": 0,
        "field": "length",
        "value": "4.5 m"
      },
      {
        "op": "add_space",
        "space": {
          "kind": "bathroom",
          "name": "Bathroom",
          "figures": {
            "length": "2.5 m",
            "width": "2 m",
            "height": "2.4 m"
          },
          "doors": {
            "count": 1
          }
        }
      },
      {
        "op": "set_roof_pitch",
        "pitch": 6
      }
    ]
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/project-update",
    json={
        "token": "cqp1.zZYtBDsIgEEWvYv6amFRdzdKb1M4IxMIYoDZNw90NRBfG5fv_vR0v0GDw8JFBeM5jhEEcg4BwFU6qAQZ5y0UCCEFK8hMMbsobaP-GH-8vvHu7JMnNnCXa4kC4HNqzeu507uTEW1dAOB3bXQ1YNfVu0iUW0FBbE1nX37XWNw.a6887bd2",
        "operations": [
            {
                "op": "set_dimension",
                "target": "space",
                "index": 0,
                "field": "length",
                "value": "4.5 m",
            },
            {
                "op": "add_space",
                "space": {
                    "kind": "bathroom",
                    "name": "Bathroom",
                    "figures": {
                        "length": "2.5 m",
                        "width": "2 m",
                        "height": "2.4 m",
                    },
                    "doors": {
                        "count": 1,
                    },
                },
            },
            {
                "op": "set_roof_pitch",
                "pitch": 6,
            },
        ],
    },
)
answer = response.json()
```

### POST`/v1/classify`

Group lines, calculators or a project by MasterFormat 2018 division (a suggestion)

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `token` | `string` | A project state token: its lines are grouped. |
| `lines` | `array of object` | Lines of a takeoff, plan, house, drawing or bill: each a label, and the calculator slug where known. |
| `calculators` | `array of string` | Calculator slugs or permanent ids. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/classify" \
  -H "Content-Type: application/json" \
  -d '{"lines":[{"label":"Ready-mix concrete","quantity":2.64,"unit":"m³","slug":"concrete-calculator"},{"label":"Rebar, 12 mm","quantity":11,"unit":"sticks","slug":"rebar-calculator"},{"label":"Damp-proof membrane","quantity":30,"unit":"m²"},{"label":"Hardcore sub-base","quantity":2.4,"unit":"t"}]}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/classify", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "lines": [
      {
        "label": "Ready-mix concrete",
        "quantity": 2.64,
        "unit": "m³",
        "slug": "concrete-calculator"
      },
      {
        "label": "Rebar, 12 mm",
        "quantity": 11,
        "unit": "sticks",
        "slug": "rebar-calculator"
      },
      {
        "label": "Damp-proof membrane",
        "quantity": 30,
        "unit": "m²"
      },
      {
        "label": "Hardcore sub-base",
        "quantity": 2.4,
        "unit": "t"
      }
    ]
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/classify",
    json={
        "lines": [
            {
                "label": "Ready-mix concrete",
                "quantity": 2.64,
                "unit": "m³",
                "slug": "concrete-calculator",
            },
            {
                "label": "Rebar, 12 mm",
                "quantity": 11,
                "unit": "sticks",
                "slug": "rebar-calculator",
            },
            {
                "label": "Damp-proof membrane",
                "quantity": 30,
                "unit": "m²",
            },
            {
                "label": "Hardcore sub-base",
                "quantity": 2.4,
                "unit": "t",
            },
        ],
    },
)
answer = response.json()
```

### GET`/v1/id/{id}`

A permanent id, an old slug or a site address to the page as it is today

| Parámetro | En | Tipo | Descripción |
|---|---|---|---|
| `id`obligatorio | path | `string` | A permanent id (cq-c0412), a current or earlier slug, or a craftquantities.com address. |
| `kind` | query | `any` | Only pages of this kind.Uno de: `calculator, takeoff, guide, example, term, diagnosis` |

También acepta `detail, format`: los parámetros que acepta toda ruta.

_curl_

```
curl -s "https://api.craftquantities.com/v1/id/cq-c0187"
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/id/cq-c0187");
const answer = await response.json();
```

_Python_

```
import requests

response = requests.get("https://api.craftquantities.com/v1/id/cq-c0187")
answer = response.json()
```

### POST`/v1/canvas-link`

Open a job or worked example on the Construction Canvas

Draws a whole-job takeoff or a worked example at the figures given as a Construction Canvas drawing and returns the link that opens it; the drawing rides in the link's fragment, so nothing is uploaded. Says what the drawing cannot carry. For quantities, not a construction drawing. Stateless: the request arrives and the answer goes back; nothing is stored. The body is at most 65,536 bytes (413 above it).

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `takeoff` | `string` | A takeoff the canvas draws, such as concrete-slab, stud-wall or asphalt-shingle-roof. |
| `measurements` | `object` | Measurement id → value, each length, area or volume with its unit ("12 ft", {"value": 3.6, "unit": "m"}); counts as numbers. Ids are those of the takeoff; any left out opens at the page's own figure. |
| `selection` | `object` | Build-up choice id → option id, the takeoff's own (a stud size, an insulation, a cladding). Choices left out take the page's own for the system. |
| `example` | `string` | Or a worked example the canvas draws, such as attached-deck-built. |
| `figures` | `object` | The job's own figures by id (a deck's length, a room's height), each length or area with its unit; a count as a number. They follow down every step that reads them. |
| `inputs` | `object` | One step's own input, keyed "<step index>.<input id>" ("3.wastePercent"), each with its unit where it has one. |
| `includeDocument` | `boolean` | Also return the canvas document itself (JSON). |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `market` | `string` | Optional. A market whose own opening choice some inputs take (a UK reader's code, an IEC motor), and whose currency symbol prints the caller's own money figures. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/canvas-link" \
  -H "Content-Type: application/json" \
  -d '{"takeoff":"concrete-slab","measurements":{"length":"6 m","width":"4 m","thickness":"100 mm"},"system":"metric"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/canvas-link", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "takeoff": "concrete-slab",
    "measurements": {
      "length": "6 m",
      "width": "4 m",
      "thickness": "100 mm"
    },
    "system": "metric"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/canvas-link",
    json={
        "takeoff": "concrete-slab",
        "measurements": {
            "length": "6 m",
            "width": "4 m",
            "thickness": "100 mm",
        },
        "system": "metric",
    },
)
answer = response.json()
```

### POST`/v1/illustration`

Topic illustration (SVG) of a guide, comparison or page

Returns the topic illustration a page of the site carries: the SVG's address, its subject in words and its licence. One per guide, comparison, diagnosis, example, category, material and solve-backwards question; a shared plate for the glossary, methods, policies, standards and tools. Stateless: the request arrives and the answer goes back; nothing is stored. The body is at most 65,536 bytes (413 above it).

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `family`obligatorio | `any` | The kind of page the drawing belongs to. |
| `slug` | `string` | The page's slug; left out, the family's own plate. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/illustration" \
  -H "Content-Type: application/json" \
  -d '{"family":"guides","slug":"how-to-anchor-into-concrete"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/illustration", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "family": "guides",
    "slug": "how-to-anchor-into-concrete"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/illustration",
    json={
        "family": "guides",
        "slug": "how-to-anchor-into-concrete",
    },
)
answer = response.json()
```

### POST`/v1/formula`

Look up a construction formula: equation, symbols, units

Reads the open formula library (/formulas/): volume, area, coverage and spread rate, spacing and count, bulking, stairs, roof pitch and slope, unit conversions. Each formula's equation, every symbol with its meaning and unit in both systems, the calculators it is bound to and the test vectors it reproduces; find one by id, words or a calculator's slug, and work it on your own values. Arithmetic, not a design. Stateless: the request arrives and the answer goes back; nothing is stored.

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `id` | `string` | A formula id (cylinder-volume, riser-count …) or a family id (volume-from-geometry, stairs …). Left out with no calculator and no query: the library's families and their formulas. |
| `calculator` | `string` | A calculator's slug: the formulas it runs. |
| `query` | `string` | Words to find a formula by ("volume of a cylinder", "roof pitch to degrees"). |
| `values` | `object` | With a formula id: each input variable's value, by its id, in the unit of \`system\` (metric column when left out), to evaluate the equation. |
| `system` | `string` | The column \`values\` are read in, and the evaluated answer printed first; both are returned. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/formula" \
  -H "Content-Type: application/json" \
  -d '{"id":"cylinder-volume","values":{"d":0.3,"h":1.2}}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/formula", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "id": "cylinder-volume",
    "values": {
      "d": 0.3,
      "h": 1.2
    }
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/formula",
    json={
        "id": "cylinder-volume",
        "values": {
            "d": 0.3,
            "h": 1.2,
        },
    },
)
answer = response.json()
```

### POST`/v1/guide`

Find a how-to guide and the calculators it uses

Finds the site's how-to guides (how to pour a slab, frame a wall, tile a floor, insulate a loft …) by words, slug or calculator: each guide's title, summary, trade, address, the link to its full text as Markdown, and the calculators it works its figures with. It finds and links; it computes nothing. Stateless: the request arrives and the answer goes back; nothing is stored.

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `slug` | `string` | A guide's slug, such as how-to-pour-a-concrete-slab. |
| `query` | `string` | Words to find guides by, such as "pour a slab" or "insulate a loft". |
| `calculator` | `string` | A calculator's slug: the guides that work with it. |
| `limit` | `integer` | At most this many guides for a query or a calculator. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/guide" \
  -H "Content-Type: application/json" \
  -d '{"query":"pour a concrete slab","limit":3}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/guide", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "query": "pour a concrete slab",
    "limit": 3
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/guide",
    json={
        "query": "pour a concrete slab",
        "limit": 3,
    },
)
answer = response.json()
```

## Corte

Corner trim on the reader's saw, a room's trim plan, the scribe template and the other full-size templates, a panel or worktop fitted to walls that are not square, and the mitre saw chart: cutting geometry and quantities, never sized.

### POST`/v1/trim-corner`

Corner trim on your saw: mitre, bevel, stops and the gap

Cuts one corner of skirting, casing or crown molding on a named saw: per piece the mitre and bevel as its dials read, the stop each sits on, how the piece lies, which side to keep, whether the saw can make it; cope or mitre, and the gap a 45° cut leaves. No sizing. Stateless: the request arrives and the answer goes back; nothing is stored.

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `trim`obligatorio | `any` | skirting (baseboard), casing (architrave, a frame corner) or crown (cornice). |
| `corner` | `object` | The corner as measured. For casing, the frame corner (90 for a square opening); its kind is ignored. |
| `throughRoom` | `number` | In place of corner: the angle read through the room (under 180 inside, over 180 outside), as the miter-angle calculator takes it. |
| `method` | `any` | How the piece goes on the saw: skirting and casing upright (against the fence) or flat (on the table); crown nested (upside down against the fence) or flat. Left out, the trim's usual one. |
| `saw` | `any` | The saw from the site's library (each with its scale, its stops and its capacity); custom with customSaw. Left out, the 12-in double-bevel slider (DWS779 figures). |
| `customSaw` | `object` | With saw custom: the saw's own limits. |
| `spring` | `number` | Crown only: its spring angle from the wall, degrees (38 for 38/52, 45 for 45/45). Left out, 38. |
| `depth` | `number \| string \| object` | The depth the joint runs across in the plane of the turn: a skirting's thickness, a casing's face width, a crown's projection. Left out: 18 mm, 70 mm or 75 mm (3/4, 2 3/4 or 3 in). |
| `height` | `number \| string \| object` | Skirting only: its height, for the saw's upright capacity. Left out, 120 mm (4 3/4 in). |
| `buildUp` | `number \| string \| object` | Plaster or compound built up in the corner (it changes the angle the trim meets). Left out, none. |
| `feather` | `number \| string \| object` | The distance that build-up is feathered over along each wall. Left out, 150 mm (6 in). |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/trim-corner" \
  -H "Content-Type: application/json" \
  -d '{"trim":"skirting","corner":{"kind":"inside","angle":92},"saw":"double-bevel","system":"metric"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/trim-corner", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "trim": "skirting",
    "corner": {
      "kind": "inside",
      "angle": 92
    },
    "saw": "double-bevel",
    "system": "metric"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/trim-corner",
    json={
        "trim": "skirting",
        "corner": {
            "kind": "inside",
            "angle": 92,
        },
        "saw": "double-bevel",
        "system": "metric",
    },
)
answer = response.json()
```

### POST`/v1/room-trim`

Room trim plan: every piece, its ends and the stock

Plans trim round a room, piece by piece, from its corners, door openings and built-ins (or a drawn room): each piece in fitting order with its long and short point lengths, each end's cope, mitre, butt or scarf with its saw settings, the cut list and the trim lengths to buy. Stateless: the request arrives and the answer goes back; nothing is stored.

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `walls` | `array of object` | The walls in order round the room, up to 40, each with its length along the wall face (corner to corner). |
| `corners` | `array of object` | corners\[i\] is at the end of walls\[i\], where it meets the next wall (one per wall; the last closes the room). |
| `direction` | `any` | cw (the default): facing each wall from the room, working left to right. ccw: the canvas's order. |
| `drawing` | `object` | In place of walls and corners: a Construction Canvas drawing in any form the drawing tool takes ({ document }, { commands }, { template }, { house }, { shapes }, { layout }); the room's inside faces, corners and doors are read from it as the canvas's Trim plan reads them. |
| `room` | `string` | With drawing: the room's id (R1 …). Left out, the drawing's only room. |
| `trim` | `any` | Left out, skirting. |
| `method` | `any` | How the piece goes on the saw: skirting and casing upright (against the fence) or flat (on the table); crown nested (upside down against the fence) or flat. Left out, the trim's usual one. |
| `saw` | `any` | The saw profile the room plan's settings are read on (as the plan on the page): a mitre saw that tilts both ways (the default), one that tilts left only, or a mitre box with 90° at square. |
| `spring` | `number` | Crown only: its spring angle from the wall, degrees (38 for 38/52, 45 for 45/45). Left out, 38. |
| `depth` | `number \| string \| object` | The trim's depth across the joint (skirting thickness, crown projection). Left out, 18 mm (3/4 in) or 75 mm (3 in) for crown. |
| `buildUp` | `number \| string \| object` | Plaster built up in the corners. Left out, none. |
| `casing` | `number \| string \| object` | The door casing's width a skirting butts to beside a door. Left out, none (it butts to the opening's edge). |
| `start` | `integer` | The wall fitted first (index). Left out, 0. |
| `insideJoint` | `any` | Inside corners coped (the default) or mitred. |
| `stock` | `array of number \| string \| object` | The stock lengths on offer, with units. Left out, the market's usual trim lengths. |
| `kerf` | `number \| string \| object` | The saw's kerf. Left out, 3 mm (1/8 in). |
| `minOffcut` | `number \| string \| object` | Offcuts at least this long are kept. |
| `studs` | `object` |  |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/room-trim" \
  -H "Content-Type: application/json" \
  -d '{"walls":[{"label":"North","length":"4 m"},{"label":"East","length":"3 m","openings":[{"kind":"door","start":"0.4 m","width":"0.8 m"}]},{"label":"South","length":"4 m"},{"label":"West","length":"3 m"}],"corners":[{"kind":"inside","angle":90},{"kind":"inside","angle":91},{"kind":"inside","angle":89},{"kind":"inside","angle":90}],"trim":"skirting","system":"metric"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/room-trim", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "walls": [
      {
        "label": "North",
        "length": "4 m"
      },
      {
        "label": "East",
        "length": "3 m",
        "openings": [
          {
            "kind": "door",
            "start": "0.4 m",
            "width": "0.8 m"
          }
        ]
      },
      {
        "label": "South",
        "length": "4 m"
      },
      {
        "label": "West",
        "length": "3 m"
      }
    ],
    "corners": [
      {
        "kind": "inside",
        "angle": 90
      },
      {
        "kind": "inside",
        "angle": 91
      },
      {
        "kind": "inside",
        "angle": 89
      },
      {
        "kind": "inside",
        "angle": 90
      }
    ],
    "trim": "skirting",
    "system": "metric"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/room-trim",
    json={
        "walls": [
            {
                "label": "North",
                "length": "4 m",
            },
            {
                "label": "East",
                "length": "3 m",
                "openings": [
                    {
                        "kind": "door",
                        "start": "0.4 m",
                        "width": "0.8 m",
                    },
                ],
            },
            {
                "label": "South",
                "length": "4 m",
            },
            {
                "label": "West",
                "length": "3 m",
            },
        ],
        "corners": [
            {
                "kind": "inside",
                "angle": 90,
            },
            {
                "kind": "inside",
                "angle": 91,
            },
            {
                "kind": "inside",
                "angle": 89,
            },
            {
                "kind": "inside",
                "angle": 90,
            },
        ],
        "trim": "skirting",
        "system": "metric",
    },
)
answer = response.json()
```

### POST`/v1/scribe-template`

Scribe template: the scribe line full size, SVG and DXF

Turns gaps measured off a straight line into a scribe line for an uneven surface: the widest and narrowest gap, the width to start from, the strip to cut away, the line as full-size SVG and DXF, and its print layout on A4, Letter or a roll. A pattern, not a fit. Stateless: the request arrives and the answer goes back; nothing is stored.

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `readings` | `array of object` | The gaps measured from a straight reference line to the wall: up to 200 stations, each where it is along the line and the gap there. |
| `shape` | `object` |  |
| `allowance` | `number \| string \| object` | Board left beyond the widest gap. Left out, 10 mm (3/8 in). |
| `paper` | `any` | The paper the full-size template is tiled on. Left out, A4 for metric and Letter for imperial. |
| `rollWidth` | `number \| string \| object` | With paper roll: the roll's width. |
| `overlap` | `number \| string \| object` | Between adjacent sheets. Left out, the tiler's own. |
| `orientation` | `any` |  |
| `formats` | `array of any` | The drawings to return. Left out, both. |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/scribe-template" \
  -H "Content-Type: application/json" \
  -d '{"readings":[{"at":"0 mm","gap":"4 mm"},{"at":"300 mm","gap":"11 mm"},{"at":"600 mm","gap":"15 mm"},{"at":"900 mm","gap":"9 mm"},{"at":"1200 mm","gap":"3 mm"}],"allowance":"10 mm","formats":["svg"],"system":"metric"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/scribe-template", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "readings": [
      {
        "at": "0 mm",
        "gap": "4 mm"
      },
      {
        "at": "300 mm",
        "gap": "11 mm"
      },
      {
        "at": "600 mm",
        "gap": "15 mm"
      },
      {
        "at": "900 mm",
        "gap": "9 mm"
      },
      {
        "at": "1200 mm",
        "gap": "3 mm"
      }
    ],
    "allowance": "10 mm",
    "formats": [
      "svg"
    ],
    "system": "metric"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/scribe-template",
    json={
        "readings": [
            {
                "at": "0 mm",
                "gap": "4 mm",
            },
            {
                "at": "300 mm",
                "gap": "11 mm",
            },
            {
                "at": "600 mm",
                "gap": "15 mm",
            },
            {
                "at": "900 mm",
                "gap": "9 mm",
            },
            {
                "at": "1200 mm",
                "gap": "3 mm",
            },
        ],
        "allowance": "10 mm",
        "formats": [
            "svg",
        ],
        "system": "metric",
    },
)
answer = response.json()
```

### POST`/v1/fit-panel`

Fit a worktop, shelf or panel to walls that are not square

The true shape of a worktop, shelf or panel between walls that are not square: front and back lengths, setbacks, diagonals and the blank with scribe and bow, then the blank and any other parts nested on stock: part ids, grain, cut order, offcuts and edge banding. Geometry only. Stateless: the request arrives and the answer goes back; nothing is stored.

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `kind` | `any` | worktop (the default): worktop lengths. shelf: shelf boards. board: full sheets of plywood or board. |
| `span`obligatorio | `number \| string \| object` | Wall to wall (or to the free end), along the back wall, or along the front line with measuredAt front. |
| `leftAngle` | `number` | The room's inside angle between the back wall and the left wall, degrees; 90 square. Left out, 90. |
| `rightAngle` | `number` |  |
| `leftEnd` | `any` | open: a free end, cut square. |
| `rightEnd` | `any` |  |
| `measuredAt` | `any` |  |
| `backWall` | `boolean` | Is there a wall along the back? Left out, yes. |
| `depth` | `number \| string \| object` | The finished depth, front edge to back wall. Left out, the kind's usual. |
| `scribe` | `number \| string \| object` | Left on every edge that meets a wall, to scribe off in place. Left out, the kind's usual. |
| `gap` | `number \| string \| object` | Left clear at each wall end. Left out, the kind's usual. |
| `bow` | `number \| string \| object` | The back wall's greatest departure from straight. Left out, none. |
| `count` | `integer` | How many of the fitted piece. Left out, 1. |
| `label` | `string` |  |
| `parts` | `array of object` | Other parts nested on the same boards (a carcass's sides and shelves). |
| `stock` | `integer` | An index into the kind's stock sizes for the market (listed in the answer's stockOffered). Left out, the size that buys least. |
| `sheet` | `object` |  |
| `kerf` | `number \| string \| object` | The saw's kerf. Left out, 3 mm (1/8 in). |
| `trim` | `number \| string \| object` | Cut off every board edge before nesting. Left out, the kind's own (10 mm on a full sheet). |
| `mode` | `any` | guillotine (the default): every cut edge to edge, for a panel or track saw. free: also layouts needing plunge cuts (CNC). |
| `grain` | `boolean` | Hold the grain or decor along the run (the default). |
| `bandFront` | `boolean` | Band the front edge of the fitted piece. |
| `bandAllowance` | `number \| string \| object` | Tape added to every banded edge for trimming flush. |
| `minOffcut` | `number \| string \| object` | An offcut is listed for reuse when it is at least this big either way. |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/fit-panel" \
  -H "Content-Type: application/json" \
  -d '{"kind":"worktop","span":"2.4 m","leftAngle":91,"rightAngle":88.5,"bow":"6 mm","system":"metric"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/fit-panel", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "kind": "worktop",
    "span": "2.4 m",
    "leftAngle": 91,
    "rightAngle": 88.5,
    "bow": "6 mm",
    "system": "metric"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/fit-panel",
    json={
        "kind": "worktop",
        "span": "2.4 m",
        "leftAngle": 91,
        "rightAngle": 88.5,
        "bow": "6 mm",
        "system": "metric",
    },
)
answer = response.json()
```

### POST`/v1/worktop-run`

Worktop run round corners: pieces, joints and lengths

A worktop along several wall faces, as the Construction Canvas cuts it: each piece's true shape at the room's real angles, butt or mitre joints at corners, long straights joined, the front run and free ends, and the blanks nested on worktop lengths with the cut order and banding. Not sized. Stateless: the request arrives and the answer goes back; nothing is stored.

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `faces`obligatorio | `array of object` | The wall faces the run follows, in order, each with its length along the wall. |
| `corners` | `array of object` | Between face i and face i + 1 (one fewer than the faces): inside or outside, the room's inside angle, and how the pieces meet. |
| `start` | `object` |  |
| `finish` | `object` |  |
| `depth` | `number \| string \| object` | The finished depth, front edge to back wall. Left out, the kind's usual. |
| `scribe` | `number \| string \| object` | Left on every edge that meets a wall, to scribe off in place. Left out, the kind's usual. |
| `gap` | `number \| string \| object` | Left clear at each wall end. Left out, the kind's usual. |
| `bow` | `number \| string \| object` | The back wall's greatest departure from straight. Left out, none. |
| `jointAt` | `number \| string \| object` | Where a straight longer than the stock is joined, along its back from its start. Left out, an even split. |
| `jointsAt` | `array of number \| string \| object` | A joint position per straight, in run order (faces in line make one straight): where that straight is joined, along its back from its start, if it is longer than the stock. "0 mm" splits it evenly; a straight past the end of the list takes jointAt. |
| `stock` | `integer` | An index into the kind's stock sizes for the market (listed in the answer's stockOffered). Left out, the size that buys least. |
| `kerf` | `number \| string \| object` | The saw's kerf. Left out, 3 mm (1/8 in). |
| `grain` | `boolean` | Hold the grain or decor along the run (the default). |
| `bandFront` | `boolean` | Band the front edge of the fitted piece. |
| `bandAllowance` | `number \| string \| object` | Tape added to every banded edge for trimming flush. |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/worktop-run" \
  -H "Content-Type: application/json" \
  -d '{"faces":[{"length":"3 m","label":"Back"},{"length":"2.2 m","label":"Side"}],"corners":[{"kind":"inside","angle":90}],"start":{"end":"wall","angle":90},"finish":{"end":"open"},"system":"metric"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/worktop-run", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "faces": [
      {
        "length": "3 m",
        "label": "Back"
      },
      {
        "length": "2.2 m",
        "label": "Side"
      }
    ],
    "corners": [
      {
        "kind": "inside",
        "angle": 90
      }
    ],
    "start": {
      "end": "wall",
      "angle": 90
    },
    "finish": {
      "end": "open"
    },
    "system": "metric"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/worktop-run",
    json={
        "faces": [
            {
                "length": "3 m",
                "label": "Back",
            },
            {
                "length": "2.2 m",
                "label": "Side",
            },
        ],
        "corners": [
            {
                "kind": "inside",
                "angle": 90,
            },
        ],
        "start": {
            "end": "wall",
            "angle": 90,
        },
        "finish": {
            "end": "open",
        },
        "system": "metric",
    },
)
answer = response.json()
```

### POST`/v1/miter-chart`

Mitre saw angle chart: corners from 80° to 150°

The mitre saw chart for trim corners: per corner angle the mitre each piece takes, the outside corner read through the room, the gap a 45° cut leaves on 18 mm and 3/4 in trim and where it opens, crown laid flat (38/52 and 45/45) mitre and bevel, and the handing table. Any corners on request. Stateless: the request arrives and the answer goes back; nothing is stored.

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `angles` | `array of number` | The corners θ to chart, degrees. Left out, the site's chart: 80° to 100° in half degrees, then 120°, 135° and 150°. |
| `handing` | `boolean` | Include the handing table (which way each piece swings and tilts at a square corner). Left out, yes. |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/miter-chart" \
  -H "Content-Type: application/json" \
  -d '{"angles":[88,90,92,135],"handing":false,"system":"metric"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/miter-chart", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "angles": [
      88,
      90,
      92,
      135
    ],
    "handing": false,
    "system": "metric"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/miter-chart",
    json={
        "angles": [
            88,
            90,
            92,
            135,
        ],
        "handing": False,
        "system": "metric",
    },
)
answer = response.json()
```

### POST`/v1/print-template`

Full-size print template as SVG and DXF

The full-size template a calculator page prints: a stair stringer or step gauge, rafter cuts, a cone or frustum pattern, an arch's centring or voussoirs, an anchor bolt setting jig or plate, a curved plate, a spiral stair's tread, winder blanks, a housed or ladder stringer, a split stair's stringers, a handrail gooseneck; lines as SVG and DXF, its checks and omissions, its tiling on paper. Stateless: the request arrives and the answer goes back; nothing is stored.

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `calculator`obligatorio | `any` | The calculator whose page offers the template: a stair stringer and step gauge, a rafter, a cone or frustum pattern, a curved wall's plate, an anchor bolt setting board or plate, an arch's centring or voussoirs; a spiral stair's tread or landing, a turn's winder blanks, a housed string or ship's ladder stringer, a split stair's stringers, a handrail's gooseneck. |
| `inputs` | `object` | The calculator's own inputs by id, with their units, as its page takes them; left out, the values its page opens on. |
| `kind` | `string` | Which of the family's two templates: stringer gauge or whole; rafter cuts or whole; cone whole or half; arch centring or voussoirs; bolts setting or plate; plate segment or whole; spiral tread or landing; winders each or turn; housed and ladder gauge or whole; split first, return or gauge; gooseneck turn or pieces. Left out, the first. |
| `fields` | `object` | The template's own figures by id (a stringer's board depth and tread thickness, a cone's lap …), with units; left out, the page's defaults for the system (or the calculator's own figure where the page opens on it). The answer lists them. |
| `paper` | `any` | Left out, A4 for metric and Letter for imperial. |
| `rollWidth` | `number \| string \| object` | With paper roll: the roll's width. |
| `overlap` | `number \| string \| object` | Between adjacent sheets. Left out, 10 mm. |
| `orientation` | `any` |  |
| `formats` | `array of any` | The drawings to return. Left out, both. |
| `system` | `string` | The unit system inputs left out open in, and the one the page link opens in. The answer comes in both. |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/print-template" \
  -H "Content-Type: application/json" \
  -d '{"calculator":"stair-stringer-calculator","kind":"gauge","formats":["svg"],"system":"metric"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/print-template", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "calculator": "stair-stringer-calculator",
    "kind": "gauge",
    "formats": [
      "svg"
    ],
    "system": "metric"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/print-template",
    json={
        "calculator": "stair-stringer-calculator",
        "kind": "gauge",
        "formats": [
            "svg",
        ],
        "system": "metric",
    },
)
answer = response.json()
```

### POST`/v1/roof-framing`

Roof framing: rafter lengths, cuts, birdsmouth and templates

Lays out a gable or hip roof (optionally a gable wing with valleys) from the caller's own sizes: each common, hip, valley and jack rafter's length along the line, birdsmouth and HAP, plumb and cheek cuts as saw settings, hip backing, a cut list on the caller's stock, and a member's full-size template as SVG and DXF; both systems. Geometry only: it does not size structure. Stateless: the request arrives and the answer goes back; nothing is stored.

También acepta `detail, format`: los parámetros que acepta toda ruta.

Cuerpo de la solicitud (JSON), obligatorio

| Campo | Tipo | Descripción |
|---|---|---|
| `kind` | `any` | gable or hip (default hip). |
| `span` | `number \| string \| object` | Building width across the ridge, outside faces of the wall plates ("24 ft", "8 m"). |
| `length` | `number \| string \| object` | Building length along the ridge. |
| `pitch` | `number` | Rise per 12 of run (6 for 6/12). Or give pitchDegrees. |
| `pitchDegrees` | `number` | The pitch in degrees, as an alternative to pitch. |
| `overhang` | `number \| string \| object` | Level, from the wall's outer face to the tail's plumb cut. |
| `rake` | `number \| string \| object` | Gable ends (and a wing's gable end): how far the roof runs past the gable wall. |
| `rafterDepth` | `number \| string \| object` | Actual depth of the commons and jacks (a 2×8 is "7.25 in"). |
| `rafterThickness` | `number \| string \| object` | Actual thickness of the commons and jacks ("1.5 in", "45 mm"). |
| `hipDepth` | `number \| string \| object` | Actual depth of the hips and valleys. |
| `hipThickness` | `number \| string \| object` | Actual thickness of the hips and valleys. |
| `ridgeThickness` | `number \| string \| object` | The ridge board's thickness. |
| `plateWidth` | `number \| string \| object` | The wall plate's width (the seat bears on it). |
| `heightAbovePlate` | `number \| string \| object` | The commons' height above the plate (HAP); left out, the seat bears on the whole plate. |
| `hipTop` | `any` | Drop the hips and leave them square (default), or back them. |
| `spacing` | `number \| string \| object` | Rafter centres along the plate ("16 in", "600 mm"). |
| `fasciaThickness` | `number \| string \| object` | The fascia board's thickness. |
| `wing` | `object` | An equal-pitch gable wing on the front wall: gives the valleys, valley jacks and cripples. |
| `stock` | `array of number \| string \| object` | The stock lengths the caller can buy, each with its unit; left out, the page's list for the system. |
| `kerf` | `number \| string \| object` | Saw kerf, charged on every cut (default 1/8 in or 3 mm). |
| `template` | `object` | One member as a full-size template (1:1, millimetres). |
| `system` | `string` | The system figures are read in and printed first (both are returned). |
| `inputUnits` | `string` | Send "base" to pass bare numbers on dimensioned inputs in base units (m, m², L, kg …), as the published test vectors are written. Without it a length, area or volume must carry its unit. |

_curl_

```
curl -s -X POST "https://api.craftquantities.com/v1/roof-framing" \
  -H "Content-Type: application/json" \
  -d '{"kind":"hip","span":"24 ft","length":"40 ft","pitch":6,"overhang":"12 in","rafterDepth":"7.25 in","rafterThickness":"1.5 in","hipDepth":"9.25 in","hipThickness":"1.5 in","ridgeThickness":"1.5 in","plateWidth":"3.5 in","spacing":"16 in","stock":["8 ft","10 ft","12 ft","14 ft","16 ft","18 ft","20 ft"],"system":"imperial"}'
```

_JavaScript_

```
const response = await fetch("https://api.craftquantities.com/v1/roof-framing", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "kind": "hip",
    "span": "24 ft",
    "length": "40 ft",
    "pitch": 6,
    "overhang": "12 in",
    "rafterDepth": "7.25 in",
    "rafterThickness": "1.5 in",
    "hipDepth": "9.25 in",
    "hipThickness": "1.5 in",
    "ridgeThickness": "1.5 in",
    "plateWidth": "3.5 in",
    "spacing": "16 in",
    "stock": [
      "8 ft",
      "10 ft",
      "12 ft",
      "14 ft",
      "16 ft",
      "18 ft",
      "20 ft"
    ],
    "system": "imperial"
  }),
});
const answer = await response.json();
```

_Python_

```
import requests

response = requests.post(
    "https://api.craftquantities.com/v1/roof-framing",
    json={
        "kind": "hip",
        "span": "24 ft",
        "length": "40 ft",
        "pitch": 6,
        "overhang": "12 in",
        "rafterDepth": "7.25 in",
        "rafterThickness": "1.5 in",
        "hipDepth": "9.25 in",
        "hipThickness": "1.5 in",
        "ridgeThickness": "1.5 in",
        "plateWidth": "3.5 in",
        "spacing": "16 in",
        "stock": [
            "8 ft",
            "10 ft",
            "12 ft",
            "14 ft",
            "16 ft",
            "18 ft",
            "20 ft",
        ],
        "system": "imperial",
    },
)
answer = response.json()
```

En esta página

De un vistazo

**Operaciones**

65

**Grupos**

14

**OpenAPI**

3.1

**Clave o cuenta**

Ninguna

Descargar

- [Descripción OpenAPI (JSON)](https://api.craftquantities.com/openapi.json)
- [Colección de Postman](https://craftquantities.com/developers/craftquantities.postman_collection.json)

Direcciones

- MCP`api.craftquantities.com/mcp`
- REST`api.craftquantities.com/v1`
- Archivos`craftquantities.com/api/v1`
- OpenAPI [api.craftquantities.com/openapi.json](https://api.craftquantities.com/openapi.json)

Compruebe antes de integrar

- [Cómo se comprueban los cálculos](https://craftquantities.com/validation/)
- [Los vectores como banco de pruebas](https://craftquantities.com/benchmark/)
- [Estado del servicio](https://craftquantities.com/status/)
- [O incruste una calculadora](https://craftquantities.com/es/embeds/)
- [Citar / datos abiertos](https://craftquantities.com/es/developers/open-data/)

[Inicio](https://craftquantities.com/es/)

Desarrolladores

Desarrolladores e integraciones

- [Resumen y llamada en vivo](https://craftquantities.com/es/developers/)
- [Referencia de la API](https://craftquantities.com/es/developers/api-reference/)
- [API JSON estática](https://craftquantities.com/api/)
- [Datos abiertos y cómo citarlos](https://craftquantities.com/es/developers/open-data/)
- [Servidor MCP remoto](https://craftquantities.com/es/developers/mcp/)
- [Paquete npm](https://craftquantities.com/es/developers/npm/)
- [Línea de comandos](https://craftquantities.com/es/developers/cli/)
- [WebMCP en el navegador](https://craftquantities.com/es/developers/webmcp/)
- [Claude y ChatGPT](https://craftquantities.com/es/ai/)
- [Incrustaciones y WordPress](https://craftquantities.com/es/embeds/)
- [Extensión del navegador](https://craftquantities.com/es/tools/browser-extension/)
- [Registro de cambios](https://craftquantities.com/es/developers/changelog/)
- [Estado del servicio](https://craftquantities.com/status/)

En esta página

- Antes de la primera solicitud
- Búsqueda
- Calculadoras
- Unidades
- Cuantificaciones
- Ejemplos resueltos
- Planificador
- Casa y lienzo
- Presupuestos
- Archivos de proyecto
- Resolver al revés
- Diagnósticos y documentos
- Banco de pruebas
- Herramientas para agentes
- Corte

---
Fuente: https://craftquantities.com/es/developers/api-reference/
Craft Quantities: libre para leer, citar y enlazar; las páginas no tienen licencia para volver a publicarse. Solo cantidades: sin precios, sin diseño y sin certificación.
