Skip to content

Generate download URL for existing file
Stable

Request

Generates a new pre-signed download URL for a file already stored in the Remote File Manager bucket.

Use this when the original download_url returned at upload time has expired but the file itself (auto-deleted after 1 day from upload) is still available. Accepts an optional expires_in value to control how long the new URL remains valid.

About Generate Download URL The download_url returned when a file is uploaded expires after a set duration; this endpoint issues a fresh pre-signed URL against the same file_key without re-uploading the file. It only works while the underlying file still exists in the bucket, which is limited to roughly 1 day after upload.

Key Fields / Request Body

file_key — the storage key of the file, required, returned from the original upload

expires_in — how long the new URL should remain valid, in seconds; defaults to 3600, minimum 60, maximum 86400

Common Use Cases

Re-generating a download link after the original one expired but before the file's 1-day auto-delete window closes

Issuing a longer- or shorter-lived download URL than the one originally returned at upload time

Best Practices

Track each file's upload time so you don't attempt to generate a URL for a file that has already been auto-deleted

Set expires_in to match how long the downstream consumer actually needs access, rather than defaulting to the maximum

Workflow

Retrieve the file_key from the original upload response

POST the file_key and desired expires_in to this endpoint

Share the returned download_url before it expires

Security
esper_cloud_api_apiKey
Path
enterprise_idstringrequired

A UUID string identifying this enterprise.

Bodyapplication/jsonrequired
file_keystringrequired

The storage key of the file to download

Example:"123/files/document_abc123.pdf"
expires_ininteger, [ 60 .. 86400 ]

URL expiration time in seconds (optional, default 3600)

Default:3600
cURL
curl -i -X POST \
  'https://api.esper.io/_mock/openapi/v0/enterprise/{enterprise_id}/content/remote-file/generate_download_url/' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "file_key": "123/files/document_abc123.pdf",
    "expires_in": 3600
  }'

Responses

Download URL generated successfully

Bodyapplication/json
file_keystring

The storage key of the file

Example:"123/files/document_abc123.pdf"
download_urlstring

Pre-signed URL for downloading the file

Example:"https://s3.amazonaws.com/REMOTE_FILE_MANAGER/123/files/document_abc123.pdf?AWSAccessKeyId=..."
expires_ininteger

URL expiration time in seconds

Example:3600
Response
{ "file_key": "123/files/document_abc123.pdf", "download_url": "https://s3.amazonaws.com/REMOTE_FILE_MANAGER/123/files/document_abc123.pdf?AWSAccessKeyId=...", "expires_in": 3600 }