> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fanifyai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Files

> Upload files to Fanify Hub and use their temporary URLs.

Use `POST /api/v1/hub/files` to obtain a temporary URL for model fields with the URI format.

```bash theme={null}
curl https://fanifyai.com/api/v1/hub/files \
  -H "Authorization: Bearer $FANIFY_API_KEY" \
  -F "file=@reference.png;type=image/png"
```

```json theme={null}
{
  "id": "8Jd2kQ7pR1sT4uV6wX9yZ0aB2cD4eF6gH8iJ0kL2mN4",
  "url": "https://fanifyai.com/api/v1/hub/files/8Jd2kQ7pR1sT4uV6wX9yZ0aB2cD4eF6gH8iJ0kL2mN4",
  "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
  "size": 812345,
  "media_type": "image/png",
  "expires_at": "2026-09-08T10:00:00Z"
}
```

The multipart field must be named `file`. The maximum size is **50 MiB by default**. It can be lower depending on the service configuration.

## Reuse a file by its hash

Model fields with the URI format accept either the temporary URL or a `sha256:<64 hexadecimal characters>` reference. Build this reference from the `sha256` property returned by the upload.

The reference resolves only to an unexpired file uploaded by the same account. An unknown or expired hash, or one owned by another account, returns `400 invalid_input` when you submit the generation.

## Accepted types

Images: `image/png`, `image/jpeg`, `image/webp`, `image/gif`.

Video: `video/mp4`, `video/webm`, `video/quicktime`.

Audio and documents: `audio/mpeg`, `audio/wav`, `audio/ogg`, `application/pdf`, `application/octet-stream`.

<Warning>
  Uploaded files expire after **24 hours by default**. 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`.
</Warning>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.