Skip to main content
POST
/
v1
/
ai
/
text-to-image
/
flux-2-pro
curl --request POST \
  --url https://api.freepik.com/v1/ai/text-to-image/flux-2-pro \
  --header 'Content-Type: application/json' \
  --header 'x-freepik-api-key: <api-key>' \
  --data '
{
  "prompt": "a beautiful sunset over mountains with dramatic clouds"
}
'
{
"data": {
"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

Text description of the image you want to generate.

FLUX.2 [pro] delivers professional-grade image generation without requiring complex parameter tuning. The model automatically optimizes for quality and consistency.

Tips for better results:

  • Be specific about subjects, scenes, and visual details
  • Describe lighting, atmosphere, and mood
  • Mention art style or photographic techniques if desired

Examples:

  • Simple: "a cat sitting on a windowsill"
  • Detailed: "a fluffy orange tabby cat sitting on a rustic wooden windowsill, golden hour lighting, soft focus background"
  • Creative: "futuristic cityscape at night with neon lights reflecting on wet streets, cyberpunk aesthetic, dramatic lighting"
Example:

"a beautiful sunset over the ocean with dramatic clouds"

width
integer
default:1024

Width of the image in pixels.

Valid range: 256 to 1440 pixels Default: 1024 pixels

Common sizes:

  • Square: 1024×1024
  • Landscape: 1440×768 (16:9)
  • Portrait: 768×1440 (9:16)
Required range: 256 <= x <= 1440
Example:

1024

height
integer
default:768

Height of the image in pixels.

Valid range: 256 to 1440 pixels Default: 768 pixels

Tip: Total megapixels affect generation cost. Higher resolution = higher cost.

Required range: 256 <= x <= 1440
Example:

768

seed
integer | null

Random seed for reproducible results.

Use case: Generate variations of the same image by using the same seed with slightly modified prompts.

Valid range: 0 to 4,294,967,295 Default: Random seed (if not provided)

Required range: 0 <= x <= 4294967295
Example:

42

prompt_upsampling
boolean
default:false

Automatically enhance and expand your prompt for better generation results.

When to enable:

  • Using simple, short prompts
  • Want AI to add creative details
  • Experimenting with variations

When to disable:

  • Using detailed, specific prompts
  • Need exact control over output
  • Following brand guidelines
Example:

false

input_image
string | null

Base64-encoded input image for image-to-image generation or image editing.

Supported formats: JPEG, PNG, WebP Use cases:

  • Modify existing images
  • Style transfer
  • Composition refinement

Note: Can provide up to 4 input images using input_image, input_image_2, input_image_3, and input_image_4.

input_image_2
string | null

Second base64-encoded input image for multi-image generation.

input_image_3
string | null

Third base64-encoded input image for multi-image generation.

input_image_4
string | null

Fourth base64-encoded input image for multi-image generation.

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 - Task created successfully

data
object
required
Example:
{
"task_id": "046b6c7f-0b8a-43b9-b35d-6489e6daee91",
"status": "CREATED"
}