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

Export many finished extractions as one file

POST
/v1/exports
#!/usr/bin/env bash
set -euo pipefail
API=https://api.speccapture.com
AUTH="Authorization: Bearer $SPECCAPTURE_API_KEY"
status=$(curl -sS --fail-with-body "$API/v1/exports" \
-H "$AUTH" \
-H "Content-Type: application/json" \
-d '{"format":"csv","filter":{"status":"completed","createdAfter":"2026-10-01T00:00:00Z"}}' \
-o extractions-csv.zip \
-w '%{http_code}')
if [[ $status == 202 ]]; then
exportJob=$(cat extractions-csv.zip) && rm extractions-csv.zip
jq -r '"Over 100 sheets: export \(.exportId) is \(.status). Follow it until it is ready, then download its file."' <<<"$exportJob"
else
echo "Saved extractions-csv.zip"
fi

Body: format (json when left out, csv or xlsx), content (template when left out, or complete for every detail: what was read, the review state and the confidence beside every value and each sheet’s details in csv and xlsx, whatever the templates carry) and exactly one of extractionIds (1 to 500 job ids, exported in the order named) or filter (status completed or failed, fileName, createdAfter and createdBefore, as GET /v1/extractions takes them, over the finished extractions, newest first; {} for every one). Up to 100 sheets: 200 with the file - json holds extractions and sheets, each exactly as GET /v1/extractions/{jobId} and …/sheets/{n} answer; csv is a zip of sheets.csv and one file per table type; xlsx one workbook. Every row starts with its document (Document, Extraction id, and Template on the sheets), and the columns are the union of the documents’ templates, each headed by every template’s own name for it. From 101 to 5,000 sheets: 202 with the export (status queued) and Location /v1/exports/{exportId}; follow it there, or wait for the export.ready webhook, then download its fileUrl within 7 days. More than 5,000 is 422 export_too_large with sheetCount and maximumSheets; more than 5 exports waiting at once is 409 too_many_exports. An id not in the workspace is 404 not_found and one still being read 409 not_finished, each naming it; the request is refused whole. Exporting is never charged.

Media typeapplication/json
One of:
By extraction id
object
format

Json (one file of the extractions and their sheets, exactly as this API answers them), csv (a zip: sheets.csv and a file per table) or xlsx (one workbook). json when left out.

string
default: json
Allowed values: json csv xlsx
extractionIds
required

1 to 500 job ids from POST /v1/extractions or GET /v1/extractions, exported in the order named; an id named twice is exported once. Leave it out when filter chooses them.

Array<string>
>= 1 items <= 500 items
filter

The workspace’s finished extractions this matches, newest first; {} for every one.

object
status

Completed or failed; both when left out. An extraction still being read has nothing to export.

string
Allowed values: completed failed
fileName

Only extractions whose file name contains this, anywhere and in any case.

string
<= 260 characters
createdAfter

Only extractions made strictly after this date and time (ISO 8601, such as 2026-10-14T09:30:00Z or 2026-10-14T09:30:00+02:00; without an offset it is UTC).

string format: date-time
createdBefore

Only extractions made strictly before this date and time (ISO 8601, such as 2026-10-14T09:30:00Z or 2026-10-14T09:30:00+02:00; without an offset it is UTC).

string format: date-time
content

Template (when left out): the csv and xlsx files carry what the documents’ templates carry when every one lays its files out alike, and the full layout otherwise. complete: every detail, whatever the templates say - what was read, the review state and the confidence beside every value, and each sheet’s details. The json is the complete answer either way. Never a field a document did not keep.

string
default: template
Allowed values: template complete

Examples

The finished extractions a filter matches, as a zip of CSV files

{
"format": "csv",
"filter": {
"status": "completed",
"createdAfter": "2026-10-01T00:00:00Z"
}
}

OK

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

string format: binary

Accepted

Media typeapplication/json

An export too large to build while you wait: POST /v1/exports answers 202 with it for a selection of more than 100 sheets, and GET /v1/exports/{exportId} says how it stands. Once ready, its file downloads from fileUrl - the same file a smaller export answers at once - until expiresAt.

object
exportId
required

The export’s id: what following it and downloading its file name.

string format: uuid
format
required

json, csv or xlsx.

string
content
required

template, or complete for every detail: what the request asked the file to hold.

string
status
required

Where the export stands.

string
Allowed values: queued building ready failed expired
extractionCount
required

How many extractions it holds, decided when it was asked for.

integer format: int32
sheetCount
required

How many sheets they hold.

integer format: int32
createdAt
required

When it was asked for.

string format: date-time
createdBy
required
One of:
null
completedAt
required

When it became ready, or failed; null until then.

null | string format: date-time
expiresAt
required

When its file is deleted, 7 days after it was ready; null until it is.

null | string format: date-time
fileUrl
required

/v1/exports/{exportId}/file while ready; null otherwise.

null | string
fileName
required

What the file is saved as: speccapture-export-2026-10-14.xlsx; null until it is ready.

null | string
fileSizeBytes
required

The file’s size; null until it is ready.

null | integer format: int64
extractionsLeftOut
required

Extractions deleted after the export was asked for and before it was built, left out of the file.

Array<string>
problem
required

While failed, or retrying after a failed attempt: what went wrong, in words; null otherwise.

null | string

Examples

Examplequeued

More than 100 sheets: an export to follow until its file is ready

{
"exportId": "5f2a8c1e-3d4b-4e6f-9a7c-8b1d2e3f4a5b",
"format": "xlsx",
"content": "template",
"status": "queued",
"extractionCount": 38,
"sheetCount": 412,
"createdAt": "2026-10-14T10:00:03+00:00",
"createdBy": {
"kind": "apiKey",
"name": "ERP import"
},
"completedAt": null,
"expiresAt": null,
"fileUrl": null,
"fileName": null,
"fileSizeBytes": null,
"extractionsLeftOut": [],
"problem": null
}

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": "Send extractionIds or filter, not both.",
"instance": "/v1/exports",
"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 1b4e28ba-2fa1-41d2-883f-0016d3cca427 in your workspace.",
"instance": "/v1/exports",
"code": "not_found",
"traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01",
"extractionId": "1b4e28ba-2fa1-41d2-883f-0016d3cca427"
}

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

The job has not finished.

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

Unsupported Media Type: 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

Exampleunsupported_media_type

The request body is not a media type this endpoint takes.

{
"type": "https://speccapture.com/docs/api/errors#unsupported_media_type",
"title": "The request body is not a media type this endpoint takes.",
"status": 415,
"detail": "Send the body as JSON, with the header Content-Type: application/json: this endpoint takes a JSON object with \"format\", \"extractionIds\", \"filter\" and \"content\".",
"instance": "/v1/exports",
"code": "unsupported_media_type",
"traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01"
}

Unprocessable Entity: 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

Exampleexport_too_large

The export would hold more sheets than it may.

{
"type": "https://speccapture.com/docs/api/errors#export_too_large",
"title": "The export would hold more sheets than it may.",
"status": 422,
"detail": "The 512 extractions this filter matches hold 6,340 sheets; one export holds up to 5,000 sheets. Narrow the filter: createdAfter and createdBefore split it by time.",
"instance": "/v1/exports",
"code": "export_too_large",
"traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01",
"sheetCount": 6340,
"extractionCount": 512,
"maximumSheets": 5000
}