Skip to main content
To use your own image as a reference, upload it in three steps, then pass the returned id (or url) as a references entry on a generation. (You can also pass a public https image URL directly as a reference and skip uploading - we ingest and re-host it.)

1. Presign

curl -X POST http://localhost:3001/api/v1/uploads \
  -H "x-api-key: $DAFTY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "filename": "logo.png", "contentType": "image/png" }'
{ "data": { "uploadId": "up_...", "uploadUrl": "https://storage.../signed", "expiresIn": 3600 } }
Allowed contentType: image/png, image/jpeg, image/gif, image/webp.

2. PUT your bytes

Upload the file directly to the returned uploadUrl (this goes to storage, not the API):
curl -X PUT "$UPLOAD_URL" --upload-file ./logo.png -H "Content-Type: image/png"

3. Complete

curl -X POST http://localhost:3001/api/v1/uploads/up_.../complete \
  -H "x-api-key: $DAFTY_API_KEY"
{ "data": { "id": "up_...", "url": "https://cdn.../logo.png", "contentType": "image/png", "width": 512, "height": 512 } }
The server validates the real bytes (not the declared type) on completion.

Use it as a reference

curl -X POST http://localhost:3001/api/v1/images/generate \
  -H "x-api-key: $DAFTY_API_KEY" -H "Content-Type: application/json" \
  -d '{ "prompt": "Use this logo on a dark poster", "references": ["up_..."] }'
Up to 4 references per request. Each may be an upload id, a prior job id, or a public image URL.