Skip to main content

Files API

The Files API enables uploading source documents and listing resource IDs that can be resolved through the authenticated document-session endpoint.

List Files

Retrieve all files in a specific container (folder) for your organization.

Path Parameters

Request Example

Response

Response Fields

Status Codes

  • 200 OK: Successfully retrieved file list
  • 400 Bad Request: Authentication failed
  • 401 Unauthorized: Missing or invalid Bearer token
  • 500 Internal Server Error: S3 operation failed

Upload File

Upload a file to S3. Automatically converts DOCX to PDF (except in templates container). Validates file type by extension and MIME type.

Request

Content-Type: multipart/form-data

Supported File Types

  • .docx - Word documents
  • .pdf - PDF documents
  • .csv - CSV files
  • .xlsx - Excel spreadsheets
  • .rtf - Rich Text Format

Request Example

Python Example

Response

Status Codes

  • 200 OK: File uploaded successfully
  • 400 Bad Request: File validation failure (invalid type, size, etc.)
  • 401 Unauthorized: Missing or invalid Bearer token
  • 500 Internal Server Error: S3 upload failed

Error Examples

Invalid File Type:
Missing Required Field:

Auto-Conversion: DOCX to PDF

Files uploaded as .docx are automatically converted to PDF (except in the templates container):
  • Input: document.docx
  • Output: document.pdf
  • Exception: Files uploaded to templates container are not converted
This ensures compatibility with document processing pipelines while allowing template files to remain in their original format.

Container Types

Common container names and their purposes:

Downloading Files

For source-file viewers, use POST /source-file with the source file’s resource_id and the user’s organization Bearer token. This endpoint authorizes the user on every request and does not accept a document session token:
OnlyOffice uses the separate POST /document-file-session and POST /generate-onlyoffice-config flow. For ordinary session-based document viewers, use the session endpoint to obtain a short-lived session token:
Never put the document session token in ?session_token=.... Query strings are commonly captured by access logs, browser history, proxies, and monitoring systems. The query-string form is reserved for the OnlyOffice server-to-server request and is accepted only when accompanied by a separately signed OnlyOffice JWT; a copied URL alone cannot download the file.