---
title: "Gemini 2.5 Flash - Create or edit image"
method: POST
path: "/v1/ai/gemini-2-5-flash-image-preview"
tags: ["text-to-image"]
---

# Gemini 2.5 Flash - Create or edit image

`POST /v1/ai/gemini-2-5-flash-image-preview`

## Request

- Base URL: `https://api.magnific.com`
- URL: `https://api.magnific.com/v1/ai/gemini-2-5-flash-image-preview`
- Auth: API key in header `x-magnific-api-key`

This endpoint allows you to generate or edit images using the Gemini 2.5 Flash model. You can provide a prompt for image generation, or include reference images for image editing and style transfer. The model supports both text-to-image generation and image-to-image editing with up to 3 reference images.

## Request body

- RequestContent7
  - `prompt` string, required: The prompt is a short text that describes the image you want to generate or edit. It can range from simple descriptions, like `"a cat"`, to detailed scenarios, such as `"a cat with wings, playing the guitar, and wearing a hat"`. This field is required for both image generation and editing.
  - `reference_images` string[]: Optional array of reference images for image editing. Each image can be provided as a Base64 encoded string or a publicly accessible URL. Maximum of 3 reference images allowed. If provided, the model will use these images as reference for editing or style transfer.
  - `webhook_url` string, uri: Optional callback URL that will receive asynchronous notifications whenever the task changes status. The payload sent to this URL is the same as the corresponding GET endpoint response, but without the data field.

## Response `200`

OK - The task exists and the status is returned

- InlineObject4
  - `data` TaskDetail1, required
    - `task_id` string, uuid, required: Task identifier
    - `status` 'CREATED' | 'IN_PROGRESS' | 'COMPLETED' | 'FAILED', required: Task status
    - `generated` string[], required

## Other responses

- `400`: Bad Request - The server could not understand the request due to invalid syntax.
- `401`: Unauthorized - The client must authenticate itself to get the requested response.
- `500`: Internal Server Error - The server has encountered a situation it doesn't know how to handle.
- `503`: Service Unavailable

---

[API](https://skmtc.dev/magnific/apis/magnific-api.md) · [All operations](https://skmtc.dev/magnific/apis/magnific-api/llms.txt) · [OpenAPI document](https://skmtc.dev/magnific/apis/magnific-api/revisions/60711fb082c7?raw)
