Assets

Upload and manage product images for use in generation.

POST/v1/training-asset

Upload 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

ParameterTypeRequiredDescription
filefileYes*Image file to upload. Supported formats: JPEG, PNG, WebP. Max size: 10MB.
urlstringYes*URL of an image to import. Either file or url is required.
namestringNoDisplay name for the asset.
tagsstring[]NoArray 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

FieldTypeDescription
asset_idstringUnique identifier. Use this in the generate endpoint.
statusstringProcessing status: processing, ready, failed
urlstringCDN URL of the processed image.
thumbnail_urlstringCDN URL of the thumbnail.
widthintegerImage width in pixels.
heightintegerImage height in pixels.
created_atstringISO 8601 timestamp.
GET/v1/my-uploaded-assets

List all uploaded assets for the authenticated user.

Query Parameters

ParameterTypeDefaultDescription
limitinteger20Number of assets to return. Max: 100.
offsetinteger0Number of assets to skip for pagination.
statusstringallFilter by status: processing, ready, failed
tagsstring-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 →