Skip to main content
POST
Image-to-Image Editing

Edit Images

Edit existing images using Google Gemini 2.5 Flash Image with text instructions.

Endpoint

Description

Edit existing images using Google Gemini 2.5 Flash Image with text instructions. This endpoint is specifically designed for image-to-image editing where:
  • An image file is required (unlike /images/generations where it’s optional)
  • A text prompt describes how to edit or transform the image
  • The edited image is returned with the same quality and format options
All prompts and responses are automatically processed through SMLTP for audit logging and compliance.

Authentication

Required: API Key

Request Body

This endpoint accepts multipart/form-data format.

Parameters

Request Examples

cURL

JavaScript/Node.js

Python

Response

Success Response (200)

Response Fields

Image Object

Metadata Object

Error Responses

400 Bad Request

401 Unauthorized

403 Forbidden

413 Payload Too Large

500 Internal Server Error

503 Service Unavailable

Notes

  • Supported image formats: JPEG, PNG, WEBP, GIF
  • Maximum file size: 10MB per image
  • The image file is required for this endpoint (unlike /images/generations)
  • The prompt describes how to edit or transform the uploaded image
  • All requests are processed through SMLTP for security and compliance
  • Use response_format: "b64_json" to receive base64-encoded image data instead of URLs

Authorizations

Authorization
string
header
required

API key authentication using Bearer token format. Example: Authorization: Bearer sk-your-api-key-here

Body

multipart/form-data
prompt
string
required

Text instructions describing how to edit or transform the uploaded image

Required string length: 1 - 4000
Example:

"Add dramatic sunset colors to the sky and enhance the overall atmosphere"

image
file
required

Image file to edit (required, JPEG, PNG, WEBP, or GIF, max 10MB)

smltp_policy
string
default:internal

SMLTP security policy to apply (e.g., 'internal', 'public', 'confidential', 'hipaa', 'gdpr')

Example:

"internal"

response_format
enum<string>
default:url

The format of the response images

Available options:
url,
b64_json
Example:

"url"

Response

Image edited successfully

success
boolean
Example:

true

id
string

Unique request identifier

Example:

"f55bb4aa-ad9a-4b5a-9c94-511bf6fce806"

object
string
Example:

"image.edit"

created
integer

Unix timestamp of when the image was edited

Example:

1705312200

data
object[]

Array of edited images

metadata
object