BG Removal + Design Flow
This flow allows you to upload an image and receive design suggestions based on your specific use case. This section provides a step-by-step explanation of the flow, including API endpoints, request formats, and response schemas.
Step 1: Image Upload
To start the BG Removal + Design flow, you need to upload an image using a POST
request to the following API endpoint:
https://daas.blend-api.com/v1/design/image-upload
The image should be uploaded using form-data, with the key named as "file". Upon successful upload, the API response will include an "id" that represents the "design instance" for further API calls.
Example:
curl -X POST -H "X-Api-Key: YOUR_API_KEY" -F "file=@image.jpg" https://daas.blend-api.com/v1/design/image-upload
Note how an API key is to be included. Navigate here for the detailed API spec.
You can also use the other upload API that lets you provide us a public URL.
Example:
curl -X POST -H "X-Api-Key: YOUR_API_KEY" -d '{"url": "A_PUBLIC_URL"}' https://daas.blend-api.com/v1/design/image-upload-from-url
Navigate here for the detailed API spec.
Step 2: Get Recipe Suggestions
You can then retrieve recipe suggestions, mainly driven by the kind of your product, by making a POST
request to the following API endpoint:
https://daas.blend-api.com/v1/design/suggest
The request body should be a JSON object with the following properties:
- "id": The design instance ID obtained from the image upload API.
- "recipePreset": Pass
- "AI_STUDIO" to get suggestions with which you can generate designs of your product placed in one of our AI generated backgrounds.
- A string exclusive to you, passed on offline. This preset filters down suggestions based on your use case.
- "prompt": Optional. A description that you can pass along with "AI_STUDIO" recipe-preset, with which you can tell us what kind of designs you expect. Our AI suggestions will then be based on it along with your product kind.
- "filters": Optional. An object which can contain the below:
- "aspectRatio": Optional. The aspect ratio of the designs to be generated. Eg: 1:1, 4:5, 9:16, 16:9
Example:
curl -X POST -H "X-Api-Key: YOUR_API_KEY" -H "Content-Type: application/json" -d '{"id": "DESIGN_INSTANCE_ID", "recipePreset": "AI_STUDIO", "prompt": "In a showcase inside a well lighted shoes shop", "filters": {"aspectRatio": "1:1"}}' https://daas.blend-api.com/v1/design/suggest
The response will be a JSON object with the structure defined by the below schema:
{
"suggestedRecipeLists": [
{
"id": "RECIPE_LIST_ID",
"title": "Recipe List Title",
"recipes": [
{
"recipeId": "RECIPE_ID",
"variant": "RECIPE_VARIANT",
"mutations": {
"images": {
"primaryIllustration": {
"uri": "AI_GENERATED_PRIMARY_ILLUSTRATION_URI",
"previewUri": "PREVIEW_URI_OF_THE_AI_GENERATED_PRIMARY_ILLUSTRATION",
"source": "WEB"
}
}
}
},
...
]
},
...
]
}
The response includes a list of suggested recipe lists, each containing a title and an array of recipes. Each recipe object consists of the following properties:
- "recipeId": The ID of the recipe.
- "variant": The variant of the recipe.
- "mutations": Defines the changes generated by our AI.
Navigate here for the detailed API spec.
Step 3: Preview Generation (Optional)
You have the option to iterate through the recipe objects and pass them along with the design id to our preview API to generate their previews. To generate a preview, make a POST
request to the following API endpoint:
https://daas.blend-api.com/v1/design/preview.webp
Example:
curl -X POST -H "X-Api-Key: YOUR_API_KEY" -d '{"id": "DESIGN_INSTANCE_ID", "recipeId": "RECIPE_ID", "variant": "RECIPE_VARIANT", "mutations": {"images": {"primaryIllustration": {"uri": "AI_GENERATED_PRIMARY_ILLUSTRATION_URI", "previewUri": "PREVIEW_URI_OF_THE_AI_GENERATED_PRIMARY_ILLUSTRATION", "source": "WEB"}}}' https://daas.blend-api.com/v1/design/preview.webp
Navigate here for the detailed API spec.
Step 4: Full Version Generation
Once you have found what you're looking for, pass the same recipe object along with the design id to our generate API to download the full version. Proceed with a POST
request to the following API endpoint:
https://daas.blend-api.com/v1/design/generated.jpeg
Example:
curl -X POST -H "X-Api-Key: YOUR_API_KEY" -d '{"id": "DESIGN_INSTANCE_ID", "recipeId": "RECIPE_ID", "variant": "RECIPE_VARIANT", "mutations": {"images": {"primaryIllustration": {"uri": "AI_GENERATED_PRIMARY_ILLUSTRATION_URI", "source": "WEB"}}}' https://daas.blend-api.com/v1/design/generated.jpeg
Navigate here for the detailed API spec.
Conclusion
The BG Removal + Design flow empowers customers to upload images and receive AI generated and/or tailored design suggestions. By leveraging the image upload and suggestion APIs, along with the preview and full version generation URLs, you can seamlessly integrate this flow into your application or service, creating captivating product designs.
If you have any questions or need assistance with the BG Removal + Design flow, please reach out to our support team. We are here to help you make the most of Blend Designs' APIs and achieve your desired design outcomes.