# Files

Upload intents, files and attachments of members and guests.

0 operation(s) for tokens, 6 app-only. The full schemas are in [openapi.json](https://docs.youniton.com/openapi.json) (search the operation ID).

## A file's metadata and status (the uploader before ownership; afterwards the owner's read policy)

`GET /files/{fileId}`

- Operation ID: `getStoredFile`
- Call with: Session of the Youniton apps (app only)
- Feature: F-FIL-01

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `X-Kanso-Tenant` | header | string (uuid) | yes | The tenant id of the call (05-api §8.3); unknown, foreign or inactive answers 404 tenant.not_found. |
| `fileId` | path | string (uuid) | yes |  |

| Status | Description | Content type | Type |
|---|---|---|---|
| 200 | The file. | application/json | `object` |
| 404 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |

## Redirect to a 60-second signed URL of the file after the owner's decision (browser navigation)

`GET /files/{fileId}/download`

- Operation ID: `downloadFile`
- Call with: Session of the Youniton apps (app only)
- Feature: F-FIL-04

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `fileId` | path | string (uuid) | yes |  |
| `tenant` | query | string (uuid) | yes | The tenant id, checked like X-Kanso-Tenant (a navigation cannot send headers). |
| `disposition` | query | string | no |  |

| Status | Description | Content type | Type |
|---|---|---|---|
| 200 | F-FIL-04.R12 — only when the request accepts application/vnd.kanso.signed-url+json; the same signed URL as JSON, with the headers of the 302. | application/vnd.kanso.signed-url+json | `object` |
| 302 | Location is a signed URL valid 60 seconds; Cache-Control no-store, Referrer-Policy no-referrer, X-Content-Type-Options nosniff. |  |  |
| 404 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 409 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 429 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 503 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |

## Redirect to a 60-second URL of a preview variant after the owner's decision (browser navigation)

`GET /files/{fileId}/preview`

- Operation ID: `getFilePreview`
- Call with: Session of the Youniton apps (app only)
- Feature: F-FIL-03

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `fileId` | path | string (uuid) | yes |  |
| `variant` | query | string | yes |  |
| `tenant` | query | string (uuid) | yes | The tenant id, checked like X-Kanso-Tenant (a navigation cannot send headers). |

| Status | Description | Content type | Type |
|---|---|---|---|
| 200 | F-FIL-04.R12 — only when the request accepts application/vnd.kanso.signed-url+json; the same signed URL as JSON. | application/vnd.kanso.signed-url+json | `object` |
| 302 | Location is a signed URL of the preview, valid 60 seconds, inline disposition, Cache-Control no-store. |  |  |
| 404 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 409 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 503 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |

## Authorise an upload to a target, reserve its quota and answer a presigned PUT or multipart parameters

`POST /upload-intents`

- Operation ID: `startUpload`
- Call with: Session of the Youniton apps (app only)
- Feature: F-FIL-01

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `X-Kanso-Tenant` | header | string (uuid) | yes | The tenant id of the call (05-api §8.3); unknown, foreign or inactive answers 404 tenant.not_found. |
| `Idempotency-Key` | header | string | yes | Durable command receipt key (05-api §7.2); the generated client sends one UUIDv7 per user intent. |

Request body (application/json, required): `UploadIntentRequest`

| Status | Description | Content type | Type |
|---|---|---|---|
| 201 | The pending file with its upload instructions. | application/json | `object` |
| 403 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 404 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 409 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 422 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 429 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |

## Complete the upload — the server completes multipart, verifies the size, detects the type and starts the scan

`POST /upload-intents/{fileId}/complete`

- Operation ID: `completeUpload`
- Call with: Session of the Youniton apps (app only)
- Feature: F-FIL-01

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `X-Kanso-Tenant` | header | string (uuid) | yes | The tenant id of the call (05-api §8.3); unknown, foreign or inactive answers 404 tenant.not_found. |
| `Idempotency-Key` | header | string | yes | Durable command receipt key (05-api §7.2); the generated client sends one UUIDv7 per user intent. |
| `fileId` | path | string (uuid) | yes |  |

Request body (application/json, required): `UploadCompleteRequest`

| Status | Description | Content type | Type |
|---|---|---|---|
| 200 | The file, now scanning. | application/json | `object` |
| 404 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 409 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 422 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |

## Sign one multipart operation (create, part, abort) for the file's own staging key

`POST /upload-intents/{fileId}/sign`

- Operation ID: `signUploadOperation`
- Call with: Session of the Youniton apps (app only)
- Feature: F-FIL-01

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `X-Kanso-Tenant` | header | string (uuid) | yes | The tenant id of the call (05-api §8.3); unknown, foreign or inactive answers 404 tenant.not_found. |
| `fileId` | path | string (uuid) | yes |  |

Request body (application/json, required): `UploadSignRequest`

| Status | Description | Content type | Type |
|---|---|---|---|
| 200 | The signed request, valid 15 minutes. | application/json | `object` |
| 404 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 409 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
| 422 | A problem (application/problem+json); the code names the reason. | application/problem+json | `Problem` |
