Review links
A review link hands the review itself to someone with no seat in your workspace - a supplier’s checker, an inspector on the floor, a reviewer your ERP or QA system sends a drawing to. They open it with no sign-in, see the drawing with every value boxed, and accept, correct and confirm the values SpecCapture read, exactly as your own people do on the review screen. Nothing else of your workspace is reachable through it: no other drawing, no settings, no credits, no exports, no people, no keys.
POST /v1/extractions/{jobId}/review-links makes a link to every sheet of a job that was read; the job must have finished.
POST /v1/extractions/{jobId}/sheets/{sheetNumber}/review-links makes one to a single read sheet. Both answer 201 with
the link:
#!/usr/bin/env bashset -euo pipefailAPI=https://api.speccapture.comAUTH="Authorization: Bearer $SPECCAPTURE_API_KEY"
JOB_ID=7c9e6679-7425-40de-944b-e07fc1f90ae7 # the jobId the submission answered with
link=$(curl -sS --fail-with-body "$API/v1/extractions/$JOB_ID/review-links" \ -H "$AUTH" \ -H "Content-Type: application/json" \ -d '{"expiresInDays":30,"reviewerLabel":"Supplier incoming inspection"}') || { echo "$link" >&2; exit 1; }jq -r '"Send this to the one person who should check the drawing, until \(.expiresAt): \(.reviewUrl)"' <<<"$link"jq -r '"To withdraw it: \(.reviewLinkId)"' <<<"$link"Save as review_link.sh, set SPECCAPTURE_API_KEY, and run: bash review_link.sh. Needs curl; scripts also use bash and jq.
using System.Text;using System.Text.Json;using System.Text.Json.Nodes;
using HttpClient http = new() { BaseAddress = new Uri("https://api.speccapture.com") };http.DefaultRequestHeaders.Authorization = new("Bearer", Environment.GetEnvironmentVariable("SPECCAPTURE_API_KEY"));
string jobId = args[0]; // the jobId the submission answered with
StringContent body = new(new JsonObject { ["expiresInDays"] = 30, ["reviewerLabel"] = "Supplier incoming inspection",}.ToJsonString(), Encoding.UTF8, "application/json");JsonElement link = await Json(await Call(HttpMethod.Post, $"/v1/extractions/{jobId}/review-links", body));Console.WriteLine($"Send this to the one person who should check the drawing, until {link.GetProperty("expiresAt")}: {link.GetProperty("reviewUrl")}");Console.WriteLine($"To withdraw it: {link.GetProperty("reviewLinkId")}");
// 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;Save as review_link.cs, set SPECCAPTURE_API_KEY, and run: dotnet run review_link.cs -- 7c9e6679-7425-40de-944b-e07fc1f90ae7. Needs .NET 10 or later.
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
job_id = sys.argv[1] # the jobId the submission answered with
link = call( "POST", f"/v1/extractions/{job_id}/review-links", json={"expiresInDays": 30, "reviewerLabel": "Supplier incoming inspection"},).json()print(f"Send this to the one person who should check the drawing, until {link['expiresAt']}: {link['reviewUrl']}")print(f"To withdraw it: {link['reviewLinkId']}")Save as review_link.py, set SPECCAPTURE_API_KEY, and run: python review_link.py 7c9e6679-7425-40de-944b-e07fc1f90ae7. Needs Python 3.9+ and requests (pip install requests).
const API = "https://api.speccapture.com";const headers = { Authorization: `Bearer ${process.env.SPECCAPTURE_API_KEY}` };
const [jobId] = process.argv.slice(2); // the jobId the submission answered with
const link = await call("POST", `/v1/extractions/${jobId}/review-links`, { body: JSON.stringify({ expiresInDays: 30, reviewerLabel: "Supplier incoming inspection" }), headers: { "Content-Type": "application/json" },}).then((response) => response.json());console.log(`Send this to the one person who should check the drawing, until ${link.expiresAt}: ${link.reviewUrl}`);console.log(`To withdraw it: ${link.reviewLinkId}`);
// 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;}Save as review_link.mjs, set SPECCAPTURE_API_KEY, and run: node review_link.mjs 7c9e6679-7425-40de-944b-e07fc1f90ae7. Needs Node.js 20 or later.
- Who it is for:
reviewerLabel, up to 100 characters, says whom you made it for (“Acme incoming inspection”, a purchase order) - shown to them, and in the list of links. It is a note: SpecCapture never checks it. - Lifetime:
expiresInDaysfrom 1 to 90, or 30 when left out, and never later than the workspace keeps the drawing, as for a view link: a review without the drawing is no review. - Who reviewed: the link asks whoever opens it for their name (and, if they like, an email) once. Every value they
accept or correct is recorded with that name and the link it came through, and the value says so:
GET /v1/extractions/{jobId}/sheets/{sheetNumber}gives itreviewedThrough-{ reviewLinkId, name, email, reviewedAt }- while one of your own people’s reviews carries none. A name is the reviewer’s own word, not a sign-in: the link is the permission.
- One link, one person. Anyone holding the link can change the values it opens, so send each one to one person and make another for someone else. If a link is forwarded, every name given through it is recorded beside the link.
- When the review is done: each sheet whose last waiting value is checked sends an
extraction.reviewedwebhook, so your system can pick up the confirmed values. - Refusals: another workspace’s job, or a sheet number past the job’s
sheetCount, answers404 not_found. A sheet not read yet, a job still being read (for a whole-job link), a drawing past the workspace’s retention period, a workspace that keeps no drawings, or a sheet marked export-controlled that its workspace has not kept answers409 not_shareable, whosedetailsays which. A key acting as a member is refused with403 role_not_allowed. - Costs nothing: reviewing never spends credits.
- Listing them:
GET /v1/review-linkslists every review link the workspace made - through the API or the dashboard - newest first and a page at a time (Lists and paging);GET /v1/review-links/{reviewLinkId}reads one. Each says what it opens (jobId,sheetNumber- null for every read sheet - andfileName),reviewerLabel,status(active,expiredorwithdrawn), when it was made and expires, how often it was opened, who made it, how many values were reviewed through it (valuesReviewed), how many sheets and values it opens still wait for a person (sheetsWaiting,valuesWaiting:sheetsWaiting0 means its review is done), and the names its reviewers gave (reviewers: each reviewer once, a name with the email given with it - the same name given with another email is another reviewer, as the values they checked say), and what it opens as it stands (extractions: each job’sjobId,fileName,status,sheetsWaiting,valuesWaitingandvaluesReviewed). Never the link itself. One link for several jobs - made byPOST /v1/review-linksor the dashboard’s Send for review - is listed once, as the one link its holder was given:jobId,sheetNumberandfileNameare null,extractionsnames each job in the order sent,statusisactivewhile any job’s part of it works andwithdrawnonce every part was withdrawn, and its counts add its jobs’ up.
#!/usr/bin/env bashset -euo pipefailAPI=https://api.speccapture.comAUTH="Authorization: Bearer $SPECCAPTURE_API_KEY"
page=$(curl -sS --fail-with-body "$API/v1/review-links?status=active" \ -H "$AUTH") || { echo "$page" >&2; exit 1; }
jq -r '.data[] as $link | ("\($link.reviewLinkId): \($link.valuesReviewed) values reviewed, \($link.valuesWaiting) still waiting", $link.extractions[] as $extraction | " \($extraction.fileName): \($extraction.valuesWaiting) waiting")' <<<"$page"Save as review_links.sh, set SPECCAPTURE_API_KEY, and run: bash review_links.sh. Needs curl; scripts also use bash and jq.
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"));
JsonElement page = await Json(await Call(HttpMethod.Get, "/v1/review-links?status=active"));
foreach (JsonElement link in page.GetProperty("data").EnumerateArray()) { Console.WriteLine($"{link.GetProperty("reviewLinkId")}: {link.GetProperty("valuesReviewed")} values reviewed, {link.GetProperty("valuesWaiting")} still waiting"); foreach (JsonElement extraction in link.GetProperty("extractions").EnumerateArray()) { Console.WriteLine($" {extraction.GetProperty("fileName")}: {extraction.GetProperty("valuesWaiting")} waiting"); }}
// 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;Save as review_links.cs, set SPECCAPTURE_API_KEY, and run: dotnet run review_links.cs. Needs .NET 10 or later.
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
page = call("GET", "/v1/review-links?status=active").json()
for link in page["data"]: print(f"{link['reviewLinkId']}: {link['valuesReviewed']} values reviewed, {link['valuesWaiting']} still waiting") for extraction in link["extractions"]: print(f" {extraction['fileName']}: {extraction['valuesWaiting']} waiting")Save as review_links.py, set SPECCAPTURE_API_KEY, and run: python review_links.py. Needs Python 3.9+ and requests (pip install requests).
const API = "https://api.speccapture.com";const headers = { Authorization: `Bearer ${process.env.SPECCAPTURE_API_KEY}` };
const page = await call("GET", "/v1/review-links?status=active").then((response) => response.json());
for (const link of page.data) { console.log(`${link.reviewLinkId}: ${link.valuesReviewed} values reviewed, ${link.valuesWaiting} still waiting`); for (const extraction of link.extractions) { console.log(` ${extraction.fileName}: ${extraction.valuesWaiting} waiting`); }}
// 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;}Save as review_links.mjs, set SPECCAPTURE_API_KEY, and run: node review_links.mjs. Needs Node.js 20 or later.
- Withdrawing it:
DELETE /v1/review-links/{reviewLinkId}stops it at once: whoever opens it is told it was withdrawn, and nothing more can be changed through it - a link to several jobs, every job’s part of it. What was reviewed through it stays, with who reviewed it. The owner and admins also see every review link on the dashboard’s Review page, under Sent for review, and can withdraw any of them there. Deleting the job, or asking for the workspace to be deleted, withdraws its links.
REVIEW_LINK_ID=8d2f4b6a-1c3e-4a5b-9d7f-2e4c6a8b0d1f # the reviewLinkId the review link was made with
curl -sS -X DELETE "https://api.speccapture.com/v1/review-links/$REVIEW_LINK_ID" \ -H "Authorization: Bearer $SPECCAPTURE_API_KEY"Paste into a terminal with SPECCAPTURE_API_KEY set. Needs curl; scripts also use bash and jq.
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 reviewLinkId = args[0]; // the reviewLinkId the review link was made with
await Call(HttpMethod.Delete, $"/v1/review-links/{reviewLinkId}");
// 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;Save as withdraw_review_link.cs, set SPECCAPTURE_API_KEY, and run: dotnet run withdraw_review_link.cs -- 8d2f4b6a-1c3e-4a5b-9d7f-2e4c6a8b0d1f. Needs .NET 10 or later.
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
review_link_id = sys.argv[1] # the reviewLinkId the review link was made with
call("DELETE", f"/v1/review-links/{review_link_id}")Save as withdraw_review_link.py, set SPECCAPTURE_API_KEY, and run: python withdraw_review_link.py 8d2f4b6a-1c3e-4a5b-9d7f-2e4c6a8b0d1f. Needs Python 3.9+ and requests (pip install requests).
const API = "https://api.speccapture.com";const headers = { Authorization: `Bearer ${process.env.SPECCAPTURE_API_KEY}` };
const [reviewLinkId] = process.argv.slice(2); // the reviewLinkId the review link was made with
await call("DELETE", `/v1/review-links/${reviewLinkId}`);
// 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;}Save as withdraw_review_link.mjs, set SPECCAPTURE_API_KEY, and run: node withdraw_review_link.mjs 8d2f4b6a-1c3e-4a5b-9d7f-2e4c6a8b0d1f. Needs Node.js 20 or later.
- One link for several jobs:
POST /v1/review-linkswithextractionIds- 1 to 200 job ids, in the order the reviewer is to see them - makes ONE link to every read sheet of each, with the sameexpiresInDaysandreviewerLabel. Whoever opens it gives their name once, moves from one drawing to the next, and is shown how many are left to check. It is all or nothing: a job that cannot be sent answers409 not_shareablenaming its file, and no link is made. One id makes the same link asPOST /v1/extractions/{jobId}/review-links. Each job’s part never outlasts that drawing, soexpiresAtis when the last part stops. A value reviewed through it names this one link in itsreviewedThrough.reviewLinkId.
#!/usr/bin/env bashset -euo pipefailAPI=https://api.speccapture.comAUTH="Authorization: Bearer $SPECCAPTURE_API_KEY"
link=$(curl -sS --fail-with-body "$API/v1/review-links" \ -H "$AUTH" \ -H "Content-Type: application/json" \ -d '{"extractionIds":["7c9e6679-7425-40de-944b-e07fc1f90ae7","1b4e28ba-2fa1-41d2-883f-0016d3cca427"],"expiresInDays":30,"reviewerLabel":"Supplier incoming inspection"}') || { echo "$link" >&2; exit 1; }jq -r '"Send this to the one person who should check both drawings, until \(.expiresAt): \(.reviewUrl)"' <<<"$link"jq -r '"To withdraw it, every drawing at once: \(.reviewLinkId)"' <<<"$link"Save as review_link_for_several.sh, set SPECCAPTURE_API_KEY, and run: bash review_link_for_several.sh. Needs curl; scripts also use bash and jq.
using System.Text;using System.Text.Json;using System.Text.Json.Nodes;
using HttpClient http = new() { BaseAddress = new Uri("https://api.speccapture.com") };http.DefaultRequestHeaders.Authorization = new("Bearer", Environment.GetEnvironmentVariable("SPECCAPTURE_API_KEY"));
StringContent body = new(new JsonObject { ["extractionIds"] = new JsonArray("7c9e6679-7425-40de-944b-e07fc1f90ae7", "1b4e28ba-2fa1-41d2-883f-0016d3cca427"), ["expiresInDays"] = 30, ["reviewerLabel"] = "Supplier incoming inspection",}.ToJsonString(), Encoding.UTF8, "application/json");JsonElement link = await Json(await Call(HttpMethod.Post, "/v1/review-links", body));Console.WriteLine($"Send this to the one person who should check both drawings, until {link.GetProperty("expiresAt")}: {link.GetProperty("reviewUrl")}");Console.WriteLine($"To withdraw it, every drawing at once: {link.GetProperty("reviewLinkId")}");
// 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;Save as review_link_for_several.cs, set SPECCAPTURE_API_KEY, and run: dotnet run review_link_for_several.cs. Needs .NET 10 or later.
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
link = call( "POST", "/v1/review-links", json={"extractionIds": ["7c9e6679-7425-40de-944b-e07fc1f90ae7", "1b4e28ba-2fa1-41d2-883f-0016d3cca427"], "expiresInDays": 30, "reviewerLabel": "Supplier incoming inspection"},).json()print(f"Send this to the one person who should check both drawings, until {link['expiresAt']}: {link['reviewUrl']}")print(f"To withdraw it, every drawing at once: {link['reviewLinkId']}")Save as review_link_for_several.py, set SPECCAPTURE_API_KEY, and run: python review_link_for_several.py. Needs Python 3.9+ and requests (pip install requests).
const API = "https://api.speccapture.com";const headers = { Authorization: `Bearer ${process.env.SPECCAPTURE_API_KEY}` };
const link = await call("POST", "/v1/review-links", { body: JSON.stringify({ extractionIds: ["7c9e6679-7425-40de-944b-e07fc1f90ae7", "1b4e28ba-2fa1-41d2-883f-0016d3cca427"], expiresInDays: 30, reviewerLabel: "Supplier incoming inspection" }), headers: { "Content-Type": "application/json" },}).then((response) => response.json());console.log(`Send this to the one person who should check both drawings, until ${link.expiresAt}: ${link.reviewUrl}`);console.log(`To withdraw it, every drawing at once: ${link.reviewLinkId}`);
// 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;}Save as review_link_for_several.mjs, set SPECCAPTURE_API_KEY, and run: node review_link_for_several.mjs. Needs Node.js 20 or later.
- Limits: a link takes up to 120 changes a minute - “Accept all” and “Accept table” are one change each - and up to 50 different names.