Create image edit
POST
https://api.openai.com/v1/images/edits
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.openai.com/v1/images/edits' \
--header 'Authorization: Bearer ' \
--form 'image=@"cmMtdXBsb2FkLTE2ODc4MzMzNDc3NTEtMjA=/31225951_59371037e9_small.png"' \
--form 'prompt="A cute baby sea otter wearing a beret."' \
--form 'n="2"' \
--form 'size="1024x1024"' \
--form 'response_format="url"' \
--form 'user=""'
Response Response Example
{
"created": 1589478378,
"data": [
{
"url": "https://..."
},
{
"url": "https://..."
}
]
}
Request
Header Params
Authorization
stringย
optional
Example:
Bearer {{YOUR_API_KEY}}
Body Params multipart/form-data
image
fileย
required
Example:
cmMtdXBsb2FkLTE2ODc4MzMzNDc3NTEtMjA=/31225951_59371037e9_small.png
mask
fileย
optional
image
ย should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions asย image
.Example:
[]
prompt
stringย
required
Example:
A cute baby sea otter wearing a beret.
n
stringย
optional
Example:
2
size
stringย
optional
256x256
,ย 512x512
, orย 1024x1024
.Example:
1024x1024
response_format
stringย
optional
url
ย orย b64_json
.Example:
url
user
stringย
optional
Responses
Modified atย 2024-12-23 06:20:38