Files
File CRUD plus versioning, copy, move, and restore. Every file lives inside a share and (optionally) inside a folder.
Base path: /api/v1/files/
File metadata shape#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
Get file metadata#
1 2 | |
1 2 3 4 5 | |
1 2 3 4 | |
Requires READ on the file.
Download file content#
1 2 3 | |
1 2 3 4 5 | |
1 2 3 4 5 | |
Query parameter ?version=N downloads a specific version. Without it, you get the current version.
Response headers:
Content-Length— full file sizeContent-Disposition: attachment; filename="..."— original filenameAccept-Ranges: bytes— range requests supported
For large files, use Range: bytes=0-999 to fetch a byte range. The server responds with 206 Partial Content.
Upload a file#
1 2 3 4 5 | |
1 2 3 4 5 6 7 | |
1 2 3 4 5 6 7 8 9 | |
Multipart fields:
| Field | Required | Notes |
|---|---|---|
share_id |
Yes | Destination share |
folder_id |
No | Destination folder; omit for share root |
name |
No | Override the filename |
file |
Yes | File content |
Requires CREATE on the destination folder (or on the share, if uploading to the root).
If a file with the same name exists at the destination, the server returns 409 NAME_CONFLICT. To update instead, use the update flow (upload to an existing file via the resumable upload protocol with replace_file_id — see Resumable Uploads) or rename first.
For files over 100 MB, use the resumable upload protocol. The multipart endpoint has a hard limit (default 5 GB, tenant-configurable).
Update file metadata#
Rename, move, or update attributes:
1 2 3 4 | |
Requires WRITE on the file. Renaming a file records a renamed change in the change log.
Delete a file#
Soft delete (default):
1 2 | |
Permanent delete:
1 2 | |
Requires DELETE on the file. Soft-deleted files can be restored (via the same PATCH endpoint with a restore flag) for as long as the tenant's trash retention allows.
Legal Hold and Retention policies may block deletion — see Enterprise Compliance.
Copy a file#
1 2 3 4 5 6 7 | |
Either target_folder_id (same share) or target_share_id (across shares) must be set.
Requires READ on the source and CREATE on the target. Cross-share copies respect deduplication — the copied file's chunks are shared with the original, not duplicated.
Move a file#
1 2 3 4 | |
Requires DELETE on the source and CREATE on the target. The file keeps its ID; version history is preserved.
List file versions#
1 2 | |
See Versioning and Deduplication for the versions response shape.
Restore a previous version#
1 2 | |
Creates a new version (e.g., version 5) with the content of version 2. Requires WRITE.
Error cases#
| Code | When |
|---|---|
NOT_FOUND |
File doesn't exist or caller can't see it |
AUTHZ_PERMISSION_DENIED |
Missing required permission |
NAME_CONFLICT |
Destination already has a file with this name |
PAYLOAD_TOO_LARGE |
Upload exceeds tenant's max file size |
QUOTA_EXCEEDED |
Share, user, or tenant quota would be exceeded |
RESOURCE_DELETED |
File was soft-deleted; restore before reuse |
See Errors for the full error vocabulary.
What's next#
- Folders — folder CRUD and hierarchical queries.
- Uploads and Downloads — resumable uploads and range downloads.
- Sync — pulling file changes across devices.