Documentation

API Reference
POST

Image Edits

/v1/images/edits

Edit an existing image based on a new text prompt using various models available through A4F.

Interactive Example

Request & Response Example

curl https://api.a4f.co/v1/images/edits \
-H "Authorization: Bearer YOUR_A4F_API_KEY" \
-F 'image=@/path/to/your/image.png' \
-F 'prompt=Add a cute hat to the subject' \
-F 'model=provider-3/flux-kontext-pro'

Headers

Authorization

string
Required
Bearer token for authentication. Your A4F API key. Example: Bearer ddc-a4f-xxxxxxxx.

Content-Type

string
Required
Must be multipart/form-data. Your HTTP client will typically set this automatically when sending form data.

Request Body (Multipart Form)

model

string
Required
ID of the image editing model to use. Must include the provider prefix and be of type images/edits.

image

file
Required
The image file to edit. Must be a valid PNG, JPEG, GIF, or WEBP file, less than 4MB in size.

prompt

string
Required
A text description of the desired edit to apply to the image.

response_format

string
The format in which the edited image is returned. Must be one of url or b64_json.

Default: url

user

string
A unique identifier representing your end-user, which can help in monitoring and detecting abuse.

Response Body (200 OK)

The response structure is identical to the image generation endpoint.

created

integer
The Unix timestamp of when the edit was processed.

data

array of objects
An array containing the edited image data.

b64_json

string
The base64-encoded JSON of the edited image, if requested.

url

string
The URL of the edited image. URLs are temporary and will expire.

Was this page helpful?