# AI: generate an image (async)

> Eto API reference for `POST /api/v1/ai/generate-image`. Base URL `https://eto.tools/api/v1/`. Authenticate with the `X-Eto-API-Key` header.

Part of the [Eto API reference](https://eto.tools/dev/docs/). The full reference in one file is at [llms-full.txt](https://eto.tools/dev/docs/llms-full.txt); the machine-readable schema is at [openapi.json](https://eto.tools/dev/docs/openapi.json).

## POST /api/v1/ai/generate-image

AI: generate an image (async)

- Operation ID: `ai_generate_image`
- Slug: `ai-generate-image`
- Category: AI Studio
- Authentication: API key only. Reads or writes data Eto holds for your own account.
- HTML: https://eto.tools/dev/docs/#ep-ai-generate-image
- Markdown: https://eto.tools/dev/docs/ai-studio/ai-generate-image.md

Start an AI image generation job from a text prompt. Returns a job_id; poll ai_generate_image_status for the result.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `prompt` | body | `string` | yes | Image prompt |

### Request

```bash
curl -X POST "https://eto.tools/api/v1/ai/generate-image" \
  -H "X-Eto-API-Key: eto_your_key" \
  -H "Content-Type: application/json" \
  -d '{
  "prompt": "A leather wallet on a walnut desk, soft daylight"
}'
```

```python
import requests

url = "https://eto.tools/api/v1/ai/generate-image"
headers = {"X-Eto-API-Key": "eto_your_key"}
payload = {
    "prompt": "A leather wallet on a walnut desk, soft daylight"
}

response = requests.post(url, headers=headers, json=payload, timeout=120)
response.raise_for_status()
print(response.json())
```

```javascript
const url = "https://eto.tools/api/v1/ai/generate-image";
const payload = {
  "prompt": "A leather wallet on a walnut desk, soft daylight"
};

const response = await fetch(url, {
  method: "POST",
  body: JSON.stringify(payload),
  headers: {
    "X-Eto-API-Key": "eto_your_key",
    "Content-Type": "application/json",
  },
});
if (!response.ok) throw new Error(`Eto API ${response.status}`);
const data = await response.json();
```

### Response

`application/json`. This endpoint has no worked response example in the registry yet; the [HTML reference](https://eto.tools/dev/docs/#ep-ai-generate-image) shows the fields it returns.

### Errors

Failures answer with the shared error body described in the Errors section: `{"error": {"code", "status", "message", "hint", "docs"}}`. Branch on `code`, not on the message.
