---
title: "Upload a file"
method: POST
path: "/api/files/actions/upload"
tags: ["Files"]
---

# Upload a file

`POST /api/files/actions/upload`

# Errors
Returns an error if file upload, database operations, or file system operations fail.

## Response `200`

File with same content already exists, returning existing file

- FileUploadResponse — Response for file upload operations
  - `file` UserFileInfo, required — User file information for API responses
    - `createdAt` string, date-time, nullable — File upload timestamp
    - `fileHash` string, required — SHA-256 hash of the file
    - `fileSize` integer, required — Size of the file in bytes
    - `filename` string, required — Current filename
    - `id` string, uuid, required — File's unique identifier
    - `metadata` Value — Flexible JSON value that can be an object, array, string, number, boolean, or null
    - `mimeType` string, required — MIME type of the file
    - `originalFilename` string, required — Original filename as uploaded by user
    - `status` 'uploaded' | 'processing' | 'processed' | 'failed' | 'deleted', required — File processing status for user uploaded files
    - `updatedAt` string, date-time, nullable — File last update timestamp
    - `userId` string, uuid, required — ID of the user who owns this file
  - `message` string, required — Upload confirmation message

## Other responses

- `201` — File uploaded successfully
- `400` — Invalid file upload request or malformed file data
- `401` — Authentication required for file upload
- `413` — Uploaded file exceeds maximum size limit
- `500` — Server error during file upload or storage

## Changes

- **2026-07-17** `1583b1f4c97d` — 1 info
  - added the success response with the status `200`
- **2025-09-24** `ad76e6bdf403` — 2 info
  - the endpoint scheme security `bearerAuth AND cookieAuth` was added to the API
  - the endpoint scheme security `cookieAuth` was removed from the API
- **2025-09-22** `861532a21ad9` — 5 breaking, 2 warning, 7 info
  - removed the required property `file/file_hash` from the response with the `201` status
  - removed the required property `file/file_size` from the response with the `201` status
  - removed the required property `file/mime_type` from the response with the `201` status
  - removed the required property `file/original_filename` from the response with the `201` status
  - …10 more
- **2025-09-22** `93deff514935` — 1 info
  - endpoint added
- **2025-09-01** `a2488be8a6e4` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/patroninc/apis/patron-api/changes/api/files/actions/upload/post.md)

---

[API](https://skmtc.dev/patroninc/apis/patron-api.md) · [All operations](https://skmtc.dev/patroninc/apis/patron-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/patroninc/patron-api/revisions/1583b1f4c97d/schema)
