Assets
Upload and manage product images for use in generation.
POST
/v1/training-assetUpload a new product image. The image will be processed and made available for generation.
Headers
Authorization: Bearer YOUR_API_KEY Content-Type: multipart/form-data
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
file | file | Yes* | Image file to upload. Supported formats: JPEG, PNG, WebP. Max size: 10MB. |
url | string | Yes* | URL of an image to import. Either file or url is required. |
name | string | No | Display name for the asset. |
tags | string[] | No | Array of tags for organizing assets. |
Example Request (File Upload)
curl -X POST "https://api.productai.photo/v1/training-asset" \ -H "Authorization: Bearer YOUR_API_KEY" \ -F "file=@/path/to/product.jpg" \ -F "name=Blue Sneaker" \ -F "tags[]=footwear" \ -F "tags[]=summer"
Example Request (URL Import)
curl -X POST "https://api.productai.photo/v1/training-asset" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/product.jpg",
"name": "Blue Sneaker",
"tags": ["footwear", "summer"]
}'Success Response (201 Created)
{
"asset_id": "asset_xyz789",
"name": "Blue Sneaker",
"status": "processing",
"url": "https://cdn.productai.photo/assets/asset_xyz789.jpg",
"thumbnail_url": "https://cdn.productai.photo/assets/asset_xyz789_thumb.jpg",
"width": 1024,
"height": 1024,
"file_size": 245678,
"format": "jpeg",
"tags": ["footwear", "summer"],
"created_at": "2024-01-15T10:30:00Z"
}Response Fields
| Field | Type | Description |
|---|---|---|
asset_id | string | Unique identifier. Use this in the generate endpoint. |
status | string | Processing status: processing, ready, failed |
url | string | CDN URL of the processed image. |
thumbnail_url | string | CDN URL of the thumbnail. |
width | integer | Image width in pixels. |
height | integer | Image height in pixels. |
created_at | string | ISO 8601 timestamp. |
GET
/v1/my-uploaded-assetsList all uploaded assets for the authenticated user.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | integer | 20 | Number of assets to return. Max: 100. |
offset | integer | 0 | Number of assets to skip for pagination. |
status | string | all | Filter by status: processing, ready, failed |
tags | string | - | Comma-separated list of tags to filter by. |
Example Request
curl "https://api.productai.photo/v1/my-uploaded-assets?limit=10&status=ready" \ -H "Authorization: Bearer YOUR_API_KEY"
Success Response (200 OK)
{
"assets": [
{
"asset_id": "asset_xyz789",
"name": "Blue Sneaker",
"status": "ready",
"url": "https://cdn.productai.photo/assets/asset_xyz789.jpg",
"thumbnail_url": "https://cdn.productai.photo/assets/asset_xyz789_thumb.jpg",
"width": 1024,
"height": 1024,
"tags": ["footwear", "summer"],
"created_at": "2024-01-15T10:30:00Z"
}
],
"total": 42,
"limit": 10,
"offset": 0,
"has_more": true
}GET
/v1/assets/{asset_id}Get details for a specific asset.
Example Request
curl "https://api.productai.photo/v1/assets/asset_xyz789" \ -H "Authorization: Bearer YOUR_API_KEY"
Success Response (200 OK)
{
"asset_id": "asset_xyz789",
"name": "Blue Sneaker",
"status": "ready",
"url": "https://cdn.productai.photo/assets/asset_xyz789.jpg",
"thumbnail_url": "https://cdn.productai.photo/assets/asset_xyz789_thumb.jpg",
"width": 1024,
"height": 1024,
"file_size": 245678,
"format": "jpeg",
"tags": ["footwear", "summer"],
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:31:00Z"
}DELETE
/v1/assets/{asset_id}Delete an asset. This action cannot be undone.
Example Request
curl -X DELETE "https://api.productai.photo/v1/assets/asset_xyz789" \ -H "Authorization: Bearer YOUR_API_KEY"
Success Response (204 No Content)
Returns an empty response on successful deletion.
Code Examples
Python - Upload File
import requests
with open("product.jpg", "rb") as f:
response = requests.post(
"https://api.productai.photo/v1/training-asset",
headers={"Authorization": "Bearer YOUR_API_KEY"},
files={"file": f},
data={"name": "Blue Sneaker", "tags": ["footwear"]}
)
asset = response.json()
print(f"Asset uploaded: {asset['asset_id']}")JavaScript - Upload from URL
const response = await fetch("https://api.productai.photo/v1/training-asset", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
url: "https://example.com/product.jpg",
name: "Blue Sneaker",
tags: ["footwear"]
})
});
const asset = await response.json();
console.log("Asset uploaded:", asset.asset_id);Next Steps
Once your asset is ready, use it in the Generate API:
View Generate API documentation →