---
title: "Upload a file"
method: POST
path: "/rest/v2/files"
tags: ["Files"]
---

# Upload a file

`POST /rest/v2/files`

## Request

- Base URL: `https://functions.prod.jarvi.tech/v1/public-api`
- URL: `https://functions.prod.jarvi.tech/v1/public-api/rest/v2/files`
- Auth: API key in header `X-API-KEY`

Upload a file to Nhost Storage. Returns the file ID for subsequent association with entities. Requires a private API key (PAT).

## Request body

- object
  - `data` string, required: Base64-encoded file content. Optionally prefixed with a data URI (e.g. "data:application/pdf;base64,...")
  - `fileName` string, required: File name including extension
  - `mimeType` string: MIME type. Inferred from data URI prefix if omitted.

## Response `201`

File uploaded successfully

- object
  - `fileId` string
  - `name` string
  - `mimeType` string
  - `size` integer

## Other responses

- `400`: Invalid request (missing fields or empty file)
- `401`: The X-API-KEY header is missing, unknown, or not privileged enough for this route.
- `413`: File too large
- `429`: The workspace has spent its hourly execution-time budget. Wait for the window to reset — the Retry-After header says how long — or run the job outside business hours, when nothing is metered.

## Changes

- **2026-11-03** `873dd84c25eb`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/jarvi/apis/jarvi-api/changes/rest/v2/files/post.md)

---

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