Skip to main content
A Fanify Hub file is identified by its SHA-256 hash. In a generation’s input, reference it as sha256:<64 hexadecimal characters>: this is the recommended form for every model field with the URI format.

Check before uploading

Compute the file’s hash, then ask the Hub whether it already has it. This route requires no authentication.
200: the Hub has the file, send nothing and use sha256:$HASH directly. 410 file_expired: upload the file.

Upload a file

duration_seconds is the duration of a video or audio file, measured by the Hub from its headers (MP4, MOV, WebM with a duration, WAV, MP3; 3 decimals). It is null for an image or a file whose duration cannot be read. A model priced on the duration of an input file is billed on this value (Models and pricing). Generation outputs carry it too when it is known. The multipart field must be named file. The maximum size is 1 GiB by default. It can be lower depending on the service configuration. Uploading content you already sent creates no duplicate: the response is the same (same sha256, kind upload) and the file’s lifetime is extended. Check with HEAD first to avoid a needless upload. url is the file’s download link. It is still accepted in an input, but prefer sha256:<hash>.

Reference a file in a generation

If the Hub does not have a referenced file, the submission returns 422 missing_resource and creates no generation. The missing property lists the hashes to supply:
Upload these files with POST /api/v1/hub/files, then resubmit the same request with the same Idempotency-Key. A public URL from another site is still accepted and forwarded as is to the provider, without going through the Hub, except in the input field whose duration sets the price of a model: the Hub never downloads that URL, so it cannot know its duration and answers 422 input_duration_unavailable. A legacy Hub file URL without a hash (/api/v1/hub/files/<token>) is rejected with 400 invalid_input: reference the file as sha256:<hash>.

Accepted types

Images: image/png, image/jpeg, image/webp, image/gif, image/bmp. Video: video/mp4, video/webm, video/quicktime, video/x-matroska, video/x-msvideo. Audio and documents: audio/mpeg, audio/wav, audio/ogg, audio/flac, audio/mp4, audio/aac, application/pdf, application/octet-stream.
An uploaded file expires 7 days by default after its last use: every generation that references it extends its expiry. Generated outputs expire after 7 days by default. The effective values remain available in expires_at and can vary with the service configuration. An expired download returns 410 file_expired.