Deleting a job
Sent the wrong file, or one that should never have left your network? Delete its job, and everything of it goes:
JOB_ID=7c9e6679-7425-40de-944b-e07fc1f90ae7 # the jobId the submission answered with
curl -sS -X DELETE "https://api.speccapture.com/v1/extractions/$JOB_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 jobId = args[0]; // the jobId the submission answered with
await Call(HttpMethod.Delete, $"/v1/extractions/{jobId}");
// 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 delete_job.cs, set SPECCAPTURE_API_KEY, and run: dotnet run delete_job.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
call("DELETE", f"/v1/extractions/{job_id}")Save as delete_job.py, set SPECCAPTURE_API_KEY, and run: python delete_job.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
await call("DELETE", `/v1/extractions/${jobId}`);
// 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 delete_job.mjs, set SPECCAPTURE_API_KEY, and run: node delete_job.mjs 7c9e6679-7425-40de-944b-e07fc1f90ae7. Needs Node.js 20 or later.
DELETE /v1/extractions/{jobId} answers 204 with no body, and from that moment the job is gone: every request
about it - the job, its sheets, its export - answers 404 not_found, its view links show only that the link has
expired or was withdrawn, and a webhook event about it that has not been sent yet is never sent. The uploaded file,
the page images, every sheet’s values, notes and tables, and the stored exports are erased within minutes. It cannot
be undone.
- Credits: a job that has finished keeps what it spent: the sheets were read. A job still
queued,splittingorextractingstops, and every credit it has not spent comes back to the workspace at once, a sheet being read at that moment included - its values are never delivered. - Who may delete: a live key acting as the workspace’s owner or an admin, as for view links and webhooks. A test
key is refused with
403 live_key_required, a key acting as a member with403 role_not_allowed. In the dashboard, the owner and admins have Delete on the document’s page and in each document’s menu. - Refusals: another workspace’s job, an id nobody issued, or a job already deleted all answer
404 not_found, so deleting twice is harmless. - Your copies: exports you have downloaded and values your own software stored are yours, and are not touched.