POST
/
v1
/
ai
/
text-to-image
curl --request POST \
--url https://api.freepik.com/v1/ai/text-to-image \
--header 'Content-Type: application/json' \
--header 'x-freepik-api-key: <api-key>' \
--data '{
"prompt": "Crazy dog in the space",
"negative_prompt": "b&w, earth, cartoon, ugly",
"guidance_scale": 2,
"seed": 42,
"num_images": 1,
"image": {
"size": "square_1_1"
},
"styling": {
"style": "anime",
"effects": {
"color": "pastel",
"lightning": "warm",
"framing": "portrait"
},
"colors": [
{
"color": "#FF5733",
"weight": 1
},
{
"color": "#33FF57",
"weight": 1
}
]
},
"filter_nsfw": true
}'
{
"data": [
{
"base64": "iVBORw0KGgoAAAANSUhEUgAAASwAAAEsAQAAAABRBrPYAAABrElEQVR4nO3BMQEAAADCoPVPbQ0Po...",
"has_nsfw": false
},
{
"base64": "iVBORw0KGgoAAAANSUhEUgAAASwAAAEsAQAAAABRBrPYAAABrElEQVR4nO3BMQEAAADCoPVPbQ0Po...",
"has_nsfw": false
}
],
"meta": {
"image": {
"size": "square_1_1",
"width": 1024,
"height": 1024
},
"seed": 42,
"guidance_scale": 2,
"prompt": "Crazy dog flying over the space",
"num_inference_steps": 8
}
}

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

Response

200
application/json

OK - The request has succeeded, and the images generated from the text are returned.

The response is of type object.