Skip to content
Last updated

Download the binary content of a file using a signed URL token.

GEThttps://api.aitronos.com/v1/organizations/{organization_id}/files/{file_id}/download

Serves the raw file content with the correct Content-Type header. Authentication is handled via a signed token in the query parameters rather than an Authorization header, making this endpoint compatible with browser-native resource loading (e.g., <img src="...">, <a href="...">).

Important: Do not call this endpoint directly. Instead, use the Get file content URL endpoint to obtain a signed download URL, then use that URL to fetch the file.

Path Parameters

organization_id string required

The unique identifier of the organization.

file_id string required

The unique identifier of the file (format: file_*).

Query Parameters

token string required

The HMAC-signed download token. Obtained from the Get file content URL endpoint.

expires integer required

Unix timestamp when the token expires. Tokens are valid for 1 hour from creation.


Returns

The raw file bytes with the appropriate Content-Type header (e.g., image/png, application/pdf). The response includes a Cache-Control: private, max-age=3600 header.

Errors

StatusCodeDescription
401TOKEN_INVALIDThe token is invalid, expired, or was signed for a different file
404FILE_NOT_FOUNDThe file does not exist or has been deleted
cURL
# Step 1: Get the signed download URL (authenticated)
CONTENT=$(curl -s https://api.aitronos.com/v1/organizations/org_123/files/file_abc123/download \
  -H "X-API-Key: $FREDDY_API_KEY")

DOWNLOAD_URL=$(echo $CONTENT | jq -r '.download_url')

# Step 2: Download the file (no auth header needed)
curl -o downloaded_file.png "$DOWNLOAD_URL"