# Create a download link

`POST https://api.cademi.com.br/api/v3/files/{file_id}/download-links`

Operation ID: `files.download_links.create` · API v3

Issues a short-lived, pre-signed URL for downloading the file.

The link lifetime is set with `ttl_seconds`. When omitted, it defaults to the maximum of 900 seconds.

This operation requires the `Idempotency-Key` header. Replaying a request with the same key returns the original response, including the original URL, which may already have expired. To obtain a valid link, send a new request with a different key.

Required permissions: `files.read`.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `file_id` | path | string | yes |  |

## Request body

Content type: `application/json`.

| Field | Type | Required | Description |
|---|---|---|---|
| `download_name` | string or null | no |  |
| `inline` | boolean | no |  |
| `ttl_seconds` | integer | no |  |

## Responses

### 201

Returns the download link and its expiration time.

Body: `data`: DownloadLink.

Fields of DownloadLink:

| Field | Type | Required | Description |
|---|---|---|---|
| `expires_at` | string (date-time) | yes |  |
| `method` | string, one of `GET` | yes |  |
| `object` | string, one of `download_link` | yes |  |
| `url` | string | yes |  |

### 401

The credential is missing, malformed, expired, or revoked.

Body: Error.

### 403

The current credentials do not have the permission required by this operation.

Body: Error.

### 404

The file was not found or is not accessible with the current credentials.

Body: Error.

### 422

The request body or query parameters failed validation.

Body: ValidationFailed.

### 503

The storage service is temporarily unavailable.

Body: Error.

Full schema: https://cademi.dev/openapi/v3.json
