Open an upload session
POST /Platform/uploads/init
Open an upload session.
Declares the file up front; the response says how to send it: the
mode, the part_size and part_count, and in direct mode a
presigned part_urls map to PUT each part to. Form sessions must pass
field_id.
An agent with a shell and the file on disk: open the session in direct
mode with the exact byte size, send each part's bytes as the body
of an HTTP PUT to its URL with no credentials (the whole file when
there is one part; otherwise consecutive part_size byte ranges),
then call complete_upload. It returns a file-... handle you can
pass to any operation that takes a recording, document or image;
create with source=<handle> stores it as a pdf, image or audio
value when you want one. Proxied mode needs your API
credential on every part, which a sandbox does not have. Without a
shell, or for a person's own file, use an upload link instead.
Body parameters
filename: optional str. Original filename (also used to guess the content type).content_type: optional str. Media type; guessed fromfilenamewhen omitted.size: optional int. Exact file size in bytes (required); enforced at completion.mode: optional str.direct(default: parts go straight to storage through presigned URLs) orproxied(parts go through this API withput_part; for CLI and server-side callers).field_id: optional str. The form's file-upload field, for form sessions.link_id: optional str. The upload link this file answers (the upload-link page sends it); the link must be yours and still open.
Returns
UploadInitResponse
upload_id: str. Upload session identifier.mode: "direct" or "proxied". Part transport mode.part_size: int. Maximum bytes in each part.part_count: optional int or null. Expected number of parts.part_urls: optional Dict[str, str] or null. Presigned PUT URLs by part number.parts_received: optional List[int]. Already received part numbers.
Example request
curl -X POST "https://api.hilus.ai/Platform/uploads/init" \
-H "Authorization: Bearer $HILUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'