UI Design
API documentation and implementation examples for the UI Design model.
Part of the Text To Image / Ui Design collection
API Endpoint
/v1/text-to-image/ui-designRequest Parameters
An array of color hex codes used for the prompt, providing a set of color values that can influence the image generation.
[
[
"#05f124",
"#55357f"
]
]An object that defines the dimensions of the generated image.
[
{
"height": 1024,
"width": 1024
}
]The height of the generated image in pixels.
The width of the generated image in pixels.
A text description that serves as the prompt for image generation, which guides the content of the resulting image.
"A beautiful view"A flag indicating whether a safety checker should be applied to ensure the generated content is appropriate.
trueCode Examples
const apiKey = "YOUR_API_KEY"; fetch("https://api.stockimg.ai/v1/text-to-image/ui-design", { method: "POST", headers: { "Content-Type": "application/json", "Authorization": `Bearer ${apiKey}` }, body: JSON.stringify({ "colors": [ "#05f124", "#55357f" ], "image_size": { "height": 1024, "width": 1024 }, "prompt": "A beautiful view", "safety_checker": true }) }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error));
Response Example
{ "data": { "has_nsfw_concepts": [ false ], "images": [ { "content_type": "image/png", "height": 512, "url": "https://example.com/images/generated-123456.png", "width": 512 } ], "prompt": "A surreal cityscape with floating buildings", "seed": 987654321, "timings": { "inference_time": 2.5, "queue_time": 0.8, "total_time": 3.3 } }, "message": "Image generation completed successfully" }
Response Fields
The main payload containing text-to-image generation results
Array of boolean flags indicating whether each generated image contains NSFW content, with index corresponding to the images array
List of generated images resulting from the text-to-image operation
Information about a single generated image
MIME type of the image, or null if unavailable
Height of the generated image in pixels
URL where the generated image can be accessed
Width of the generated image in pixels
The original text prompt used to generate the images
Random seed used for image generation, can be used to reproduce the same image in future requests
Performance metrics and timing information for the image generation process
A static message describing the status or context of the response
[
"Success",
"Image generation completed",
"Request processed successfully"
]