Skip to main content
All CollectionsCloudinary 3D API
Create a Product Variant with API
Create a Product Variant with API

Learn how to create a product variant with consecutive API calls

Updated today

Creating a variant model from an uploaded 3D model in Cloudinary involves a series of API calls that allow you to manage and transform your 3D assets effectively. Below is a step-by-step guide to accomplish this:

1. Uploading a 3D Model

First, upload your 3D model to Cloudinary. Ensure you have your API key and secret set up as described in the Set API Key & Secret guide. You can upload your model using the UI or our API.

Once you have the model ID, either retrieved from the upload request or from the UI:

you can continue to the next step:

2. Creating a Variant Model

Once your model is uploaded, you can create a variant by making a POST request to the /3DModel/{threeDModelID}/Variant endpoint. This allows you to create different versions of your 3D model, such as variations in color or texture.

The request should contain two parameters: name and productConfigs

name: Will the new of the variant model

productConfigs is a JSON string containing the configuration to apply on the model's mesh(es).

The configuration follows a very similar structure to the client side Product Config API. The "config" part may contain exactly what the product configuration document shows.

Example Request Body:

{ 
"name":"variant-name-1",
"productConfigs": [
{
"mesh":"0.0.Body_1",
"config": {
"url":"base.jpg",
"normalUrl":"normal.jpg",
"textureParams": { "flipY":false }
}
}
]
}

A useful way to get started with the configuration is using the configuration demo app and looking at the "developer console":

The response from the Variant create request includes the new model's ID, which you'll need for the next step.

3. Creating a Product for the New Variant Model

After creating the variant, associate it with a product entity. This involves creating a product and linking it to your variant model. Detailed instructions can be found in the Create a Product with API guide.

4. Generating Images Using the Generate Call

With your product set up, you can generate assets such as images or videos using the generate endpoint. This process is outlined in the Generate Assets with API guide.

5. Receiving Notifications via Webhook (If Configured)

To receive notifications about the status of your asset generation, configure a webhook endpoint. This setup ensures you are notified upon completion of asset generation tasks. Instructions for configuring webhooks are available in the Webhook Notification guide.

Did this answer your question?