---
title: "POST /ai/image_generation"
method: POST
path: "/ai/image_generation"
---

# POST /ai/image_generation

`POST /ai/image_generation`

## Request

- Base URL: `https://api.jigsawstack.com/v1`
- URL: `https://api.jigsawstack.com/v1/ai/image_generation`
- Auth: API key in header `x-api-key`

## Request body

- object
  - `prompt` string, required
  - `aspect_ratio` '1:1' | '16:9' | '21:9' | '3:2' | '2:3' | '4:5' | '5:4' | '3:4' | '4:3' | '9:16' | '9:21'
  - `width` number, nullable
  - `height` number, nullable
  - `steps` number
  - `output_format` 'png' | 'svg'
  - `advance_config` object, nullable
    - `negative_prompt` string, nullable
    - `guidance` number, nullable
    - `seed` number, nullable
  - `url` string, nullable
  - `file_store_key` string, nullable
  - `return_type` 'url' | 'base64' | 'binary'

## Response `200`

Successful response

- object
  - `success` boolean: Whether the request was successful
  - `data` object: Response data
  - `error` object: Error details if request failed
    - `message` string: Error message
    - `code` string: Error code

## Other responses

- `400`: Bad Request - The request was malformed or contained invalid parameters
- `401`: Unauthorized - Authentication credentials are missing or invalid
- `403`: Forbidden - The request is not allowed
- `404`: Not Found - The requested resource was not found
- `500`: Internal Server Error - Something went wrong on our end

---

[API](https://skmtc.dev/jigsawstack/apis/jigsawstack-api.md) · [All operations](https://skmtc.dev/jigsawstack/apis/jigsawstack-api/llms.txt) · [OpenAPI document](https://skmtc.dev/jigsawstack/apis/jigsawstack-api/revisions/8bd803916bde?raw)
