Method
POST /v1/products/:id/media
Path Parameters
Product ID.
Body Parameters
At least one ofurl or assetId must be supplied (mediaCreateSchema).
Headers
Bearer token (requires
products:write).application/jsoncurl -X POST "https://api.voyantcloud.com/v1/products/prod_123/media" \
-H "Authorization: Bearer $VOYANT_API_KEY" \
-H "content-type: application/json" \
-d '{
"assetId": "asset_01HZY8SM9P8K4B8N7Q",
"kind": "hero",
"alt": "Resort exterior",
"sort": 0
}'
{
"data": {
"id": "media_01J0E6V4ZBAVQ9PQJRT2P27QX0",
"url": "https://cdn.voyantcloud.com/media/prod_123/hero.jpg",
"kind": "hero",
"alt": "Resort exterior",
"sort": 0,
"assetId": "asset_01HZY8SM9P8K4B8N7Q"
}
}
Attach a media asset to a product via direct URL or Gallery asset.
POST /v1/products/:id/media
url or assetId must be supplied (mediaCreateSchema).
products:write).application/jsoncurl -X POST "https://api.voyantcloud.com/v1/products/prod_123/media" \
-H "Authorization: Bearer $VOYANT_API_KEY" \
-H "content-type: application/json" \
-d '{
"assetId": "asset_01HZY8SM9P8K4B8N7Q",
"kind": "hero",
"alt": "Resort exterior",
"sort": 0
}'
{
"data": {
"id": "media_01J0E6V4ZBAVQ9PQJRT2P27QX0",
"url": "https://cdn.voyantcloud.com/media/prod_123/hero.jpg",
"kind": "hero",
"alt": "Resort exterior",
"sort": 0,
"assetId": "asset_01HZY8SM9P8K4B8N7Q"
}
}