Search Documentation

Search for a documentation page...

Images API

REST API endpoint for AI-powered image generation.

Generate Image

POST /api/v1/images/generate

Generates an image using AI from a text prompt. The image is uploaded to the store's CDN and returns the URL. Timeout: 30 seconds.

Request Body

FieldTypeRequiredDescription
promptstringYesText prompt (1-1000 characters)
typestringNoImage type: product, collection, or hero (default: product)
namestringNoFilename prefix (default: generated)

The type parameter affects the generated image's aspect ratio and style:

TypeUse Case
productSquare product photos, clean backgrounds
collectionWide banner images for collection headers
heroFull-width hero images for landing pages
curl -X POST \
-H "Authorization: Bearer your_api_key" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A minimalist ceramic coffee mug on a marble surface, soft natural lighting",
"type": "product",
"name": "coffee-mug"
}' \
https://your-store.yns.store/api/v1/images/generate

Response

{
"url": "https://your-store.blob.vercel-storage.com/images/coffee-mug-abc123.png",
"pathname": "images/coffee-mug-abc123.png"
}