> ## 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.

# Quickstart

> Generate your first image in three calls: authenticate, generate, poll.

The Dafty API turns a prompt into an on-brand image. Generation is asynchronous: you create a **job**,
then poll it until it completes and returns image URLs.

## 1. Get an API key

Create a key from your dashboard at `/api-keys`. The plaintext key is shown **once** - store it
securely. Send it on every request as `x-api-key` (or `Authorization: Bearer`).

## 2. Start a generation

```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": "A minimalist logo of a mountain at sunrise, flat vector style",
    "aspectRatio": "1:1",
    "quality": "high",
    "resolution": "2K",
    "variations": 2
  }'
```

Returns `202 Accepted` with a pending job:

```json theme={null}
{ "data": { "id": "3f9a4c2e-...", "type": "image.generate", "status": "pending", "createdAt": "..." } }
```

Only `prompt` is required. `aspectRatio`, `quality` (`low|medium|high`), and `resolution`
(`1K|2K|4K`) have sensible defaults. Optionally pass a saved `styleId` and up to 4 `references`
(image URLs or upload/job ids).

## 3. Poll for the result

Use `?wait=true` to long-poll until the job finishes (up to \~55s):

```bash theme={null}
curl "https://app.dafty.ai/api/v1/jobs/3f9a4c2e-...?wait=true" \
  -H "x-api-key: $DAFTY_API_KEY"
```

```json theme={null}
{
  "data": {
    "id": "3f9a4c2e-...",
    "type": "image.generate",
    "status": "completed",
    "result": { "images": [{ "url": "https://cdn.../original.png", "width": 2048, "height": 2048 }] }
  }
}
```

Read the image from `data.result.images[0].url`. See [Polling & wait](/polling-and-wait) for the loop
and backoff details.

## Next steps

* [Authentication](/authentication) - keys, headers
* [Uploads](/uploads) - bring your own reference images
* [Idempotency](/idempotency) - safe retries
* [Errors](/errors) and [Rate limits](/rate-limits)
