---
title: "📥 Download file / preview"
method: GET
path: "/file"
tags: ["Files"]
---

# 📥 Download file / preview

`GET /file`

## Request

- Base URL: `http://localhost`
- URL: `http://localhost/file`
- Auth: one of:
  - API key in header `sid` and API key in header `rts` and API key in header `sig`
  - API key in header `sid` and API key in query parameter `fileToken`
  - API key in cookie `fsid`

Скачивание файла или превью. Сессия - с доказательством владения ею, один ID сессии доступа не даёт:
подпись (`sid` + `rts` + `sig`), `sid` + `fileToken` или кука `fsid`. `sid` без доказательства принимается,
только если совпадает с кукой. Нет доказательства или неверный ключ - 401, неверная подпись - 403.

Location config: `api.commonLocations.baseFilesAccess` = `file`.

Ответ: binary stream / redirect на signed URL (S3).

## Query parameters

- `sid` string, uuid
- `fileToken` string
- `fid` string, uuid, required
- `mode` 'icon' | 'preview' | 'data'

## Headers

- `devID` string, uuid, required
- `tz` string, required
- `app` string, required
- `appVer` string, required

## Response `200`

File bytes

## Other responses

- `302`: Redirect to storage signed URL
- `401`: Session invalid
- `404`: File not found

---

[API](https://skmtc.dev/kosmodrom/apis/kosmodrom-backend-api.md) · [All operations](https://skmtc.dev/kosmodrom/apis/kosmodrom-backend-api/llms.txt) · [OpenAPI document](https://skmtc.dev/kosmodrom/apis/kosmodrom-backend-api/revisions/a143b51ba29a?raw)
