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

Download an export's file

GET
/v1/exports/{exportId}/file
#!/usr/bin/env bash
set -euo pipefail
API=https://api.speccapture.com
AUTH="Authorization: Bearer $SPECCAPTURE_API_KEY"
EXPORT_ID=5f2a8c1e-3d4b-4e6f-9a7c-8b1d2e3f4a5b # the exportId a large export answered with
while true; do
exportJob=$(curl -sS --fail-with-body "$API/v1/exports/$EXPORT_ID" \
-H "$AUTH") || { echo "$exportJob" >&2; exit 1; }
jq -r '"Export \(.exportId) is \(.status)"' <<<"$exportJob"
if [[ "$(jq -r '.status' <<<"$exportJob")" =~ ^(ready|failed|expired)$ ]]; then break; fi
sleep 10
done
curl -sS --fail-with-body "$API/v1/exports/$EXPORT_ID/file" \
-H "$AUTH" \
-o "$(jq -r '.fileName' <<<"$exportJob")"
jq -r '"Saved \(.fileName) (\(.fileSizeBytes) bytes)"' <<<"$exportJob"

The ready export’s file, the same file a smaller export answers at once: json, a zip of csv files, or an xlsx workbook, saved as its fileName. Kept 7 days after it was ready. An export still queued or building, or one that failed, is 409 export_not_ready with exportStatus; one past its 7 days is 410 export_expired - ask for it again. Another workspace’s export is 404 not_found. Any live key.

exportId
required
string format: uuid

The export’s id: the exportId POST /v1/exports answered 202 with, or one GET /v1/exports lists.

OK

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

string format: binary

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 export with this id in your workspace.",
"instance": "/v1/exports/5f2a8c1e-3d4b-4e6f-9a7c-8b1d2e3f4a5b/file",
"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

Exampleexport_not_ready

The export's file is not ready.

{
"type": "https://speccapture.com/docs/api/errors#export_not_ready",
"title": "The export's file is not ready.",
"status": 409,
"detail": "This export is still building: follow GET /v1/exports/5f2a8c1e-3d4b-4e6f-9a7c-8b1d2e3f4a5b, or wait for the export.ready webhook, then download it.",
"instance": "/v1/exports/5f2a8c1e-3d4b-4e6f-9a7c-8b1d2e3f4a5b/file",
"code": "export_not_ready",
"traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01",
"exportStatus": "building"
}

Gone: 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_expired

The export's file has expired.

{
"type": "https://speccapture.com/docs/api/errors#export_expired",
"title": "The export's file has expired.",
"status": 410,
"detail": "This export's file was kept for 7 days and has been deleted. Ask for the export again: POST /v1/exports.",
"instance": "/v1/exports/5f2a8c1e-3d4b-4e6f-9a7c-8b1d2e3f4a5b/file",
"code": "export_expired",
"traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01",
"exportStatus": "expired"
}