Search Documentation

Search for a documentation page...

Images API

REST API endpoints for uploading and generating product images.

Upload Images

POST /api/v1/images
Content-Type: multipart/form-data

Upload one or more image files to blob storage. Returns URLs that can be used in product creation.

Limits

ConstraintValue
Max files per request10
Max file size10 MB
Accepted typesAny image/* MIME type
# Single file
curl -X POST \
-H "Authorization: Bearer your_api_key" \
-F "file=@product-photo.jpg" \
https://your-store.yns.store/api/v1/images

# Multiple files
curl -X POST \
-H "Authorization: Bearer your_api_key" \
-F "file=@photo1.jpg" \
-F "file=@photo2.png" \
https://your-store.yns.store/api/v1/images

Response

{
"images": [
{
"url": "https://your-store.blob.vercel-storage.com/images/store-id/production/api-upload-photo1-abc123.jpg",
"pathname": "images/store-id/production/api-upload-photo1-abc123.jpg"
}
]
}

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"
}