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

# Quickstart

> Go from a new account to a finished image in one request.

# Quickstart

This is the image quickstart. To make a video with sound, start with the [Video quote-and-accept guide](/agent-api/text-to-video).

## What this lets you do

Make your first DreamLayer image from the command line, using nothing but `curl` and an API key.

## What you need

* A DreamLayer account at [platform.dreamlayer.io](https://platform.dreamlayer.io)
* Credits on that account. Every successful image costs one credit, and a new account starts at zero, so buy a pack before your first call
* An API key from the Developer console
* `curl`

## Steps

### 1. Store the key

```bash theme={null}
export DREAMLAYER_API_KEY="dlr_live_your_key_here"
```

Keep it in server configuration or a secrets manager. The full key is shown once, at creation, and never again.

### 2. Send the first request

```bash theme={null}
curl --no-buffer https://api.dreamlayer.io/v1/execute \
  -H "Authorization: Bearer $DREAMLAYER_API_KEY" \
  -H "DreamLayer-Version: 1" \
  -H "Idempotency-Key: greenhouse-001" \
  -H "Accept: text/event-stream" \
  -H "Content-Type: application/json" \
  -d '{"prompt":"A glass greenhouse at dusk","aspect_ratio":"1:1"}'
```

The stream emits `started`, `thinking`, `progress`, `job`, `question`, `asset`, and `done`. Only `done` is terminal. `thinking` carries no text and simply means work is in flight.

### 3. Choose deterministic execution when you already know the operation

By default DreamLayer reads the prompt and decides what you meant, which can come back as a `question` event asking you to clarify. A script that already knows what it wants can say so and skip that entirely:

```bash theme={null}
  -d '{"prompt":"A glass greenhouse at dusk","operation":"text_to_image"}'
```

`text_to_image` must not carry an `input_asset_id`. Every other operation requires one:
`image_to_image`, `background_remove`, and `upscale`.

`upscale` doubles each side, so the input's longest side must be 2048 or smaller. An
oversize request is refused before any provider is paid.

### 4. Download the result

The `asset` event carries a `download_url`. Follow redirects when you fetch it: large images are served straight from storage rather than proxied.

For example, the stream includes an event shaped like this:

```text theme={null}
event: asset
data: {"asset_id":"d34db33f-0000-4000-8000-000000000003","download_url":"https://api.dreamlayer.io/v1/image-jobs/d34db33f-0000-4000-8000-000000000004/asset"}
```

```bash theme={null}
# Copy the download_url value from the asset event:
DOWNLOAD_URL='https://api.dreamlayer.io/v1/image-jobs/d34db33f-0000-4000-8000-000000000004/asset'

curl -L -o image.png "$DOWNLOAD_URL" \
  -H "Authorization: Bearer $DREAMLAYER_API_KEY"
```

## Confirm it worked

The stream ends with a `done` event whose status is `completed`, the download writes a PNG, and the Usage page in the console shows one settled credit.

## Common errors

| Error | What to do |
| - | - |
| `401` | The key is wrong, revoked, or the account is not enabled. Check the Developer console. |
| `402` | The account is out of credits. Buy a pack on the Billing page. |
| `409` | The same `Idempotency-Key` was reused with a different body. Use a fresh key, or resend the original body to replay. |
| `422` | The request shape is wrong. `text_to_image` with an input asset, or `image_to_image` without one, both land here. |
| A `question` event arrives | The prompt was ambiguous. Answer with `respond` plus the `conversation_id`, or name the `operation` and avoid the round trip. |

## Troubleshooting

See [Troubleshooting](/troubleshooting) for stalled jobs, resumed streams, and asset retrieval.

## Next steps

* [Install the CLI](/cli)
* [Connect an MCP client](/mcp/index)
* [Send a reference image](/agent-api/image-to-image)
* [Make retries safe](/agent-api/idempotency-and-retries)


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