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

Autorizações

Authorization
string
header
obrigatório

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

Corpo

multipart/form-data
prompt
string
obrigatório

Text instructions describing how to edit or transform the uploaded image

Required string length: 1 - 4000
Exemplo:

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

image
file
obrigatório

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

smltp_policy
string
padrão:internal

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

Exemplo:

"internal"

response_format
enum<string>
padrão:url

The format of the response images

Opções disponíveis:
url,
b64_json
Exemplo:

"url"

Resposta

Image edited successfully

success
boolean
Exemplo:

true

id
string

Unique request identifier

Exemplo:

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

object
string
Exemplo:

"image.edit"

created
integer

Unix timestamp of when the image was edited

Exemplo:

1705312200

data
object[]

Array of edited images

metadata
object