Generate images
Start generating one or more images from a prompt and an image type for the specified WordPress installation.
Start generating one or more images from a prompt and an image type for the specified
WordPress installation. The generation runs asynchronously: the response is returned
right away with status: in-progress and a generation_id. Poll
GET /api/hosting/v1/accounts/{username}/wordpress/{software}/content/generations/{generation_id}
every few seconds until status is completed or failed.
A completed generation returns temporary image URLs together with the time they expire; download the images before then. Images match the requested aspect ratio and are never smaller than the requested size; logos are transparent images cropped to the mark.
Only one image generation can run per installation at a time: while one is still in
progress the endpoint returns 409 without the ID of the running generation, so a caller
that did not receive the 202 has to wait for it to finish (up to a few minutes) before
starting a new one. The endpoint is limited to 10 requests per minute.
Provide the WordPress installation (software) identifier in the path. It can
be obtained from GET /api/hosting/v1/wordpress/installations (the id field).
API Token authentication
u123456789WordPress installation (software) identifier
1232456789Pattern: ^[0-9]+$Generate images from a prompt and an image type
What the image should show. For the logo type, the wordmark and mark to render.
A cozy artisan bakery interior at sunrise with fresh bread on wooden shelvesKind of image to generate. It sets the default size and cropping.
heroPossible values: How many images to generate
1Example: 1Output width in pixels. Defaults per image type and is ignored for the logo type.
1200Output height in pixels. Defaults per image type and is ignored for the logo type.
675Style tokens appended to photographic prompts. Ignored for the logo type.
Warm 35mm film photography, soft grainColour direction for the logo type only. It is not rendered as text.
Deep navy and muted goldAccepted response
State of an AI content generation and, once completed, its result.
Generation ID (UUID) used to poll for the result
9d4f8a1e-2b3c-4d5e-8f6a-7b8c9d0e1f2aKind of generation, determines the shape of result
image-generationPossible values: in-progress while the generation is still running, completed once result is available, failed when the generation stopped without a result.
in-progressPossible values: Generated content, null until the status is completed. For image-generation it is the generated images object; for website-generation it is the generated website document.
{"editor":"gutenberg","single_page":false,"home_page_id":"home","language":{"name":"en","code":"en"},"brand":{"name":"Kava House","tagline":"Weekly roasts from our counter"},"theme":[],"menu":[],"pages":[]}Unauthenticated response
Error response
Conflict response. Retry-After, when present, is the number of seconds to wait before retrying.
Validation error response
Error response
POST /api/hosting/v1/accounts/{username}/wordpress/{software}/content/images/generate HTTP/1.1
Host: developers.hostinger.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 246
{
"prompt": "A cozy artisan bakery interior at sunrise with fresh bread on wooden shelves",
"image_type": "hero",
"num_of_images": 1,
"width": 1200,
"height": 675,
"style": "Warm 35mm film photography, soft grain",
"color_guidance": "Deep navy and muted gold"
}{
"generation_id": "9d4f8a1e-2b3c-4d5e-8f6a-7b8c9d0e1f2a",
"type": "image-generation",
"status": "in-progress",
"result": {
"images": [
{
"url": "https://storage.googleapis.com/ai-images/hero-1.webp?X-Goog-Signature=abc123",
"width": 1600,
"height": 900,
"content_type": "image/webp"
}
],
"expires_at": "2026-10-15T10:29:23+00:00"
}
}Last updated
Was this helpful?