# Generate Image（生成图片）

**方法**: `POST`
**路径**: `/recraft/v1/images/generations`

realistic\_image

## 请求参数

### Header 参数

```text
Authorization
string
可选
默认值:
Bearer {{YOUR_API_KEY}}
```

### Body 参数 application/json

```text
prompt
string
必需
size
string
可选
style
string
可选
realistic_image
style_id
string
可选
style_id和style参数是互斥的，如果两个参数都没有指定，则使用realistic_image默认样式
substyle
string
可选
response_format
string
可选
url b64_json
controls
object
可选
可以通过一些调整来调整生成过程。
colors
string
一系列可取的颜色
可选
background_color
string
可选
使用给定的颜色作为所需的背景颜色
示例
{
"prompt"
:
"string"
,
"size"
:
"string"
,
"style"
:
"string"
,
"style_id"
:
"string"
,
"substyle"
:
"string"
,
"response_format"
:
"string"
,
"controls"
:
{
"colors"
:
"string"
,
"background_color\t"
:
"string"
}
}
```

## 请求示例代码

### Shell

```bash
curl --location --request POST '/recraft/v1/images/generations' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "prompt": "string",
    "size": "string",
    "style": "string",
    "style_id": "string",
    "substyle": "string",
    "response_format": "string",
    "controls": {
        "colors": "string",
        "background_color\t": "string"
    }
}'
```

## 返回响应

### 🟢 200 成功

**内容类型**: `application/json`

#### 响应结构

```text
object
```

#### 示例

```json
{}
```
