---
title: "Generate download URL for existing file"
method: POST
path: "/v0/enterprise/{enterprise_id}/content/remote-file/generate_download_url/"
tags: ["esper_cloud_api_Content"]
---

# Generate download URL for existing file

`POST /v0/enterprise/{enterprise_id}/content/remote-file/generate_download_url/`

## Request

- Base URL: `https://develop-api.esper.cloud/api`
- URL: `https://develop-api.esper.cloud/api/v0/enterprise/{enterprise_id}/content/remote-file/generate_download_url/`
- Auth: HTTP bearer

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

## Path parameters

- `enterprise_id` string, required

## Request body

- object
  - `file_key` string, required: The storage key of the file to download
  - `expires_in` integer: URL expiration time in seconds (optional, default 3600)

## Response `200`

Download URL generated successfully

- object
  - `file_key` string: The storage key of the file
  - `download_url` string: Pre-signed URL for downloading the file
  - `expires_in` integer: URL expiration time in seconds

## Other responses

- `400`: Bad request
- `401`: Authorization information is missing or invalid.
- `403`: Forbidden, no permission to perform this action.
- `500`: Internal server error

---

[API](https://skmtc.dev/esper/apis/esper-api-reference.md) - [All operations](https://skmtc.dev/esper/apis/esper-api-reference/llms.txt) - [OpenAPI document](https://skmtc.dev/esper/apis/esper-api-reference/revisions/fa7b9b652fb2?raw)
