POST /images/edits to change an image you already have. Send the image and tell the model what to change and what to keep.
Try image editing
Open the endpoint reference and build a request.
Choose a model
Find an image model in the model catalog or use the List models endpoint. Look forcapabilities.image_editing: true and use the model’s public id. Check limits for the prompt length, reference count, resolutions, and aspect ratios the model supports.
Send an edit request
SetNOMASK_API_KEY to your NoMask API key, set NOMASK_IMAGE_MODEL to your chosen model ID, and place a PNG named reference.png next to your script. If the model requires more than one reference, add the required files before sending the request.
Reference images and output options
- Multipart. Send one file as
image, or repeatimage[]for multiple files. - JSON. Send an array of base64 data URLs in
images. Theimagealias accepts a single data URL or an array. Use one field per request. - Limits. Send at least one reference and stay within your model’s reference limits. PNG, JPEG, and WebP are accepted. References can total up to 25 MiB, and the full JSON body can be up to 40 MiB.
- Output. The endpoint returns one image per request (
n=1). PNG is the default. Useoutput_formatforjpgorwebp, and useresolutionoraspect_ratioto choose settings listed by the model.
Save the edited image
A successful request returns one image indata[0].b64_json. Decode it and save the bytes using the returned mime_type. The response also includes the actual width and height, the number of references used in nomask.reference_images, and the charge in nomask.cost_usd. Paid requests use your API balance.
The Python example saves the image directly. If you ran the cURL example, the image is in edit-response.json. Use jq and base64 to extract the PNG.
Troubleshoot an edit
For the full error list, see Errors.