Upload a file, then generate
All guides

Guide · 6 min read

Upload a file, then generate

Ingest a photo. Get a 24-hour CDN URL. Pass it as image_url on the next job.

POST /v2/files accepts multipart field file, or JSON { url }. Images up to 20 MB. The response is file_{id} plus a url that expires in 24 hours.

Pass that url as input.image_url on goonify/flux2, goonify/faceswap, goonify/wan22, or a preset. Do not send raw bytes on the job itself.

A stable file URL you can reuse until it expires, then a generated result.

Steps

  1. 1

    POST /v2/files with multipart file or JSON { url }.

  2. 2

    Read the file_{id} url. It expires in 24 hours.

  3. 3

    Pass that url as input.image_url on the next job.

  4. 4

    Do not send raw bytes on the job itself.

Install the SDK

pip install "goonify @ git+https://github.com/Goonify/goonify.git#subdirectory=sdks/python"

Modelgoonify/flux2

from goonify import Goonify

client = Goonify()

uploaded = client.files.create(url="https://example.com/source.jpg")
job = client.run(
    "goonify/flux2",
    input={
        "prompt": "same pose, golden hour lighting, film still",
        "image_url": uploaded.url,
    },
)
print(job.output["url"])

What it looks like

Run it with a sandbox key

Sandbox keys return example media and spend nothing. Switch to a live key when you are ready.

Next recipes