Retrieve a file

Get the download link of a compensation confirmation, a certificate or a project image.

Returns a file attached to a record, such as the compensation confirmation or certificate of a purchase, or an image of a product. Purchases list the IDs of their files in files.

Request

GET /v2/files/{id}

idstringrequired

The file ID, such as file_34sdfgJH9df4g35.

See every field of GET /v2/files/{id} in the API reference
curl "https://api.sandbox.squake.earth/v2/files/file_34sdfgJH9df4g35" \
  --header "Authorization: Bearer $SQUAKE_API_KEY"

Response

200 OKapplication/json
{
  "id": "file_34sdfgJH9df4g35",
  "filename": "SQUAKE-CompensationConfirmation-euc1XXX.pdf",
  "purpose": "confirmation_document",
  "size": 48211,
  "type": "pdf",
  "download_url": "https://squake.s3.eu-central-1.amazonaws.com/..."
}
FieldTypeDescription
idstringThe file ID.
filenamestringThe file name.
purposestringconfirmation_document, certificate_document or project_image.
sizeintegerSize in bytes.
typestringcsv, jpg, pdf, png or webp.
download_urlstringThe link to download the file. It expires after one year.
notificationstringInformation about the file, such as when it will be available.

Waiting for a document

SQUAKE generates documents after the purchase, so a file can exist before its content does. While download_url is empty, the document hasn't been created yet: poll until the link appears, and read notification for when to expect it. To avoid polling, register a confirmation_document_available or certificate_document_available webhook. It sends you the file, including its download_url, as soon as the document is ready.

Errors

StatusMeaning
401The API key is missing or invalid.
403The request is forbidden for your account.
404No file has this ID.

On this page

GET/v2/files/{id}

Run this request against the sandbox with your test key.

Open in API reference