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

# Submit a file

`POST /files`

## Request

- Base URL: `https://us.app.zuva.ai/api/v2`
- URL: `https://us.app.zuva.ai/api/v2/files`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/zuva/apis/zuva-docai/docs/files/post.ts> (a function with typed inputs; its response is checked against the schema)

Upload a file to DocAI.

For best results, uploaded files should be whole documents (rather than pages, paragraphs or fragments).

The content type does not need to be specified, with the exception of eOCR files, which
must use the content type `application/eocr`.
If not provided, the content type will be automatically detected and returned in the
`attributes` of the response. Plain text content must be UTF-8 encoded.

For Microsoft Word documents (.doc and .docx extensions), the header value X-Attr-OCR=msword can be used to bypass OCR
and instead read the characters and layout directly from the original file.

Files are deleted from the system after 7 days by default, configurable to a maximum of 14 days.
Your file's expiration date can be found in the response of this API call

## Headers

- `X-Attr-OCR` 'auto' | 'ocr' | 'msword' | 'text' | 'eocr'
- `X-Attr-MSWord-GenerateImages` string

## Request body `application/octet-stream`

- string, binary

## Response `201`

The file was uploaded successfully

- FileCreatedResponse
  - `attributes` FileAttributes, required
    - `content-type` string, required: The provided or detected MIME type of the File.
    - `sha-256` string, required: The SHA-256 hash of the file's contents
  - `expiration` string, required: The file expiration in RFC3339 format
  - `file_id` string, required: The ID of the created file resource
  - `permissions` string[], required: Unused
  - `size` integer, required: The file size in bytes

## Other responses

- `400`: A required header was not specified, or contained an invalid value
- `401`: Unauthorized
- `403`: Forbidden
- `500`: Internal Server Error

## Changes

- **2023-12-13** `51f2a4c5de2e`: 1 breaking, 5 info
  - removed the media type `plain/text` from the request body
  - added the new optional `header` request parameter `X-Attr-MSWord-GenerateImages`
  - added the new optional `header` request parameter `X-Attr-OCR`
  - added the media type `application/msword` to the request body
  - …2 more

[Operation history](https://skmtc.dev/zuva/apis/zuva-docai/changes/files/post.md)

---

[API](https://skmtc.dev/zuva/apis/zuva-docai.md) - [All operations](https://skmtc.dev/zuva/apis/zuva-docai/llms.txt) - [OpenAPI document](https://skmtc.dev/zuva/apis/zuva-docai/revisions/7397ad071d55?raw)
