GET /file /download /{dirId} /{fileName}
Returns a URL to download a file from: an input you uploaded, or a job’s output. The URL works for 5 minutes; ask again for another.
Parameters
| dirId | string | The directory’s id. |
|---|---|---|
| fileName | string | The file’s name, URL-encoded if it holds characters a path can’t. |
Request body
This request has no body.
Example
Request
curl https://media.logicboostkit.com/file/download/dir_pi23jgy1yxlmigi873bz/thumb.jpg \
-H "Authorization: Basic $MEDIA_KEY"Response
HTTP/1.1 200 OK
X-Request-Id: job_0mv6hcx5429ir9i0kjnput8u
{
"ok": true,
"download": {
"url": "https://…",
"method": "GET",
"expiresInSeconds": 300,
"file_path": "dir_pi23jgy1yxlmigi873bz/thumb.jpg",
"file_size": 84213,
"file_type": "image/jpeg"
}
}Response fields
| ok | boolean | true when the file exists. |
|---|---|---|
| download.url | string | Where to fetch the bytes. Signed, and yours alone. |
| download.method | string | Always GET. |
| download.expiresInSeconds | number | How long the URL works: 300. |
| download.file_path | string | dir_id/file_name. |
| download.file_size | number | The file’s size in bytes. |
| download.file_type | string | null | The file’s MIME type, from its extension; failing that, the Content-Type it was uploaded with; otherwise null. |
Status codes
| 200 | The download URL is ready. Not charged. |
|---|---|
| 401 | The Authorization header is missing, or the key is invalid, revoked or expired. |
| 403 | The account isn’t active. The error says what to do. |
| 404 | File not found: the file or its directory isn’t in your account, the directory has expired, or nothing has been uploaded under that name yet. |
| 429 | More than 300 requests in a minute on this key. Wait for the number of seconds in Retry-After. |