Get a template's fields
#!/usr/bin/env bashset -euo pipefailAPI=https://api.speccapture.comAUTH="Authorization: Bearer $SPECCAPTURE_API_KEY"
TEMPLATE_ID=c2b8f3a1-7e5d-4c9a-8f6b-1a2d3e4f5a6b # drawing, or a templateId from the list of templates
template=$(curl -sS --fail-with-body "$API/v1/templates/$TEMPLATE_ID" \ -H "$AUTH") || { echo "$template" >&2; exit 1; }jq -r '"\(.name), version \(.version):"' <<<"$template"
jq -r '.fields[] as $field | " \($field.path) is called \"\($field.name)\""' <<<"$template"using System.Text.Json;
using HttpClient http = new() { BaseAddress = new Uri("https://api.speccapture.com") };http.DefaultRequestHeaders.Authorization = new("Bearer", Environment.GetEnvironmentVariable("SPECCAPTURE_API_KEY"));
string templateId = args[0]; // drawing, or a templateId from the list of templates
JsonElement template = await Json(await Call(HttpMethod.Get, $"/v1/templates/{templateId}"));Console.WriteLine($"{template.GetProperty("name")}, version {template.GetProperty("version")}:");
foreach (JsonElement field in template.GetProperty("fields").EnumerateArray()) { Console.WriteLine($" {field.GetProperty("path")} is called \"{field.GetProperty("name")}\"");}
// Sends a request; stops with the problem's code and detail if the API refuses it.async Task<HttpResponseMessage> Call(HttpMethod method, string path, HttpContent? body = null, string? idempotencyKey = null) { using HttpRequestMessage request = new(method, path) { Content = body }; if (idempotencyKey is not null) request.Headers.Add("Idempotency-Key", idempotencyKey); HttpResponseMessage response = await http.SendAsync(request); if (!response.IsSuccessStatusCode) { JsonElement problem = await Json(response); string? detail = (problem.TryGetProperty("detail", out JsonElement text) ? text : problem.GetProperty("title")).GetString(); Console.Error.WriteLine($"{(int)response.StatusCode} {problem.GetProperty("code")}: {detail}"); Environment.Exit(1); } return response;}
// Reads an answer as JSON.static async Task<JsonElement> Json(HttpResponseMessage response) => JsonDocument.Parse(await response.Content.ReadAsStringAsync()).RootElement;import osimport sys
import requests
API = "https://api.speccapture.com"session = requests.Session()session.headers["Authorization"] = f"Bearer {os.environ['SPECCAPTURE_API_KEY']}"
def call(method, path, **kwargs): """Send a request; stop with the problem's code and detail if the API refuses it.""" response = session.request(method, API + path, **kwargs) if not response.ok: problem = response.json() sys.exit(f"{response.status_code} {problem['code']}: {problem.get('detail', problem['title'])}") return response
template_id = sys.argv[1] # drawing, or a templateId from the list of templates
template = call("GET", f"/v1/templates/{template_id}").json()print(f"{template['name']}, version {template['version']}:")
for field in template["fields"]: print(f" {field['path']} is called \"{field['name']}\"")const API = "https://api.speccapture.com";const headers = { Authorization: `Bearer ${process.env.SPECCAPTURE_API_KEY}` };
const [templateId] = process.argv.slice(2); // drawing, or a templateId from the list of templates
const template = await call("GET", `/v1/templates/${templateId}`).then((response) => response.json());console.log(`${template.name}, version ${template.version}:`);
for (const field of template.fields) { console.log(` ${field.path} is called "${field.name}"`);}
// Sends a request; stops with the problem's code and detail if the API refuses it.async function call(method, path, init = {}) { const response = await fetch(API + path, { ...init, method, headers: { ...headers, ...init.headers } }); if (!response.ok) { const problem = await response.json(); console.error(`${response.status} ${problem.code}: ${problem.detail ?? problem.title}`); process.exit(1); } return response;}Each field’s path (the key its values carry, never changed by a rename), name (the name on its values), standardName, order, required, alwaysCheck, section, definedBy and measured (measured for the four fields whose accuracy SpecCapture publishes, standard for the rest, notMeasured for sizes and counts); each table with its kept columns in order; the notes when delivered; and the export layout. Add ?version= for an earlier version: the one a job’s templateVersion names never changes.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Drawing, the standard template, or the id of one of the workspace’s own templates, as GET /v1/templates lists them.
Query Parameters
Section titled “Query Parameters”A published version of the template, from 1; its newest when left out. The version a job’s templateVersion names never changes.
Responses
Section titled “Responses”OK
One template, at one version: GET /v1/templates/{templateId}, the newest unless ?version= asks for an earlier one - the version a job names in its templateVersion keeps for good what it said.
object
drawing, or the workspace template’s id.
What the workspace calls it; “Standard” for drawing.
The version described.
The template’s newest version.
What a submission naming no template is delivered with.
True for a workspace template its owner archived: jobs read with it still name it, and nothing new can be.
speccapture for the standard template, workspace for the workspace’s own.
When this version was published; null for the standard template.
The standard template it configures: drawing.
That template’s version.
The single-valued fields a job delivers, in order.
One field a template delivers.
object
The key every value carries (titleBlock.partNumber, or custom.customerPartNumber for a field of the workspace’s own): never changed by a rename.
What the template calls it - the name on its values.
The standard template’s name for it; for a field of the workspace’s own, which has no standard name, its own name.
Its place among the template’s fields, from 1.
A drawing that does not give it waits for a person, with RequiredButNotFound. A part number or revision SpecCapture requires - the standard template’s, and one a template made from one of its presets requires, as the preset set it - waits only on a scan: on a drawing made on a computer, a value SpecCapture is sure is not printed is settled like any other, notPrinted.
Its value always waits for a person, whatever the workspace accepts automatically.
The heading the dashboard’s review list shows it under; null for its standard group.
speccapture for a field of the standard template; workspace for a field the workspace added, read beside the standard ones and never changing them.
What SpecCapture says about its accuracy: a field of the workspace’s own is notMeasured.
For a calculated field of the workspace’s own - one worked out from other values rather than read off the drawing - how, in words: How many rows in Bill of Materials, The total of Quantity in Bill of Materials. Each of its values carries workedOut saying what it came to. Left out for every other field.
The tables a job delivers, in order, each with the columns it keeps in order.
One table a template delivers.
object
Its key: bom, as each of its values’ paths begins (bom[0].partNumber).
What the template calls it (“Bill of Materials”, or the workspace’s own name).
The standard template’s name for it.
The column that numbers or names its rows (item): always kept. Null for a table whose rows have no such column.
The columns it keeps, in order.
One column a table keeps: its key in each row’s cells, and its name.
object
Its key in each row’s cells: partNumber.
What the template calls it - the name on its values.
The standard template’s name for it.
How the CSV and XLSX exports lay values out, in two words: full when each value carries its review state, valuesOnly when it does not. output says exactly what the files hold.
What the template’s exports and its /values answers hold: the extras beside each value, the JSON’s shape, keys and numbers, and the spreadsheets’ rows.
object
What each value carries beside it, in this order: sheetDetails (each sheet’s status, engine version and when it was read), asRead (what was read, beside a correction), reviewState (its review state and reasons; without it, a value still waiting for a person is left blank and named as waiting), confidence, box and quote (the text on the drawing it was read from). Empty for plain values.
The JSON export: flat (each field its key, each table an array of rows, the notes an array), nested (the fields grouped by section) or complete (the job and every sheet exactly as GET /v1/extractions/{jobId} and its sheets answer). /values is flat for a template whose JSON is complete.
names (the template’s names for its fields, tables and columns) or paths (SpecCapture’s keys, which a rename never changes).
text (every value as text) or numbers (a count or quantity that is a plain whole number as a JSON number, and a number or dimension field of the workspace’s own that is a plain number, its digits as delivered).
The CSV and Excel files’ single-valued fields: perSheet (one row per sheet, a column per field) or perValue (one row per value).
Examples
The workspace's own template: its fields under its own names, its parts list and its notes
{ "templateId": "c2b8f3a1-7e5d-4c9a-8f6b-1a2d3e4f5a6b", "name": "ERP import", "version": 3, "currentVersion": 3, "isDefault": true, "archived": false, "definedBy": "workspace", "publishedAt": "2026-10-02T15:04:00+00:00", "basedOn": "drawing", "basedOnVersion": 1, "fields": [ { "path": "titleBlock.partNumber", "name": "Part No.", "standardName": "Part Number", "order": 1, "required": true, "alwaysCheck": false, "section": null, "definedBy": "speccapture", "measured": "measured" }, { "path": "titleBlock.revision", "name": "Rev", "standardName": "Revision", "order": 2, "required": true, "alwaysCheck": false, "section": null, "definedBy": "speccapture", "measured": "measured" }, { "path": "titleBlock.title", "name": "Description", "standardName": "Title", "order": 3, "required": false, "alwaysCheck": false, "section": null, "definedBy": "speccapture", "measured": "standard" }, { "path": "titleBlock.materialSpec", "name": "Material", "standardName": "Material Specification", "order": 4, "required": false, "alwaysCheck": true, "section": null, "definedBy": "speccapture", "measured": "measured" }, { "path": "titleBlock.finish", "name": "Finish", "standardName": "Finish / Coating", "order": 5, "required": false, "alwaysCheck": false, "section": null, "definedBy": "speccapture", "measured": "measured" }, { "path": "titleBlock.drawnBy", "name": "Drawn by", "standardName": "Drawn By", "order": 6, "required": false, "alwaysCheck": false, "section": null, "definedBy": "speccapture", "measured": "standard" } ], "tables": [ { "path": "bom", "name": "Parts list", "standardName": "Bill of Materials", "keyColumn": "item", "columns": [ { "path": "item", "name": "Item", "standardName": "Item" }, { "path": "qty", "name": "Quantity", "standardName": "Quantity" }, { "path": "partNumber", "name": "Part Number", "standardName": "Part Number" }, { "path": "description", "name": "Description", "standardName": "Description" } ] } ], "notes": { "path": "generalNotes", "name": "General notes" }, "exportLayout": "valuesOnly", "output": { "include": [ "confidence", "quote" ], "jsonShape": "flat", "jsonKeys": "names", "jsonNumbers": "text", "spreadsheetRows": "perSheet" }}Bad Request: a problem with a stable code. See Errors for every code and what to do about it.
Every error: a problem with a stable code. https://speccapture.com/docs/api/errors lists every code.
object
A link to the code’s entry in the docs.
What went wrong, in a few words for a person: the same for every problem with this code.
The HTTP status of the answer.
What went wrong with this request and what to do about it, in a sentence or two for a person. Present on nearly every problem.
The path of the request that was refused.
What went wrong, as a stable code to branch on: a published code never changes meaning.
This request’s trace: quote it when asking for help.
Examples
The request is not valid.
{ "type": "https://speccapture.com/docs/api/errors#invalid_request", "title": "The request is not valid.", "status": 400, "detail": "version is a published version: a whole number from 1.", "instance": "/v1/templates/c2b8f3a1-7e5d-4c9a-8f6b-1a2d3e4f5a6b", "code": "invalid_request", "traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01"}Not Found: a problem with a stable code. See Errors for every code and what to do about it.
Every error: a problem with a stable code. https://speccapture.com/docs/api/errors lists every code.
object
A link to the code’s entry in the docs.
What went wrong, in a few words for a person: the same for every problem with this code.
The HTTP status of the answer.
What went wrong with this request and what to do about it, in a sentence or two for a person. Present on nearly every problem.
The path of the request that was refused.
What went wrong, as a stable code to branch on: a published code never changes meaning.
This request’s trace: quote it when asking for help.
Examples
Not found.
{ "type": "https://speccapture.com/docs/api/errors#not_found", "title": "Not found.", "status": 404, "detail": "There is no template with this id in your workspace, or no such version of it. GET /v1/templates lists them.", "instance": "/v1/templates/c2b8f3a1-7e5d-4c9a-8f6b-1a2d3e4f5a6b", "code": "not_found", "traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01"}