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

# Troubleshooting

> Diagnose key, credit, job, and stream failures without exposing secrets.

# Troubleshooting

## Check the key and the account first

```bash theme={null}
curl https://api.dreamlayer.io/v1/capabilities \
  -H "Authorization: Bearer $DREAMLAYER_API_KEY" \
  -H "DreamLayer-Version: 1"
```

A `200` proves the key is valid and the account is enabled. This call reaches no provider and spends nothing, so it is the safe first step in any investigation.

## Every request returns 401

The key is wrong, revoked, or belongs to an account that is not enabled. Check the Developer console. If you are running the MCP server or the CLI from an editor or a launcher, confirm the key is present in that process's own environment: a key exported in your shell does not reach a subprocess.

## Every request returns 402

The account is out of credits. A new account starts at zero. Buy a pack on the Billing page.

## A job stopped after a refresh or a dropped connection

Read canonical job state before doing anything else. Do not submit a new request automatically. Reconnect to the event stream with `Last-Event-ID` to pick up where you left off, and reuse the original idempotency key after an uncertain response so a retry replays rather than pays twice.

## The stream asked a question instead of making an image

That is not a failure. An ambiguous prompt produces a `question` event ending in `needs_input`. Answer with `respond` plus the `conversation_id`, or name the `operation` on the original request so DreamLayer never has to interpret it.

## My answer to a question returns 422

The question needed more than text. `GET /v1/executions/{execution_id}` returns the outstanding `question` while the status is `needs_input`, and `question.requires_asset` says whether the answer must also carry `input_asset_id`. The `422` names the missing field in `error.details.field`. The question stays outstanding after a refusal, so correct the request and send it again with a new idempotency key, or `POST /v1/executions/{execution_id}/cancel` to abandon the turn. Once you answer, follow the execution ID the answer returns: the execution that asked stays at `needs_input` with a null `question` and is superseded, not updated.

## The download fails or returns something that is not an image

Follow redirects. Large assets are served directly from storage rather than proxied, so a client that does not follow a redirect receives the redirect itself.

## A request returns an error code

Treat `401`, `402`, `403`, `409`, `422`, `429`, and `503` differently: only `429` and `503` are
worth retrying. See [error codes](/agent-api/errors) and
[idempotency and retries](/agent-api/idempotency-and-retries).

## Still stuck

Email [hello@dreamlayer.io](mailto:hello@dreamlayer.io) with the execution ID from the `started` event. That identifier is
enough to find the job, and it exposes nothing about your prompt or your image.


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