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

# Uploads

> Bring your own reference images with a direct-to-storage upload.

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

```bash theme={null}
curl -X POST https://app.dafty.ai/api/v1/uploads \
  -H "x-api-key: $DAFTY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "filename": "logo.png", "contentType": "image/png" }'
```

```json theme={null}
{ "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):

```bash theme={null}
curl -X PUT "$UPLOAD_URL" --upload-file ./logo.png -H "Content-Type: image/png"
```

## 3. Complete

```bash theme={null}
curl -X POST https://app.dafty.ai/api/v1/uploads/up_.../complete \
  -H "x-api-key: $DAFTY_API_KEY"
```

```json theme={null}
{ "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

```bash theme={null}
curl -X POST https://app.dafty.ai/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.
