---
title: "Upload File"
method: POST
path: "/companies/{company_id}/files"
tags: ["files"]
---

# Upload File

`POST /companies/{company_id}/files`

## Request

- Base URL: `https://api.nanocorp.so` (the document declares no server; this is the origin it was published from)
- URL: `https://api.nanocorp.so/companies/{company_id}/files`
- Auth: HTTP bearer

Upload one file (multipart: ``file``, optional ``path``, ``source`` and ``overwrite``).

The multipart body is parsed MANUALLY inside the handler instead of
declaring ``UploadFile = File(...)`` parameters. FastAPI parses a declared
multipart body BEFORE dependencies run; with manual parsing, ownership auth
(``get_authorized_company``) and the rate limit run first, and the body's
size is bounded before it is read (``read_capped_form``: no length is a
411, an oversized one a 413, and the stream is counted as it arrives so a
lying client is refused mid-body). Starlette's multipart parser spools
parts over 1MB to a temp file, so large uploads never sit in RAM.
Trade-off: the OpenAPI requestBody for this route is intentionally
undocumented; the frontend uploads with a raw ``fetch`` + ``FormData``.

## Path parameters

- `company_id` string, uuid, required

## Response `200`

Successful Response

- CompanyFileResponse
  - `id` string, required
  - `path` string, required
  - `size_bytes` integer, required
  - `content_type` string, nullable, required
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/nanocorp/apis/nanocorp-api.md) - [All operations](https://skmtc.dev/nanocorp/apis/nanocorp-api/llms.txt) - [OpenAPI document](https://skmtc.dev/nanocorp/apis/nanocorp-api/revisions/291bb76b720b?raw)
