Skip to content

Download a data export's file

Open .md

GET/v1/api/store/{team_slug}/data_export/{id}/download

v1Operation ID v1_public_data_export_download

Sends the export's CSV file itself, not JSON and not a link. The file is named yoprint_<type>_export-<YYYY-MM-DD>.csv, with the date (UTC) the export was created (in Content-Disposition).

It works only while the export is ready and not expired, which is 3 days after it became ready. You can download it as many times as you like in that time.

Save the answer to a file. The Accept: application/json header every request sends is fine here: the file still comes back as CSV.

curl -o export.csv -H "Authorization: Bearer YOUR_API_KEY" -H "Accept: application/json" \
  https://secure.yoprint.com/v1/api/store/your-team/data_export/G59hl28azOL22k/download

Permission

Any member of the team, for any of the team's exports.

Path parameters

  • team_slugstringrequired

    Your team slug, shown as Team ID next to your API key in Profile.

    • Example your-team
  • idstringrequired

    The export's id, from the create answer. A hash id; unique keys and document numbers are refused with 404.

    • Example G59hl28azOL22k

Request body

This operation takes no request body.

Response

200Binary download response.

The answer is a file (application/octet-stream), not JSON. The example saves it with curl -o.

Errors

  • 401The API key is missing or wrong (unauthenticated).

  • 403You are not allowed to do this. api_access_not_in_plan: your team's plan doesn't include API access (Pro and above, with an active subscription or trial), so every request answers this until the team upgrades. When your role lacks the permission the operation needs, the body is only {"message": "Insufficient Permission"}. Other refusals use the error envelope, with unauthorized or user_is_not_authorized.

  • 404Not found. page_not_found: the team slug is unknown, you are not a member of the team, or an id in the path is not one of this team's. code: null, with a message that starts "No query results for": there is no record with that id.

    When
    The export is not ready yet, failed, expired, or its file was removed. All of these answer the same 404 (page_not_found).
    Fix
    Read the export first: download only when status is ready and expires_at is in the future. If it expired, create a new export.
    When
    The id is not one of this team's exports.
    Fix
    Use the id the create operation returned.

Notes

  • The response has Cache-Control: private, no-store. Save the file; do not rely on caches.
  • The file is UTF-8 with a byte order mark, so spreadsheet apps read accents correctly. Strip the first three bytes if your CSV reader does not expect it.