POST
/
v1
/
ai
/
gemini-2-5-flash-image-preview
Image generation and editing using Gemini 2.5 Flash
curl --request POST \
  --url https://api.freepik.com/v1/ai/gemini-2-5-flash-image-preview \
  --header 'Content-Type: application/json' \
  --header 'x-freepik-api-key: <api-key>' \
  --data '{
  "prompt": "A beautiful sunset over mountains with vibrant orange and purple skies",
  "reference_images": [
    "iVBORw0KGgoAAAANSUhEUgAAASwAAAEsAQAAAABRBrPYAAABrElEQVR4nO3BMQEAAADCoPVPbQ0Po...",
    "https://example.com/reference-image.jpg"
  ],
  "webhook_url": "https://www.example.com/webhook"
}'
{
"data": {
"generated": [],
"task_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"status": "CREATED"
}
}

Authorizations

x-freepik-api-key
string
header
required

Your Freepik API key. Required for authentication. Learn how to obtain an API key

Body

application/json
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.

Example:

"A beautiful sunset over mountains with vibrant orange and purple skies"

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.

Maximum length: 3

Reference image as Base64 encoded string or publicly accessible URL

Example:
[
"iVBORw0KGgoAAAANSUhEUgAAASwAAAEsAQAAAABRBrPYAAABrElEQVR4nO3BMQEAAADCoPVPbQ0Po...",
"https://example.com/reference-image.jpg"
]
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.

Example:

"https://www.example.com/webhook"

Response

OK - The task exists and the status is returned

data
object
required
Example:
{
"generated": [
"https://openapi-generator.tech",
"https://openapi-generator.tech"
],
"task_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"status": "CREATED"
}