Files

Upload a file (max 200 MB) as a raw binary body or as multipart/form-data. For a raw body, set Content-Type to the file's media type; any non-JSON Content-Type is treated as the media type. When it's missing or generic, varg sniffs the type from magic bytes. Multipart uploads take the file in the file part (or the first file part) and an optional workspace_id text field.

Send X-Content-Hash: sha256:<hex> to enable deduplication — if your account already has a file with the same content, the existing file is returned instantly (deduplicated: true) without re-uploading. Use GET /files/check?hash= to pre-check before sending bytes.

post/files

Request

  • Base URL: https://api.varg.ai/v2
  • URL: https://api.varg.ai/v2/files
  • Auth: HTTP bearer

Headers

Content-Typestring
X-Content-Hashstring

sha256 hash of the bytes (with or without the sha256: prefix) for dedup

X-Filenamestring

Original filename

X-Workspace-Idstring

Folder (id or slug) to file the upload into. Wins over a multipart workspace_id field. An unknown folder returns 404 workspace_not_found.

Response

File stored (or deduplicated)

file_idstring required
urlstring required

Stable varg-hosted URL

hashstring nullable
sizeinteger required
media_typestring required
filenamestring nullable
titlestring nullable
subtitlestring nullable
metadataobject nullable
deduplicatedboolean required

true when an existing file with the same content was returned

origin'upload' | 'generated'

Present on /files/import responses

Changes