Edit an image
Edit, transform, or compose one or more input images, guided by a text prompt.
With the OpenAI SDK, upload the input image(s) as multipart/form-data: client.images.edit(image=..., prompt=..., model=...), passing a list of files to compose several inputs. Over raw HTTP you can instead send a JSON body with an images array of image_url/file_id items (shown below); the OpenAI SDK does not send this JSON shape.
POST /images/edits
Edit one or more input images from a text prompt.
Request body
Content Type: application/json
Content Type: multipart/form-data
Response
HTTP 200: OK
Content Type: application/json
Content Type: text/event-stream
import json
import os
import requests
response = requests.post(
"https://api.meta.ai/v1/images/edits",
headers={
"Authorization": f"Bearer {os.environ['MODEL_API_KEY']}",
"Content-Type": "application/json",
},
json={
"model": "muse-image-1.0",
"prompt": "add a small red wool hat on the fox's head, keep the snowy forest background",
"images": [
{
"image_url": "data:image/webp;base64,UklGR...",
},
],
"n": 1,
},
)
response.raise_for_status()
print(json.dumps(response.json(), indent=2))curl -X POST "https://api.meta.ai/v1/images/edits" \
-H "Authorization: Bearer $MODEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "muse-image-1.0",
"prompt": "add a small red wool hat on the fox'\''s head, keep the snowy forest background",
"images": [
{
"image_url": "data:image/webp;base64,UklGR..."
}
],
"n": 1
}'For reference images, multi-image composition, and worked examples, see the Image generation feature page.
Mirrored from dev.meta.ai/docs/api-reference/images/edit-image (synced Oct 30, 2026). Text and examples © Meta. Live demos run on Muse Muse's key.