> For the complete documentation index, see [llms.txt](https://api-docs.easyday.dk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api-docs.easyday.dk/files.md).

# Files

## GET /v1/files

> Lists files for the authenticated tenant, most recently updated first.

```json
{"openapi":"3.1.1","info":{"title":"Easyday Tenant API","version":"v1"},"tags":[{"name":"Files"}],"paths":{"/v1/files":{"get":{"tags":["Files"],"summary":"Lists files for the authenticated tenant, most recently updated first.","parameters":[{"name":"folderId","in":"query","description":"Filter to one folder.","schema":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"}},{"name":"page","in":"query","description":"1-based page number.","schema":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32","default":1}},{"name":"pageSize","in":"query","description":"Page size, clamped to 1-200.","schema":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32","default":50}}],"responses":{"200":{"description":"OK","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/PagedResultOfFileVm"}},"application/json":{"schema":{"$ref":"#/components/schemas/PagedResultOfFileVm"}},"text/json":{"schema":{"$ref":"#/components/schemas/PagedResultOfFileVm"}}}}}}}},"components":{"schemas":{"PagedResultOfFileVm":{"required":["total","page","pageSize","items"],"type":"object","properties":{"total":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"page":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"pageSize":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"items":{"type":"array","items":{"$ref":"#/components/schemas/FileVm"}}},"description":"Paged list response."},"FileVm":{"required":["id","folderId","filename","mimeType","sizeBytes","downloadUrl"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"folderId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"filename":{"type":"string"},"mimeType":{"type":"string"},"sizeBytes":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int64"},"mediaWidth":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"mediaHeight":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"downloadUrl":{"type":"string","description":"Points at this same API's GET /v1/files/{id}/content endpoint."}}}}}}
```

## POST /v1/files

> Uploads a new file into a folder. Rejected if it exceeds the configured size limit,\
> isn't an allowed content type, or (when virus scanning is enabled for this tenant)\
> fails the scan.

```json
{"openapi":"3.1.1","info":{"title":"Easyday Tenant API","version":"v1"},"tags":[{"name":"Files"}],"paths":{"/v1/files":{"post":{"tags":["Files"],"summary":"Uploads a new file into a folder. Rejected if it exceeds the configured size limit,\nisn't an allowed content type, or (when virus scanning is enabled for this tenant)\nfails the scan.","requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","allOf":[{"type":"object","properties":{"file":{"$ref":"#/components/schemas/IFormFile"}}},{"type":"object","properties":{"folderId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"}}}]}}},"required":true},"responses":{"201":{"description":"Created","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/FileVm"}},"application/json":{"schema":{"$ref":"#/components/schemas/FileVm"}},"text/json":{"schema":{"$ref":"#/components/schemas/FileVm"}}}},"400":{"description":"Bad Request","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}},"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}},"text/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}},"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}},"text/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"IFormFile":{"type":"string","format":"binary"},"FileVm":{"required":["id","folderId","filename","mimeType","sizeBytes","downloadUrl"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"folderId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"filename":{"type":"string"},"mimeType":{"type":"string"},"sizeBytes":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int64"},"mediaWidth":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"mediaHeight":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"downloadUrl":{"type":"string","description":"Points at this same API's GET /v1/files/{id}/content endpoint."}}},"ErrorResponse":{"required":["error"],"type":"object","properties":{"error":{"type":"string"}},"description":"Error response shape used by 400 Bad Request responses."}}}}
```

## GET /v1/files/{id}

> Gets one file's metadata.

```json
{"openapi":"3.1.1","info":{"title":"Easyday Tenant API","version":"v1"},"tags":[{"name":"Files"}],"paths":{"/v1/files/{id}":{"get":{"tags":["Files"],"summary":"Gets one file's metadata.","parameters":[{"name":"id","in":"path","required":true,"schema":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":"integer","format":"int32"}}],"responses":{"200":{"description":"OK","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/FileVm"}},"application/json":{"schema":{"$ref":"#/components/schemas/FileVm"}},"text/json":{"schema":{"$ref":"#/components/schemas/FileVm"}}}},"404":{"description":"Not Found","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}},"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}},"text/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}},"components":{"schemas":{"FileVm":{"required":["id","folderId","filename","mimeType","sizeBytes","downloadUrl"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"folderId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"filename":{"type":"string"},"mimeType":{"type":"string"},"sizeBytes":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int64"},"mediaWidth":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"mediaHeight":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"downloadUrl":{"type":"string","description":"Points at this same API's GET /v1/files/{id}/content endpoint."}}},"ProblemDetails":{"type":"object","properties":{"type":{"type":["null","string"]},"title":{"type":["null","string"]},"status":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"detail":{"type":["null","string"]},"instance":{"type":["null","string"]}}}}}}
```

## DELETE /v1/files/{id}

> Deletes a file.

```json
{"openapi":"3.1.1","info":{"title":"Easyday Tenant API","version":"v1"},"tags":[{"name":"Files"}],"paths":{"/v1/files/{id}":{"delete":{"tags":["Files"],"summary":"Deletes a file.","parameters":[{"name":"id","in":"path","required":true,"schema":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":"integer","format":"int32"}}],"responses":{"204":{"description":"No Content"},"404":{"description":"Not Found","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}},"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}},"text/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}},"components":{"schemas":{"ProblemDetails":{"type":"object","properties":{"type":{"type":["null","string"]},"title":{"type":["null","string"]},"status":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"detail":{"type":["null","string"]},"instance":{"type":["null","string"]}}}}}}
```

## PATCH /v1/files/{id}

> Renames and/or moves a file (only the given field(s) change).

```json
{"openapi":"3.1.1","info":{"title":"Easyday Tenant API","version":"v1"},"tags":[{"name":"Files"}],"paths":{"/v1/files/{id}":{"patch":{"tags":["Files"],"summary":"Renames and/or moves a file (only the given field(s) change).","parameters":[{"name":"id","in":"path","required":true,"schema":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":"integer","format":"int32"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateFileRequest"}},"text/json":{"schema":{"$ref":"#/components/schemas/UpdateFileRequest"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/UpdateFileRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/FileVm"}},"application/json":{"schema":{"$ref":"#/components/schemas/FileVm"}},"text/json":{"schema":{"$ref":"#/components/schemas/FileVm"}}}},"400":{"description":"Bad Request","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}},"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}},"text/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}},"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}},"text/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}},"components":{"schemas":{"UpdateFileRequest":{"type":"object","properties":{"filename":{"type":["null","string"]},"folderId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"}},"description":"At least one of Filename/FolderId must be set - only the given field(s) change."},"FileVm":{"required":["id","folderId","filename","mimeType","sizeBytes","downloadUrl"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"folderId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"filename":{"type":"string"},"mimeType":{"type":"string"},"sizeBytes":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int64"},"mediaWidth":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"mediaHeight":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"downloadUrl":{"type":"string","description":"Points at this same API's GET /v1/files/{id}/content endpoint."}}},"ErrorResponse":{"required":["error"],"type":"object","properties":{"error":{"type":"string"}},"description":"Error response shape used by 400 Bad Request responses."},"ProblemDetails":{"type":"object","properties":{"type":{"type":["null","string"]},"title":{"type":["null","string"]},"status":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"detail":{"type":["null","string"]},"instance":{"type":["null","string"]}}}}}}
```

## GET /v1/files/{id}/content

> Streams the raw file bytes (supports HTTP range requests).

```json
{"openapi":"3.1.1","info":{"title":"Easyday Tenant API","version":"v1"},"tags":[{"name":"Files"}],"paths":{"/v1/files/{id}/content":{"get":{"tags":["Files"],"summary":"Streams the raw file bytes (supports HTTP range requests).","parameters":[{"name":"id","in":"path","required":true,"schema":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":"integer","format":"int32"}}],"responses":{"404":{"description":"Not Found","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}},"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}},"text/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}},"components":{"schemas":{"ProblemDetails":{"type":"object","properties":{"type":{"type":["null","string"]},"title":{"type":["null","string"]},"status":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"detail":{"type":["null","string"]},"instance":{"type":["null","string"]}}}}}}
```

## GET /v1/files/folders

> Lists all folders for the authenticated tenant (use ParentId to reconstruct the tree).

```json
{"openapi":"3.1.1","info":{"title":"Easyday Tenant API","version":"v1"},"tags":[{"name":"Files"}],"paths":{"/v1/files/folders":{"get":{"tags":["Files"],"summary":"Lists all folders for the authenticated tenant (use ParentId to reconstruct the tree).","responses":{"200":{"description":"OK","content":{"text/plain":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/FolderVm"}}},"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/FolderVm"}}},"text/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/FolderVm"}}}}}}}}},"components":{"schemas":{"FolderVm":{"required":["id","title"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"parentId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"title":{"type":"string"}}}}}}
```

## POST /v1/files/folders

> Creates a new folder.

```json
{"openapi":"3.1.1","info":{"title":"Easyday Tenant API","version":"v1"},"tags":[{"name":"Files"}],"paths":{"/v1/files/folders":{"post":{"tags":["Files"],"summary":"Creates a new folder.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateFolderRequest"}},"text/json":{"schema":{"$ref":"#/components/schemas/CreateFolderRequest"}},"application/*+json":{"schema":{"$ref":"#/components/schemas/CreateFolderRequest"}}},"required":true},"responses":{"201":{"description":"Created","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/FolderVm"}},"application/json":{"schema":{"$ref":"#/components/schemas/FolderVm"}},"text/json":{"schema":{"$ref":"#/components/schemas/FolderVm"}}}},"400":{"description":"Bad Request","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}},"application/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}},"text/json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}},"components":{"schemas":{"CreateFolderRequest":{"required":["title"],"type":"object","properties":{"title":{"type":"string"},"parentId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"}}},"FolderVm":{"required":["id","title"],"type":"object","properties":{"id":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["integer","string"],"format":"int32"},"parentId":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"title":{"type":"string"}}},"ProblemDetails":{"type":"object","properties":{"type":{"type":["null","string"]},"title":{"type":["null","string"]},"status":{"pattern":"^-?(?:0|[1-9]\\d*)$","type":["null","integer","string"],"format":"int32"},"detail":{"type":["null","string"]},"instance":{"type":["null","string"]}}}}}}
```
