File Download

circle-info

💡 Obtain a Presigned URL to download files.

circle-info

💡 Before you start — You need the following to proceed:

  • User authentication completed (JWT token required — all file APIs require authentication)

APIs used in this document:

Endpoint
Method
Auth
Description

/v1/files/:fileId/download-url

POST

JWT

Issue download URL

Overview

File downloads also use the Presigned URL approach, just like uploads. You obtain a time-limited download URL from the bkend API and download the file directly from storage.

spinner

Obtain Download URL

POST /v1/files/:fileId/download-url

curl -X POST https://api-client.bkend.ai/v1/files/{fileId}/download-url \
  -H "X-API-Key: {pk_publishable_key}" \
  -H "Authorization: Bearer {accessToken}"

Path Parameters

Parameter
Type
Required
Description

fileId

string

File ID

Response (200 OK)

Field
Type
Description

url

string

Presigned URL

filename

string

Original file name

contentType

string

MIME type

size

number

File size in bytes

expiresAt

string

URL expiration time (ISO 8601)

circle-exclamation

Download Implementation

Browser Download

Programmatic Download


Error Responses

Error Code
HTTP
Description

file/not-found

404

File not found

file/access-denied

403

Access denied

common/authentication-required

401

Authentication required


Using in Your App

The bkendFetch helper automatically includes the required headers.

circle-info

💡 For bkendFetch setup, see Integrating bkend with Your App.


Next Steps

circle-info

💡 For public images, you can use img.bkend.ai CDN URLs to resize and convert formats instead of Presigned URLs. See Image Optimizationarrow-up-right.

Last updated