---
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

---

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