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

# Upload a file

`POST /v1/files`

## Request

- Base URL: `https://zernio.com/api`
- URL: `https://zernio.com/api/v1/files`
- Auth: HTTP bearer

Either `multipart/form-data` with the file under `file` plus `accountId`, `name` (defaults to the file name) and `parentId`, or JSON with a public `url` the file is fetched from (100 MB cap). Large files go through the provider's resumable upload.

## Request body

- object
  - `accountId` string, required
  - `name` string, required
  - `contentType` string, required
  - `parentId` string: Target folder; the root when omitted.
  - `url` string, uri, required
  - `convertTo` 'application/vnd.google-apps.document' | 'application/vnd.google-apps.spreadsheet' | 'application/vnd.google-apps.presentation': Google Drive only: import the bytes as a Docs, Sheets or Slides file (a text or Office file becomes an editable document). OneDrive answers 400.

## Response `201`

The stored file

- object
  - `data` FileItem: A file or folder in a connected Google Drive or OneDrive. Ids are the provider's own.
    - `id` string, required
    - `accountId` string, required
    - `provider` 'google' | 'microsoft', required
    - `name` string, required
    - `kind` 'file' | 'folder', required
    - `mimeType` string, nullable, required
    - `size` integer, nullable, required: Bytes; null for folders and Google editors files.
    - `parentId` string, nullable, required
    - `webUrl` string, nullable, required: The provider's own link to open the item.
    - `downloadable` boolean, required: False for folders and for Drive files whose owner disabled downloading.
    - `exportMimeType` string, nullable: Google Docs, Slides and Drawings download as PDF/PNG and Sheets as XLSX; this is the type the download carries.
    - `createdAt` string, date-time, nullable, required
    - `modifiedAt` string, date-time, nullable, required
    - `trashed` boolean, required

## Other responses

- `400`: Invalid request
- `401`: Missing or invalid API key. `code` is `missing_credentials` when no Authorization header was sent and `invalid_credentials` when the key is unknown, revoked or expired.
- `412`: The connected account cannot serve this request until something outside the request changes. Two codes: - `account_scope_missing`: the account was connected without the area this endpoint needs (`details.grantedAreas`, `details.missingArea`), or Google reports the grant lacks a permission. Reconnect with a wider `scopes=`. - `admin_consent_required` (Microsoft): the tenant requires an administrator's approval. `details.adminConsentUrl` is the Microsoft Entra admin-consent link to hand to one; it opens in a browser with no API key and stays valid for one hour. `GET /v1/connect/microsoft/admin-consent` mints a fresh one.

## Changes

- **2026-10-27** `0a24331f5431`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/zernio/apis/zernio-api/changes/v1/files/post.md)

---

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