Skip to content
API console (try a request with your own key)Get early access

Download a finished job's values as JSON, CSV or XLSX

GET
/v1/extractions/{jobId}/export
#!/usr/bin/env bash
set -euo pipefail
API=https://api.speccapture.com
AUTH="Authorization: Bearer $SPECCAPTURE_API_KEY"
JOB_ID=7c9e6679-7425-40de-944b-e07fc1f90ae7 # the jobId the submission answered with
curl -sS --fail-with-body "$API/v1/extractions/$JOB_ID/export?format=xlsx" \
-H "$AUTH" \
-o extraction.xlsx
curl -sS --fail-with-body "$API/v1/extractions/$JOB_ID/export?format=csv" \
-H "$AUTH" \
-o extraction-csv.zip
curl -sS --fail-with-body "$API/v1/extractions/$JOB_ID/export?format=json" \
-H "$AUTH" \
-o extraction.json
echo "Saved extraction.xlsx, extraction-csv.zip and extraction.json"

Format=json, csv (a zip: sheets.csv, one row per sheet, or values.csv, one row per value, and one file per table type) or xlsx (one workbook), each laid out as the job’s template’s output chooses: json is the template’s shape (as GET /v1/extractions/{jobId}/values gives it, with formatVersion, workspace and exportedAt) when the template lays its JSON out flat or nested, and the job and every sheet exactly as the API returns them when it is complete - the standard template’s, and every template’s that never chose; in csv and xlsx each value is a column, followed by the extras the template carries. content=complete asks for every detail of what the job kept instead, whatever its template’s files hold: json is then the job and every sheet exactly as the API returns them, and csv and xlsx carry what was read, the review state and the confidence beside every value and each sheet’s details; it never adds a field the job did not keep, and a value still waiting for a person comes with its state. keys=paths or keys=names chooses a template-shaped json file’s keys, as on GET /v1/extractions/{jobId}/values. Answers 409 not_finished until every sheet has finished.

jobId
required
string format: uuid

The job’s id: the jobId POST /v1/extractions answered with, or one GET /v1/extractions lists.

format
string
default: json
Allowed values: json csv xlsx

The file to download: json (the job and every sheet exactly as this API answers them), csv (a zip of sheets.csv and one file per table) or xlsx (one Excel workbook). json when left out.

content
string
default: template
Allowed values: template complete

What the file holds: template, as the job’s template lays its files out, or complete, every detail of what the job kept whatever its template says - json the job and every sheet exactly as this API answers them, csv and xlsx with what was read, the review state and the confidence beside every value and each sheet’s details. Never a field the job did not keep; a value still waiting for a person comes with its state. Made afresh, never stored. template when left out.

keys
string
Allowed values: names paths

What the values are keyed by: names, the template’s names, or paths, SpecCapture’s keys (titleBlock.partNumber, bom, qty), which a rename never changes. Changes a template-shaped answer or json file only: the complete answer carries both each value’s path and its name. The template’s own choice when left out.

OK

The file’s bytes: save them as they come, under the name the Content-Disposition header gives.

string format: binary

Bad Request: a problem with a stable code. See Errors for every code and what to do about it.

Media typeapplication/problem+json

Every error: a problem with a stable code. https://speccapture.com/docs/api/errors lists every code.

object
type
required

A link to the code’s entry in the docs.

string
title
required

What went wrong, in a few words for a person: the same for every problem with this code.

string
status
required

The HTTP status of the answer.

integer format: int32
detail

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.

string
instance
required

The path of the request that was refused.

string
code
required

What went wrong, as a stable code to branch on: a published code never changes meaning.

string
traceId
required

This request’s trace: quote it when asking for help.

string

Examples

Exampleinvalid_request

The request is not valid.

{
"type": "https://speccapture.com/docs/api/errors#invalid_request",
"title": "The request is not valid.",
"status": 400,
"detail": "format must be json, csv or xlsx.",
"instance": "/v1/extractions/7c9e6679-7425-40de-944b-e07fc1f90ae7/export",
"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.

Media typeapplication/problem+json

Every error: a problem with a stable code. https://speccapture.com/docs/api/errors lists every code.

object
type
required

A link to the code’s entry in the docs.

string
title
required

What went wrong, in a few words for a person: the same for every problem with this code.

string
status
required

The HTTP status of the answer.

integer format: int32
detail

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.

string
instance
required

The path of the request that was refused.

string
code
required

What went wrong, as a stable code to branch on: a published code never changes meaning.

string
traceId
required

This request’s trace: quote it when asking for help.

string

Examples

Examplenot_found

Not found.

{
"type": "https://speccapture.com/docs/api/errors#not_found",
"title": "Not found.",
"status": 404,
"detail": "There is no extraction with this id in your workspace.",
"instance": "/v1/extractions/7c9e6679-7425-40de-944b-e07fc1f90ae7/export",
"code": "not_found",
"traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01"
}

Conflict: a problem with a stable code. See Errors for every code and what to do about it.

Media typeapplication/problem+json

Every error: a problem with a stable code. https://speccapture.com/docs/api/errors lists every code.

object
type
required

A link to the code’s entry in the docs.

string
title
required

What went wrong, in a few words for a person: the same for every problem with this code.

string
status
required

The HTTP status of the answer.

integer format: int32
detail

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.

string
instance
required

The path of the request that was refused.

string
code
required

What went wrong, as a stable code to branch on: a published code never changes meaning.

string
traceId
required

This request’s trace: quote it when asking for help.

string

Examples

Examplenot_finished

The job has not finished.

{
"type": "https://speccapture.com/docs/api/errors#not_finished",
"title": "The job has not finished.",
"status": 409,
"detail": "The job is still extracting. Its export is ready once every sheet has finished: follow GET /v1/extractions/7c9e6679-7425-40de-944b-e07fc1f90ae7, or a webhook.",
"instance": "/v1/extractions/7c9e6679-7425-40de-944b-e07fc1f90ae7/export",
"code": "not_finished",
"traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01",
"jobStatus": "extracting"
}