openapi: 3.0.0
info:
title: The Bria API
version: ''
contact:
name: We are happy to answer any questions you may have at
email: support@bria.ai
description: >
# Introduction
The Bria API is designed to provide a comprehensive suite of tools for generating and customizing images. With Bria, you can:
- **Generate Images Using Bria Models**: Utilize pre-trained Bria models to generate high-quality images based on text prompts.
- **Train Your Own Tailored Models**: Create models that preserve and faithfully reproduce your visual IP, ensuring consistency across all generated outputs.
- **Generate Vector Graphics (beta)**: Use the base and tailored models API endpoints to create versatile, editable vector graphics from text prompts.
- **Enhance Product Imagery with eCommerce Suite**: Use specialized features to create professional product shots, packshots, and lifestyle images for eCommerce platforms.
- **Edit and Transform Images**: Bring your own images and edit them using various routes to suit your needs.
- **Edit Videos (New!)**: Transform video content with advanced AI capabilties, starting with **Background Removal**, and more features coming soon.
This document provides an overview of the API's capabilities and guides users on how to effectively implement them.
### Bria's Sandbox
Try out Bria's API endpoints directly in our sandbox environment here.
### Using Bria for Image Generation
**Image Generation**:
- Use the `/text-to-image` endpoints to generate any image you would like, based on the provided prompt, without needing to upload or register images first.
- Utilize the `/reimagine` endpoint to generate new images based on reference images, incorporating elements such as structure, composition, or style from existing visuals.
- Enhance your prompts with the `/prompt_enhancer` route or use the built-in prompt enhancement feature in /text-to-image routes to create more detailed and vivid descriptions, resulting in richer and more diverse image outputs.
**Tailored Generation**:
The Tailored Generation API allows you to manage and train Tailored Models that preserve and faithfully reproduce your visual IP (photos, illustrations, vectors). You can train Tailored Models through our Console or implement training on your platform via API. Check out our Console [here](https://platform.bria.ai/console/tailored-generation).
### Training Process Overview
To train a tailored generation model:
1. **Create a Project**: Use the `/projects` endpoint to create a project and define your IP type and medium.
2. **Create a Dataset**: Use the `/datasets` endpoint to create a dataset within your project.
3. **Upload Images**: Upload images to your dataset using the `/datasets/{dataset_id}/images` endpoint. Images must be 1024x1024px minimum.
4. **Prepare Dataset**: Review auto-generated captions and use the `/datasets/{id}` endpoint to set status to 'completed'.
5. **Create Model**: Use the `/models` endpoint to create a model, selecting light or max training version.
6. **Start Training**: Initiate training using the `/models/{id}/start_training` endpoint. Training takes 1-3 hours.
7. **Monitor Progress**: Check training status using the `/models/{id}` endpoint until status shows 'Completed'.
8. **Generate Images**: Once trained, your model can be used in multiple ways:
- Use the `/text-to-image/tailored/{model_id}` endpoint for text-to-image generation
- Use the `/text-to-vector/tailored/{model_id}` endpoint for generating illustrative vector graphics
- Use the `/reimagine/tailored/{model_id}` endpoint for generating using a structure refernce image
- Access through the Bria platform interface
### eCommerce Suite
Bria offers a variety of solutions for products and apps in the eCommerce industry, which allow to enhance product imagery for online stores and product catalogs.
These solutions include:
- `/cutout`: Create clean and professional product cutouts.
- `/packshot`: Generate professional-standard packshots with customizable background colors and optimal product placement.
- `/shadow`: Add consistent and customizable shadow effects, supporting regular and floating shadows for product images with transparent backgrounds.
- `/lifestyle_shot_by_text`: Enrich product images by placing them in various environments using textual descriptions, enhancing appeal and providing context.
- `/lifestyle_shot_by_image`: Generate product images in enriched environments using a reference image for inspiration, allowing for creative and unique presentations.
### Video Editing
Bria's new **Video Editing** product suite empowers users to transform video content effortlessly.
The first feature, **Background Removal**, allows users to remove backgrounds from videos while retaining the original resolution and framerate.
This capability supports a variety of formats, including `mp4`, `avi`, and `mov`. More features will be introduced soon, expanding the suite to meet diverse video editing needs.
### Editing Images
Bria supports both isolated and registration-required routes for editing images:
**Isolated Routes** (no registration required):
- `/increase_resolution` - Upscale any image.
- `/image_expansion` - Expand the image beyond its original borders.
- `/crop` - Crop an image tightly around the region of interest without a background.
- `/background/remove` - Remove the background of an image.
- `/background/blur` - Create a blur effect on the background.
- `/background/replace` - Generate new backgrounds for an image.
- `/erase_foreground` - Erase the foreground from a provided image.
- `/eraser` - Erase elements from an image using manually created or auto-generated masks.
- `/gen_fill` (coming soon) - GenFill generates objects in a specific region of an image, using a mask and a textual prompt.
- `/caption` - Generate a caption describing the given image.
**Soon to be Isolated:**
- `/mask_generator` - Retrieve all available masks for an image, creating a full segmenration of the image.
- `/image_to_psd` - Create a layered PSD file from any image.
**Uploading and Registering Images**:
- Use the `/register` endpoint to send a new image to Bria without being uploaded to the database. This is the recommended method to onboard images to Bria when needed.
With the response from the *Upload/Register Routes* (visual_id), the following routes can be used without any particular order:
- `/campaign_generator` - The *Campaign Generator Route* enables the creation of customized campaigns. It allows for the generation of visual ads, including various elements like text, images, and layout, based on specific parameters provided by the user.
- `/person/info` (soon to be deprecated) - By using the */person/info* route, you can understand the possible changes for every people in the image.
- `/person/modify` - Modify person-related elements in the image. In order to use this route you shuold first use the route /person/info.
- `/search` - Utilizing the *Search Route* to look for images you uploaded or registered to Bria that match a text query.
- `/search_similar_images` - Utilizing the *Search Similar Images Route* to look for images you uploaded or registered to Bria that match the chosen image.
# Authentication
The Bria API consists of a number of methods for uploading and creating new visual assets. The REST (representational state transfer) API methods can be called directly from within your own custom code.
curl --location --request POST 'https://engine.prod.bria-api.com/v1' \
--header: 'api_token: <...>' \
...
# API Access
You can register and access the API Token through Bria's platform by clicking here.
externalDocs:
description: Register and get API Access
url: 'https://labs.bria.ai/api-plans'
servers:
- url: https://engine.prod.bria-api.com/v1
paths:
# image generation routes
/text-to-image/base/{model_version}:
post:
tags:
- Image Generation
summary: Generate Image - Base model
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/text-to-image/base"
description: >-
**Description**
The /text-to-image/base Route empowers users to create stunning images directly from textual prompts. This pipeline allows for generating high-quality, photorealistic and artistic, images with a resolution of up to 1024x1024 pixels, supporting a variety of aspect ratios natively to accommodate diverse creative needs.
**Examples:**
**prompt**: A professional headshot of a CEO
### Guidance Methods
This API supports various guidance methods to provide greater control over text-to-image generation. These methods condition the model on additional inputs derived from user-provided images.
**ControlNets**:
A set of methods that allow conditioning the model on additional inputs, providing detailed control over image generation.
- **controlnet_canny**: Uses edge information from the input image to guide generation based on structural outlines.
- **controlnet_depth**: Derives depth information to influence spatial arrangement in the generated image.
- **controlnet_recoloring**: Uses a grayscale version of the input image to guide recoloring while preserving geometry.
- **controlnet_color_grid**: Extracts a 16x16 color grid from the input image to guide the color scheme of the generated image.
**Using ControlNets**
You can specify up to four ControlNet guidance methods in a single request. Each method requires an accompanying image and a scale parameter to determine its impact on the generation inference. The table below provides detailed information about each guidance method, with an example os use:
| Guidance Method |
Prompt |
Scale |
Input Image |
Guidance Image |
Output Image |
| ControlNet Canny |
An exotic colorful shell on the beach |
1.0 |
 |
 |
 |
| ControlNet Depth |
A dog, exploring an alien planet |
0.8 |
 |
 |
 |
| ControlNet Recoloring |
A vibrant photo of a woman |
1.00 |
 |
 |
 |
| ControlNet Color Grid |
A dynamic fantasy illustration of an erupting volcano |
0.7 |
 |
 |
 |
To use **ControlNets** guidance method, include the following parameters in your request:
- `guidance_method_X`: Specify the guidance method (where X is 1, 2). If the paramter guidance_method_2 is used, so does guidance_method_1 has to be used, and so on. If you would like to use only one method, use the paratmer guidance_method_1
- `guidance_method_X_scale`: Set the impact of the guidance (0.0 to 1.0)
- `guidance_method_X_image_file`: Provide the base64-encoded input image
**IP_adapter**:
Guides the model based on the input image and its associated style. This method offers two modes:
- **regular**: Uses the full input image to condition the model, influencing both content and style.
- **style_only**: Focuses only on the style of the input image, allowing the model to generate images based on the provided aesthetic without altering the content.
**Using IP-Adapter**
| Guidance Method |
Prompt |
Mode |
Scale |
Guidance Image |
Output Image |
| IP-adapter |
A drawing of a lion laid on a table. |
regular |
0.85 |
 |
 |
| IP-adapter |
A drawing of a bird. |
style |
1 |
 |
 |
operationId: text-to-image/base
parameters:
- in: path
name: model_version
schema:
type: string
enum: ["2.3"]
required: true
description: The model version you would like to use in the request.
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
prompt:
type: string
description: The prompt you would like to use to generate images. Bria currently supports prompts in English only, excluding special characters.
num_results:
type: integer
description: How many images you would like to generate. When using any Guidance Method, please use the value 1.
minimum: 1
default: 4
maximum: 4
aspect_ratio:
type: string
description: The aspect ratio of the image. When a guidance method is being used, the aspect ratio is defined by the guidance image and this parameter is ignored.
default: "1:1"
enum: ["1:1","2:3","3:2","3:4","4:3","4:5","5:4","9:16","16:9"]
sync:
type: boolean
description: Determines the response mode. When true, responses are synchronous. With false, responses are asynchronous, immediately providing URLs for images that are generated in the background. Use polling for the URLs to retrieve images once ready.
default: false
seed:
type: integer
description: You can choose whether you want your generated result to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response with the prompt, model type and model version. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.
negative_prompt:
type: string
description: Specify here elements that you didn't ask in the prompt, but are being generated, and you would like to exclude. This parameter is optional. Bria currently supports prompts in English only.
steps_num:
type: integer
description: The number of iterations the model goes through to refine the generated image. This parameter is optional.
minimum: 20
default: 30
maximum: 50
text_guidance_scale:
type: number
format: float
description: Determines how closely the generated image should adhere to the input text description. This parameter is optional.
minimum: 1.0
maximum: 10.0
default: 5.0
medium:
type: string
enum: ['photography','art']
description: Which medium should be included in your generated images. This parameter is optional.
prompt_enhancement:
type: boolean
description: When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images. Note that turning this flag on may result in a few additional seconds to the inference time. Built with Meta Llama 3.
default: false
guidance_method_1:
type: string
enum: ['controlnet_canny','controlnet_depth','controlnet_recoloring', 'controlnet_color_grid']
description: Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional.
guidance_method_1_scale:
type: number
format: float
minimum: 0.0
maximum: 1.0
default: 1.0
description: The impact of the guidance.
guidance_method_1_image_file:
type: string
description: The image that should be used as guidance, in base64 format, with the method defined in guidance_method_1. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.
guidance_method_2:
type: string
enum: ['controlnet_canny','controlnet_depth','controlnet_recoloring', 'controlnet_color_grid']
description: Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional.
guidance_method_2_scale:
type: number
format: float
minimum: 0.0
maximum: 1.0
default: 1.0
description: The impact of the guidance.
guidance_method_2_image_file:
type: string
description: The image that should be used as guidance, in base64 format, with the method defined in guidance_method_2. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.
image_prompt_mode:
type: string
enum: [regular, style_only]
default: regular
description: |
The mode to apply to the image guidance.
- `regular`: Uses both content and style from the provided image for the generation.
- `style_only`: Uses only the style from the provided image.
image_prompt_file:
type: string
description: |
The image file to be used as guidance for the IP-Adapter, in base64 format. Accepted formats are jpeg, jpg, png, webp.
Maximum file size 12MB.
image_prompt_urls:
type: array
items:
type: string
format: uri
description: |
A list of URLs of images that should be used as guidance for the IP-Adapter. Accepted formats are jpeg, jpg, png, webp.
The URLs should point to accessible, publicly available images.
image_prompt_scale:
type: number
format: float
minimum: 0.0
maximum: 1.0
default: 1.0
description: |
The impact of the provided image on the generated results. A value between 0.0 (no impact) and 1.0 (full impact).
examples:
valid prompt:
value:
prompt: "a baby riding a bicycle in a field of flowers"
num_results: 1
sync: true
inappropriate prompt:
value:
prompt: "sensual"
num_results: 1
sync: true
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
result:
type: array
description: there are multiple objects in this array (based on the amount specified in num_results) and each object represents a single image.
items:
type: object
properties:
seed:
type: integer
description: If you want to recreate the result again, you should use in the request the prompt and the seed of the response.
urls:
type: string
description: This is the URL where the generated image can be found. Bria recognizes offensive and inappropriate images. The URL will lead to a 0-byte file if an image like that is generated. It will take a few seconds for the image to become available via this URL if sync=false.
examples:
valid prompt:
value:
results: [
{
"seed": 1525972691,
"urls": "https://bria-temp.s3.amazonaws.com/api/generate_image/a_4k_symmetrical_portrait_of_a_woman_traveling_in_the_world_realistic_soft_natural_lighting_85mm_lens_photography_dramatic_lighting_photo_realism_High_contrast_shadows/seed_1109401663.jpg?AWSAccessKeyId=ASIAUL5JH7ABJT4HG6MN&Signature=DOKLVPYHKHbe7bA3hEl262EabLk%3D&x-amz-security-token=FwoGZXIvYXdzEND%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDEl1%2FfpVCJkRvEKkJyKYBBTbjfsDBPKMZsYVU8tO3MMNCxvwAgtzUCvoxqOtEXYmVfCABwvF3jgvXCHup%2BdG3QYV7jHEfAgBLWI%2BMGI%2F%2FntPwdsdsMTxKhSJgymaUq8n8O4GmCSExT5o34U1uhAFpr2YPbrQWdYfuo%2FKIWGTHoBbikLf14yb1sa%2FicwMeVItzrTk%2FSvPAuJCSJh3Mnq%2BlXSSuviKpyMB226UjZPZ6zUYnSwwDHlQFueVRTJopaPvDh8LBlFQIiZqSxRDFqZDCC00rVv17pbD2tRT0kpVoAhE2QXIGzKiErsPJwsWYhOSra2idSUI3gRCHcJpvuTz2ZNBlY1G%2B%2BzJ%2B07LAkXQT4ppBbpO%2BUvo8pN4aTDvvsztgp2pK6wjWCKUBsRcdhpJ96W%2FzK5BepEflzbG%2BWyVaUuIgpd4OAVY4ieR%2BEDPCVqwb2J3tHWPLK1mnLFAKF5%2Fe68pnRpfLHqjl5h03IK5xbWWJZOCThQx%2FHJtA8EWqNUF372GmAKhfpDvc%2BxitjeV5ym4HZRBeCYTiPnM190yLNklriyXxzLFUxWp28B3mm77%2BFK82%2B3PYxWmFPn9WAWZ%2Fa9FszXNfJ7q%2FtjzvophCsww9psYvhgM9LTgXXUgM6CgVL1OP5qxUAEYuV5Hrg3QSWKchrYh0aMrjrOygBxIXhBj6VDkvVdqg4snlS0cTdgjFZTHDZBvFwLN380Vn0233AV%2FjSJGJzyCKPGR5aAGMirgAQFta0KzQHT52sAvNtD6xfYgB1LU6TLR7AL7Ei%2BmPgZ77VVPe8dRuh8%3D&Expires=1680245340"
}
]
inappropriate prompt:
value:
results: [
{
"description": "Query doesn't stand with Bria's ethic rules",
"error_code": "408"
}
]
'209':
description: Successful operation, a model version that is no longer available was requested. The request was redirected to the latest model version.
content:
application/json:
schema:
type: object
properties:
results:
type: array
description: there are multiple objects in this array (based on the amount specified in num_results) and each object represents a single image.
items:
type: object
properties:
seed:
type: integer
description: If you want to recreate the result again, you should use in the request the prompt and the seed of the response.
urls:
type: string
description: This is the URL where the generated image can be found. Bria recognizes offensive and inappropriate images. The URL will lead to a 0-byte file if an image like that is generated. It will take a few seconds for the image to become available via this URL if sync=false.
examples:
valid prompt:
value:
results: [
{
"seed": 1525972691,
"urls": "https://bria-temp.s3.amazonaws.com/api/generate_image/a_4k_symmetrical_portrait_of_a_woman_traveling_in_the_world_realistic_soft_natural_lighting_85mm_lens_photography_dramatic_lighting_photo_realism_High_contrast_shadows/seed_1109401663.jpg?AWSAccessKeyId=ASIAUL5JH7ABJT4HG6MN&Signature=DOKLVPYHKHbe7bA3hEl262EabLk%3D&x-amz-security-token=FwoGZXIvYXdzEND%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDEl1%2FfpVCJkRvEKkJyKYBBTbjfsDBPKMZsYVU8tO3MMNCxvwAgtzUCvoxqOtEXYmVfCABwvF3jgvXCHup%2BdG3QYV7jHEfAgBLWI%2BMGI%2F%2FntPwdsdsMTxKhSJgymaUq8n8O4GmCSExT5o34U1uhAFpr2YPbrQWdYfuo%2FKIWGTHoBbikLf14yb1sa%2FicwMeVItzrTk%2FSvPAuJCSJh3Mnq%2BlXSSuviKpyMB226UjZPZ6zUYnSwwDHlQFueVRTJopaPvDh8LBlFQIiZqSxRDFqZDCC00rVv17pbD2tRT0kpVoAhE2QXIGzKiErsPJwsWYhOSra2idSUI3gRCHcJpvuTz2ZNBlY1G%2B%2BzJ%2B07LAkXQT4ppBbpO%2BUvo8pN4aTDvvsztgp2pK6wjWCKUBsRcdhpJ96W%2FzK5BepEflzbG%2BWyVaUuIgpd4OAVY4ieR%2BEDPCVqwb2J3tHWPLK1mnLFAKF5%2Fe68pnRpfLHqjl5h03IK5xbWWJZOCThQx%2FHJtA8EWqNUF372GmAKhfpDvc%2BxitjeV5ym4HZRBeCYTiPnM190yLNklriyXxzLFUxWp28B3mm77%2BFK82%2B3PYxWmFPn9WAWZ%2Fa9FszXNfJ7q%2FtjzvophCsww9psYvhgM9LTgXXUgM6CgVL1OP5qxUAEYuV5Hrg3QSWKchrYh0aMrjrOygBxIXhBj6VDkvVdqg4snlS0cTdgjFZTHDZBvFwLN380Vn0233AV%2FjSJGJzyCKPGR5aAGMirgAQFta0KzQHT52sAvNtD6xfYgB1LU6TLR7AL7Ei%2BmPgZ77VVPe8dRuh8%3D&Expires=1680245340"
}
]
'400':
description: Bad request.
'403':
description: Forbidden. Insufficient permissions to access the image URL..
'405':
description: Method not allowed.
'415':
description: Unsupported Media Type. Invalid file type. Supported file types are jpeg, jpg, png, webp.
'422':
description: Unprocessable Entity. The URL does not point to a valid image or is inaccessible.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error.
/text-to-image/fast/{model_version}:
post:
tags:
- Image Generation
summary: Generate Image - fast model
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/text-to-image/fast"
description: >-
**Description**
The /text-to-image/fast Route is optimized for speed, enabling rapid image creation without compromising quality. This model allows for generating high-quality, photorealistic and artistic, images with a resolution of up to 1024x1024 pixels, supporting a variety of aspect ratios natively to accommodate diverse creative needs.
Ideal for applications requiring quick turnaround without sacrificing image fidelity.
**Advanced Customization and Access:**
Beyond the API, developers interested in deeper customization can access BRIA's models directly through Hugging Face. This alternative provides access to the underlying model source code, offering additional features such as ControlNets: Canny , Depth, and ReColoring. This option is ideal for developers seeking advanced control over the image generation process and those who wish to integrate cutting-edge AI directly into their workflows.
**An example:**
**prompt**: A portrait of a Beautiful and playful ethereal singer, art deco, fantasy, intricate art deco golden designs, elegant, highly detailed, sharp focus, blurry background, teal and orange shades
**BRIA FAST model 2.3:**
### Guidance Methods
This API supports various guidance methods to provide greater control over text-to-image generation. These methods condition the model on additional inputs derived from user-provided images.
**ControlNets**:
A set of methods that allow conditioning the model on additional inputs, providing detailed control over image generation.
- **controlnet_canny**: Uses edge information from the input image to guide generation based on structural outlines.
- **controlnet_depth**: Derives depth information to influence spatial arrangement in the generated image.
- **controlnet_recoloring**: Uses a grayscale version of the input image to guide recoloring while preserving geometry.
- **controlnet_color_grid**: Extracts a 16x16 color grid from the input image to guide the color scheme of the generated image.
**Using ControlNets**
You can specify up to four ControlNet guidance methods in a single request. Each method requires an accompanying image and a scale parameter to determine its impact on the generation inference. The table below provides detailed information about each guidance method, with an example os use:
| Guidance Method |
Prompt |
Scale |
Input Image |
Guidance Image |
Output Image |
| ControlNet Canny |
An exotic colorful shell on the beach |
1.0 |
 |
 |
 |
| ControlNet Depth |
A dog, exploring an alien planet |
0.8 |
 |
 |
 |
| ControlNet Recoloring |
A vibrant photo of a woman |
1.00 |
 |
 |
 |
| ControlNet Color Grid |
A dynamic fantasy illustration of an erupting volcano |
0.7 |
 |
 |
 |
To use **ControlNets** guidance method, include the following parameters in your request:
- `guidance_method_X`: Specify the guidance method (where X is 1, 2). If the paramter guidance_method_2 is used, so does guidance_method_1 has to be used, and so on. If you would like to use only one method, use the paratmer guidance_method_1
- `guidance_method_X_scale`: Set the impact of the guidance (0.0 to 1.0)
- `guidance_method_X_image_file`: Provide the base64-encoded input image
**IP_adapter**:
Guides the model based on the input image and its associated style. This method offers two modes:
- **regular**: Uses the full input image to condition the model, influencing both content and style.
- **style_only**: Focuses only on the style of the input image, allowing the model to generate images based on the provided aesthetic without altering the content.
**Using IP-Adapter**
| Guidance Method |
Prompt |
Mode |
Scale |
Guidance Image |
Output Image |
| IP-adapter |
A drawing of a lion laid on a table. |
regular |
0.85 |
 |
 |
| IP-adapter |
A drawing of a bird. |
style |
1 |
 |
 |
operationId: text-to-image/fast
parameters:
- in: path
name: model_version
schema:
type: string
enum: ["2.3"]
required: true
description: The model version you would like to use in the request.
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
prompt:
type: string
description: The prompt you would like to use to generate images. Bria currently supports prompts in English only, excluding special characters.
num_results:
type: integer
description: How many images you would like to generate. How many images you would like to generate. When using any Guidance Method, please use the value 1.
minimum: 1
maximum: 4
default: 4
aspect_ratio:
type: string
description: The aspect ratio of the image.
default: "1:1"
enum: ["1:1","2:3","3:2","3:4","4:3","4:5","5:4","9:16","16:9"]
sync:
type: boolean
description: Determines the response mode. When true, responses are synchronous. With false, responses are asynchronous, immediately providing URLs for images that are generated in the background. Use polling for the URLs to retrieve images once ready.
default: false
seed:
type: integer
description: You can choose whether you want your generated result to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response with the prompt, model type and model version. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.
steps_num:
type: integer
description: The number of iterations the model goes through to refine the generated image. This parameter is optional.
minimum: 4
maximum: 10
default: 8
medium:
type: string
enum: ['photography','art']
description: Which medium should be included in your generated images. This parameter is optional.
prompt_enhancement:
type: boolean
description: When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images. Note that turning this flag on may result in a few additional seconds to the inference time.
default: false
guidance_method_1:
type: string
enum: ['controlnet_canny','controlnet_depth','controlnet_recoloring', 'controlnet_color_grid']
description: Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional.
guidance_method_1_scale:
type: number
format: float
minimum: 0.0
maximum: 1.0
default: 1.0
description: The impact of the guidance.
guidance_method_1_image_file:
type: string
description: The image that should be used as guidance, in base64 format, with the method defined in guidance_method_1. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.
guidance_method_2:
type: string
enum: ['controlnet_canny','controlnet_depth','controlnet_recoloring', 'controlnet_color_grid']
description: Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional.
guidance_method_2_scale:
type: number
format: float
minimum: 0.0
maximum: 1.0
default: 1.0
description: The impact of the guidance.
guidance_method_2_image_file:
type: string
description: The image that should be used as guidance, in base64 format, with the method defined in guidance_method_2. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.
image_prompt_mode:
type: string
enum: [regular, style_only]
default: regular
description: |
The mode to apply to the image guidance.
- `regular`: Uses both content and style from the provided image for the generation.
- `style_only`: Uses only the style from the provided image.
image_prompt_file:
type: string
description: |
The image file to be used as guidance for the IP-Adapter, in base64 format. Accepted formats are jpeg, jpg, png, webp.
Maximum file size 12MB.
image_prompt_urls:
type: array
items:
type: string
format: uri
description: |
A list of URLs of images that should be used as guidance for the IP-Adapter. Accepted formats are jpeg, jpg, png, webp.
The URLs should point to accessible, publicly available images.
image_prompt_scale:
type: number
format: float
minimum: 0.0
maximum: 1.0
default: 1.0
description: |
The impact of the provided image on the generated results. A value between 0.0 (no impact) and 1.0 (full impact).
examples:
valid prompt:
value:
prompt: "a baby riding a bicycle in a field of flowers"
num_results: 1
sync: true
inappropriate prompt:
value:
prompt: "sensual"
num_results: 1
sync: true
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
result:
type: array
description: there are multiple objects in this array (based on the amount specified in num_results) and each object represents a single image.
items:
type: object
properties:
seed:
type: integer
description: If you want to recreate the result again, you should use in the request the prompt and the seed of the response.
urls:
type: string
description: This is the URL where the generated image can be found. Bria recognizes offensive and inappropriate images. The URL will lead to a 0-byte file if an image like that is generated. It will take a few seconds for the image to become available via this URL if sync=false.
examples:
valid prompt:
value:
results: [
{
"seed": 1525972691,
"urls": "https://bria-temp.s3.amazonaws.com/api/generate_image/a_4k_symmetrical_portrait_of_a_woman_traveling_in_the_world_realistic_soft_natural_lighting_85mm_lens_photography_dramatic_lighting_photo_realism_High_contrast_shadows/seed_1109401663.jpg?AWSAccessKeyId=ASIAUL5JH7ABJT4HG6MN&Signature=DOKLVPYHKHbe7bA3hEl262EabLk%3D&x-amz-security-token=FwoGZXIvYXdzEND%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDEl1%2FfpVCJkRvEKkJyKYBBTbjfsDBPKMZsYVU8tO3MMNCxvwAgtzUCvoxqOtEXYmVfCABwvF3jgvXCHup%2BdG3QYV7jHEfAgBLWI%2BMGI%2F%2FntPwdsdsMTxKhSJgymaUq8n8O4GmCSExT5o34U1uhAFpr2YPbrQWdYfuo%2FKIWGTHoBbikLf14yb1sa%2FicwMeVItzrTk%2FSvPAuJCSJh3Mnq%2BlXSSuviKpyMB226UjZPZ6zUYnSwwDHlQFueVRTJopaPvDh8LBlFQIiZqSxRDFqZDCC00rVv17pbD2tRT0kpVoAhE2QXIGzKiErsPJwsWYhOSra2idSUI3gRCHcJpvuTz2ZNBlY1G%2B%2BzJ%2B07LAkXQT4ppBbpO%2BUvo8pN4aTDvvsztgp2pK6wjWCKUBsRcdhpJ96W%2FzK5BepEflzbG%2BWyVaUuIgpd4OAVY4ieR%2BEDPCVqwb2J3tHWPLK1mnLFAKF5%2Fe68pnRpfLHqjl5h03IK5xbWWJZOCThQx%2FHJtA8EWqNUF372GmAKhfpDvc%2BxitjeV5ym4HZRBeCYTiPnM190yLNklriyXxzLFUxWp28B3mm77%2BFK82%2B3PYxWmFPn9WAWZ%2Fa9FszXNfJ7q%2FtjzvophCsww9psYvhgM9LTgXXUgM6CgVL1OP5qxUAEYuV5Hrg3QSWKchrYh0aMrjrOygBxIXhBj6VDkvVdqg4snlS0cTdgjFZTHDZBvFwLN380Vn0233AV%2FjSJGJzyCKPGR5aAGMirgAQFta0KzQHT52sAvNtD6xfYgB1LU6TLR7AL7Ei%2BmPgZ77VVPe8dRuh8%3D&Expires=1680245340"
}
]
inappropriate prompt:
value:
results: [
{
"description": "Query doesn't stand with Bria's ethic rules",
"error_code": "408"
}
]
'400':
description: Bad request.
'403':
description: Forbidden. Insufficient permissions to access the image URL..
'405':
description: Method not allowed.
'415':
description: Unsupported Media Type. Invalid file type. Supported file types are jpeg, jpg, png, webp.
'422':
description: Unprocessable Entity. The URL does not point to a valid image or is inaccessible.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error.
/text-to-image/hd/{model_version}:
post:
tags:
- Image Generation
summary: Generate Image - HD model
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/text-to-image/hd"
description: >-
**Description**
The /text-to-image/hd Route is dedicated for projects demanding the utmost in image detail and clarity. This model allows for generating high-quality, photorealistic and artistic, images with unparalleled resolution of 1920x1080 (1:1 1536x1536) pixel, supporting a variety of aspect ratios natively to accommodate diverse creative needs.
**Advanced Customization and Access:**
Beyond the API, developers interested in deeper customization can access BRIA's models directly through Hugging Face. This alternative provides access to the underlying model source code, offering additional features such as ControlNets: Canny , Depth, and ReColoring. This option is ideal for developers seeking advanced control over the image generation process and those who wish to integrate cutting-edge AI directly into their workflows.
**Examples:**
**prompt**: A photo of detailed short female blond hair viewed from behind, with rich texture and clearly visible individual strands that give depth and realism, and featuring subtle waves reflect light
**BRIA HD model 2.2:**
**prompt**: A portrait of a Beautiful and playful ethereal singer, art deco, fantasy, intricate art deco golden designs, elegant, highly detailed, sharp focus, blurry background, teal and orange shades
**BRIA HD model 2.2:**
operationId: text-to-image/hd
parameters:
- in: path
name: model_version
schema:
type: string
enum: ["2.2"]
required: true
description: The model version you would like to use in the request.
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
prompt:
type: string
description: The prompt you would like to use to generate images. Bria currently supports prompts in English only, excluding special characters.
num_results:
type: integer
description: How many images you would like to generate.
minimum: 1
default: 4
maximum: 4
aspect_ratio:
type: string
description: The aspect ratio of the image.
default: "1:1"
enum: ["1:1","2:3","3:2","3:4","4:3","4:5","5:4","9:16","16:9"]
sync:
type: boolean
description: Determines the response mode. When true, responses are synchronous, and applicable to single-image requests. With false, responses are asynchronous, immediately providing URLs for images that are generated in the background. Use polling for the URLs to retrieve images once ready.
default: false
seed:
type: integer
description: You can choose whether you want your generated result to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response with the prompt, model type and model version. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.
negative_prompt:
type: string
description: Specify here elements that you didn't ask in the prompt, but are being generated, and you would like to exclude. This parameter is optional. Bria currently supports prompts in English only.
steps_num:
type: integer
description: The number of iterations the model goes through to refine the generated image. This parameter is optional.
minimum: 20
default: 30
maximum: 50
text_guidance_scale:
type: number
format: float
description: Determines how closely the generated image should adhere to the input text description. This parameter is optional.
minimum: 1.0
maximum: 10.0
default: 5.0
medium:
type: string
enum: ['photography','art']
description: Which medium should be included in your generated images. This parameter is optional.
prompt_enhancement:
type: boolean
description: When set to true, enhances the provided prompt by generating additional, more descriptive variations, resulting in more diverse and creative output images. Note that turning this flag on may result in a few additional seconds to the inference time.
default: false
examples:
valid prompt:
value:
prompt: "a baby riding a bicycle in a field of flowers"
num_results: 1
sync: true
inappropriate prompt:
value:
prompt: "sensual"
num_results: 1
sync: true
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
result:
type: array
description: there are multiple objects in this array (based on the amount specified in num_results) and each object represents a single image.
items:
type: object
properties:
seed:
type: integer
description: If you want to recreate the result again, you should use in the request the prompt and the seed of the response.
urls:
type: string
description: This is the URL where the generated image can be found. Bria recognizes offensive and inappropriate images. The URL will lead to a 0-byte file if an image like that is generated. It will take a few seconds for the image to become available via this URL if sync=false.
examples:
valid prompt:
value:
results: [
{
"seed": 1525972691,
"urls": "https://bria-temp.s3.amazonaws.com/api/generate_image/a_4k_symmetrical_portrait_of_a_woman_traveling_in_the_world_realistic_soft_natural_lighting_85mm_lens_photography_dramatic_lighting_photo_realism_High_contrast_shadows/seed_1109401663.jpg?AWSAccessKeyId=ASIAUL5JH7ABJT4HG6MN&Signature=DOKLVPYHKHbe7bA3hEl262EabLk%3D&x-amz-security-token=FwoGZXIvYXdzEND%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDEl1%2FfpVCJkRvEKkJyKYBBTbjfsDBPKMZsYVU8tO3MMNCxvwAgtzUCvoxqOtEXYmVfCABwvF3jgvXCHup%2BdG3QYV7jHEfAgBLWI%2BMGI%2F%2FntPwdsdsMTxKhSJgymaUq8n8O4GmCSExT5o34U1uhAFpr2YPbrQWdYfuo%2FKIWGTHoBbikLf14yb1sa%2FicwMeVItzrTk%2FSvPAuJCSJh3Mnq%2BlXSSuviKpyMB226UjZPZ6zUYnSwwDHlQFueVRTJopaPvDh8LBlFQIiZqSxRDFqZDCC00rVv17pbD2tRT0kpVoAhE2QXIGzKiErsPJwsWYhOSra2idSUI3gRCHcJpvuTz2ZNBlY1G%2B%2BzJ%2B07LAkXQT4ppBbpO%2BUvo8pN4aTDvvsztgp2pK6wjWCKUBsRcdhpJ96W%2FzK5BepEflzbG%2BWyVaUuIgpd4OAVY4ieR%2BEDPCVqwb2J3tHWPLK1mnLFAKF5%2Fe68pnRpfLHqjl5h03IK5xbWWJZOCThQx%2FHJtA8EWqNUF372GmAKhfpDvc%2BxitjeV5ym4HZRBeCYTiPnM190yLNklriyXxzLFUxWp28B3mm77%2BFK82%2B3PYxWmFPn9WAWZ%2Fa9FszXNfJ7q%2FtjzvophCsww9psYvhgM9LTgXXUgM6CgVL1OP5qxUAEYuV5Hrg3QSWKchrYh0aMrjrOygBxIXhBj6VDkvVdqg4snlS0cTdgjFZTHDZBvFwLN380Vn0233AV%2FjSJGJzyCKPGR5aAGMirgAQFta0KzQHT52sAvNtD6xfYgB1LU6TLR7AL7Ei%2BmPgZ77VVPe8dRuh8%3D&Expires=1680245340"
}
]
inappropriate prompt:
value:
results: [
{
"description": "Query doesn't stand with Bria's ethic rules",
"error_code": "408"
}
]
'400':
description: Bad request.
'405':
description: Method not allowed.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error.
/reimagine:
post:
tags:
- Image Generation
summary: Reimagine
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/generate-image-with-reference"
description: >-
**Description**
The `/reimagine` endpoint in Bria’s API allows guiding image generation not just with prompts but also by using an input image. This feature retains the original structure and depth of the input while incorporating new materials, colors, and textures to create fresh visuals.
### Key Benefits
- **Simplified Structure Guidance**: Use a reference image to replicate its outline and depth, reducing the need for complex prompts and minimizing trial and error.
- **Versatile Input/Output Pairings**:
- Convert illustrations, sketches, or photos into new illustrative outputs.
- Transform photos into variations that maintain the original layout.
- **Adjustable Structure Influence**: Control how much the input image's structure impacts the output on a scale from 0 to 1, allowing for diverse creative results.
- **Aspect Ratio Preservation**: Ensures the output maintains the reference image's aspect ratio for layout consistency. The output resolution is approximately 1 megapixel.
- **Seamless Integration with Tailored Generation**: Combine structural references with tailored models to include unique IP characteristics in the generated outputs. At the moment, tailored models trained using the 'Max' training version, are not supported in this endpoint.
### Potential Use Cases
**Enhanced Creative Control for Platforms & Editing Tools**
Empower creative platforms and editing tools with advanced levels of control and flexibility for generating visual content.
- **Maintain Spatial Consistency**
Structure reference image
Generated Visual (combined into a gif)
- **Convert Sketches to Illustrations**
Structure reference image
prompt: A watercolor painting of a lively urban street featuring a red vintage car parked in front of multi-story buildings, where soft, fluid brushstrokes capture the subtle gradients in the building facades, with warm earth tones blending into cool blues and grays for the shadows, giving the scene a nostalgic and dreamy atmosphere.
structure_ref_influence: 0.75
Generated Visual
- **Generate Diverse Variations**
Structure reference image
prompt: A ginger kitten sits on a textured beige surface, surrounded by soft balls of yarn.
structure_ref_influence: 0.75
Generated Visual
- **Stylize Typography and Logos**
Structure reference image
prompt: curled orange peel.
structure_ref_influence: 0.1
Generated Visual
**Interoperability with Tailored Generation**
- **Reskin Gaming Assets**: Maintain the structure and detail of assets while updating textures and colors for fresh looks without altering the original shape or layout.
- **Iterate on Gaming Asset Designs**: Simplifies design iteration for gaming assets, enabling rapid exploration and refinement.
- **Customize Marketing Assets**: Transform marketing visuals while preserving their composition, adding new styles and elements with structural guidance.
- **Adapt User-Generated Content**: Repurpose user-generated content for marketing campaigns, making it fit seamlessly with brand aesthetics.
**For practical tips, view our guide [here](https://www.notion.so/134ba153467980a28d25de394f651c4a?pvs=21).**
operationId: reimagine
parameters:
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
structure_image_url:
type: string
description: A publicly available URL of the structure reference image. If both structure_image_url and structure_image_file are provided, structure_image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
structure_image_file:
type: string
description: The image file containing the structure reference, in base64 format. This parameter is used if structure_image_url is not provided. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
structure_ref_influence:
type: number
format: float
minimum: 0.00
maximum: 1.00
default: 0.75
description: The influence of the structure reference on the generated image. This parameter is optional. Higher value means more adherence to the reference structure.
prompt:
type: string
description: The text prompt describing the desired output image.
num_results:
type: integer
description: How many images you would like to generate. This parameter is optional. When fast=false, only num_results=1 is supported.
minimum: 1
default: 4
maximum: 4
sync:
type: boolean
description: Determines the response mode. When true, responses are synchronous. With false, responses are asynchronous, immediately providing URLs for images that are generated in the background. Use polling for the URLs to retrieve images once ready. This parameter is optional. When fast=false, it is reomcmned to use sync=false.
default: true
fast:
type: boolean
default: true
description: Determines the generation mode. When true, the generation will utilize the fast mode which provides the best balance between speed and quality. When false, the regular mode will be utilized.
seed:
type: integer
description: You can choose whether you want your generated result to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response with the prompt and other parameters. This parameter is optional.
tailored_model_id:
type: string
description: The ID of the tailored model to use for generation. This parameter is optional. At the moment, tailored models trained using the 'Max' training version, are not supported in this endpoint.
tailored_model_influence:
type: number
format: float
minimum: 0.00
maximum: 1.00
default: 0.5
description: The influence of the tailored model on the generation. Only relevant if tailored_model_id is provided. This parameter is optional. Higher value gives more weight to the tailored model.
include_generation_prefix:
type: boolean
default: true
description: This is relevant only when a tailored model is being used. When true, the model's generation prefix is automatically prepended to your prompt to maintain consistency with the training data, while false allows you to override the training prefix and write the complete prompt yourself, including any preferred prefix text.
steps_num:
type: integer
description: The number of iterations the model goes through to refine the generated image. This parameter is optional. When fast=false, the default value is 30, the minimum is 20 and the maximum is 50.
minimum: 4
default: 12
maximum: 20
examples:
valid prompt:
value:
prompt: "a baby riding a bicycle in a field of flowers"
structure_image_url: "URL"
num_results: 1
sync: false
inappropriate prompt:
value:
prompt: "sensual"
structure_image_url: "URL"
num_results: 1
sync: false
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
result:
type: array
description: there are multiple objects in this array (based on the amount specified in num_results) and each object represents a single image.
items:
type: object
properties:
seed:
type: integer
description: If you want to recreate the result again, you should use in the request the prompt and the seed of the response.
urls:
type: string
description: This is the URL where the generated image can be found. Bria recognizes offensive and inappropriate images. The URL will lead to a 0-byte file if an image like that is generated. It will take a few seconds for the image to become available via this URL if sync=false.
examples:
valid prompt:
value:
results: [
{
"seed": 1525972691,
"urls": "https://bria-temp.s3.amazonaws.com/api/generate_image/a_4k_symmetrical_portrait_of_a_woman_traveling_in_the_world_realistic_soft_natural_lighting_85mm_lens_photography_dramatic_lighting_photo_realism_High_contrast_shadows/seed_1109401663.jpg?AWSAccessKeyId=ASIAUL5JH7ABJT4HG6MN&Signature=DOKLVPYHKHbe7bA3hEl262EabLk%3D&x-amz-security-token=FwoGZXIvYXdzEND%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDEl1%2FfpVCJkRvEKkJyKYBBTbjfsDBPKMZsYVU8tO3MMNCxvwAgtzUCvoxqOtEXYmVfCABwvF3jgvXCHup%2BdG3QYV7jHEfAgBLWI%2BMGI%2F%2FntPwdsdsMTxKhSJgymaUq8n8O4GmCSExT5o34U1uhAFpr2YPbrQWdYfuo%2FKIWGTHoBbikLf14yb1sa%2FicwMeVItzrTk%2FSvPAuJCSJh3Mnq%2BlXSSuviKpyMB226UjZPZ6zUYnSwwDHlQFueVRTJopaPvDh8LBlFQIiZqSxRDFqZDCC00rVv17pbD2tRT0kpVoAhE2QXIGzKiErsPJwsWYhOSra2idSUI3gRCHcJpvuTz2ZNBlY1G%2B%2BzJ%2B07LAkXQT4ppBbpO%2BUvo8pN4aTDvvsztgp2pK6wjWCKUBsRcdhpJ96W%2FzK5BepEflzbG%2BWyVaUuIgpd4OAVY4ieR%2BEDPCVqwb2J3tHWPLK1mnLFAKF5%2Fe68pnRpfLHqjl5h03IK5xbWWJZOCThQx%2FHJtA8EWqNUF372GmAKhfpDvc%2BxitjeV5ym4HZRBeCYTiPnM190yLNklriyXxzLFUxWp28B3mm77%2BFK82%2B3PYxWmFPn9WAWZ%2Fa9FszXNfJ7q%2FtjzvophCsww9psYvhgM9LTgXXUgM6CgVL1OP5qxUAEYuV5Hrg3QSWKchrYh0aMrjrOygBxIXhBj6VDkvVdqg4snlS0cTdgjFZTHDZBvFwLN380Vn0233AV%2FjSJGJzyCKPGR5aAGMirgAQFta0KzQHT52sAvNtD6xfYgB1LU6TLR7AL7Ei%2BmPgZ77VVPe8dRuh8%3D&Expires=1680245340"
}
]
inappropriate prompt:
value:
results: [
{
"description": "Query doesn't stand with Bria's ethic rules",
"error_code": "408"
}
]
'400':
description: Bad request.
'403':
description: Forbidden. Insufficient permissions to access the image URL.
'405':
description: Method not allowed.
'415':
description: Unsupported Media Type. Invalid file type. Supported file types are jpeg, jpg, png, webp.
'422':
description: Unprocessable Entity. The URL does not point to a valid image or is inaccessible.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error.
/prompt_enhancer:
post:
tags:
- Image Generation
summary: Prompt enhancement
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/prompt-enhancement"
description: >-
**Description**
The /prompt_enhancer route is designed to boost users' creativity by transforming simple prompts into more detailed and vivid descriptions. This helps generate richer, more diverse images. (It is also available as a built-in flag in all of our /text-to-image routes, excluding tailored generation.)
We recommend using this feature by offering users a range of prompts to choose from before generating an image, enabling them to explore creative ideas.
*Works best with short to medium prompts of up to approximately 50 words.
**Examples:**
**original prompt**: A cat
**enhanced prompt**: A black and white photograph of a sophisticated Siamese cat, sitting in a chair next to a large window, with the urban cityscape visible in the background
operationId: prompt_enhancer
parameters:
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
prompt:
type: string
description: The original prompt that to enhance.
examples:
valid prompt:
value:
prompt: "an old man fishing"
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
results:
type: string
description: the new enhanced prompt
examples:
valid prompt:
value:
results: {
"prompt variations": "A close-up, detailed illustration of a fluffy white cat sitting on a windowsill, with its eyes wide open, surrounded by soft, warm light, and a few books scattered nearby"
}
'400':
description: Bad request.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error.
/text-to-vector/base/{model_version}:
post:
tags:
- Image Generation
summary: Generate Vector Graphics - Base (Beta)
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/text-to-vector/base"
description: >-
**Description**
The /text-to-vector/base route offers the ability to generate high-quality, editable vector graphic assets from textual prompts at scale. This endpoint allows for generating quality vector graphics such as icons, logos, and other illustrations.
**Examples:**
**prompt**: A sticker of a cute kitten
**prompt**: A beautiful butterfly

On the left, a generated vector illustration. On the right, the same illustration after being re-colored in a vector editor
### Guidance Methods
This API supports various guidance methods to provide greater control over text-to-image generation. These methods condition the model on additional inputs derived from user-provided images.
**ControlNets**:
A set of methods that allow conditioning the model on additional inputs, providing detailed control over image generation.
- **controlnet_canny**: Uses edge information from the input image to guide generation based on structural outlines.
- **controlnet_depth**: Derives depth information to influence spatial arrangement in the generated image.
- **controlnet_recoloring**: Uses a grayscale version of the input image to guide recoloring while preserving geometry.
- **controlnet_color_grid**: Extracts a 16x16 color grid from the input image to guide the color scheme of the generated image.
**Using ControlNets**
You can specify up to four ControlNet guidance methods in a single request. Each method requires an accompanying image and a scale parameter to determine its impact on the generation inference. The table below provides detailed information about each guidance method, with an example os use:
| Guidance Method |
Prompt |
Scale |
Input Image |
Guidance Image |
Output Image |
| ControlNet Canny |
An exotic colorful shell on the beach |
1.0 |
 |
 |
 |
| ControlNet Depth |
A dog, exploring an alien planet |
0.8 |
 |
 |
 |
| ControlNet Recoloring |
A vibrant photo of a woman |
1.00 |
 |
 |
 |
| ControlNet Color Grid |
A dynamic fantasy illustration of an erupting volcano |
0.7 |
 |
 |
 |
To use **ControlNets** guidance method, include the following parameters in your request:
- `guidance_method_X`: Specify the guidance method (where X is 1, 2). If the paramter guidance_method_2 is used, so does guidance_method_1 has to be used, and so on. If you would like to use only one method, use the paratmer guidance_method_1
- `guidance_method_X_scale`: Set the impact of the guidance (0.0 to 1.0)
- `guidance_method_X_image_file`: Provide the base64-encoded input image
**IP_adapter**:
Guides the model based on the input image and its associated style. This method offers two modes:
- **regular**: Uses the full input image to condition the model, influencing both content and style.
- **style_only**: Focuses only on the style of the input image, allowing the model to generate images based on the provided aesthetic without altering the content.
**Using IP-Adapter**
| Guidance Method |
Prompt |
Mode |
Scale |
Guidance Image |
Output Image |
| IP-adapter |
A drawing of a lion laid on a table. |
regular |
0.85 |
 |
 |
| IP-adapter |
A drawing of a bird. |
style |
1 |
 |
 |
operationId: text-to-vector/base
parameters:
- in: path
name: model_version
schema:
type: string
enum: ["2.3"]
required: true
description: The model version you would like to use in the request.
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
prompt:
type: string
description: The prompt you would like to use to generate images. Bria currently supports prompts in English only, excluding special characters.
num_results:
type: integer
description: How many images you would like to generate. When using any Guidance Method, please use the value 1.
minimum: 1
default: 4
maximum: 4
aspect_ratio:
type: string
description: The aspect ratio of the image.
default: "1:1"
enum: ["1:1","2:3","3:2","3:4","4:3","4:5","5:4","9:16","16:9"]
sync:
type: boolean
description: Determines the response mode. When true, responses are synchronous. With false, responses are asynchronous, immediately providing URLs for images that are generated in the background. Use polling for the URLs to retrieve images once ready.
default: false
seed:
type: integer
description: You can choose whether you want your generated result to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response with the prompt, model type and model version. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.
negative_prompt:
type: string
description: Specify here elements that you didn't ask in the prompt, but are being generated, and you would like to exclude. This parameter is optional. Bria currently supports prompts in English only.
steps_num:
type: integer
description: The number of iterations the model goes through to refine the generated image. This parameter is optional.
minimum: 20
default: 30
maximum: 50
text_guidance_scale:
type: number
format: float
description: Determines how closely the generated image should adhere to the input text description. This parameter is optional.
minimum: 1.0
maximum: 10.0
default: 5.0
guidance_method_1:
type: string
enum: ['controlnet_canny','controlnet_depth','controlnet_recoloring', 'controlnet_color_grid']
description: Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional.
guidance_method_1_scale:
type: number
format: float
minimum: 0.0
maximum: 1.0
default: 1.0
description: The impact of the guidance.
guidance_method_1_image_file:
type: string
description: The image that should be used as guidance, in base64 format, with the method defined in guidance_method_1. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.
guidance_method_2:
type: string
enum: ['controlnet_canny','controlnet_depth','controlnet_recoloring', 'controlnet_color_grid']
description: Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional.
guidance_method_2_scale:
type: number
format: float
minimum: 0.0
maximum: 1.0
default: 1.0
description: The impact of the guidance.
guidance_method_2_image_file:
type: string
description: The image that should be used as guidance, in base64 format, with the method defined in guidance_method_2. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.
image_prompt_mode:
type: string
enum: [regular, style_only]
default: regular
description: |
The mode to apply to the image guidance.
- `regular`: Uses both content and style from the provided image for the generation.
- `style_only`: Uses only the style from the provided image.
image_prompt_file:
type: string
description: |
The image file to be used as guidance for the IP-Adapter, in base64 format. Accepted formats are jpeg, jpg, png, webp.
Maximum file size 12MB.
image_prompt_urls:
type: array
items:
type: string
format: uri
description: |
A list of URLs of images that should be used as guidance for the IP-Adapter. Accepted formats are jpeg, jpg, png, webp.
The URLs should point to accessible, publicly available images.
image_prompt_scale:
type: number
format: float
minimum: 0.0
maximum: 1.0
default: 1.0
description: |
The impact of the provided image on the generated results. A value between 0.0 (no impact) and 1.0 (full impact).
examples:
valid prompt:
value:
prompt: "A simplistic flat icon of a megaphone"
num_results: 1
sync: true
inappropriate prompt:
value:
prompt: "sensual"
num_results: 1
sync: true
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
results:
type: array
description: there are multiple objects in this array (based on the amount specified in num_results) and each object represents a single image.
items:
type: object
properties:
seed:
type: integer
description: If you want to recreate the result again, you should use in the request the prompt and the seed of the response.
urls:
type: string
description: This is the URL where the generated image can be found. Bria recognizes offensive and inappropriate images. The URL will lead to a 0-byte file if an image like that is generated. It will take a few seconds for the image to become available via this URL if sync=false.
examples:
valid prompt:
value:
results: [
{
"seed": 1525972691,
"urls": "https://bria-temp.s3.amazonaws.com/api/generate_image/a_4k_symmetrical_portrait_of_a_woman_traveling_in_the_world_realistic_soft_natural_lighting_85mm_lens_photography_dramatic_lighting_photo_realism_High_contrast_shadows/seed_1109401663.jpg?AWSAccessKeyId=ASIAUL5JH7ABJT4HG6MN&Signature=DOKLVPYHKHbe7bA3hEl262EabLk%3D&x-amz-security-token=FwoGZXIvYXdzEND%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDEl1%2FfpVCJkRvEKkJyKYBBTbjfsDBPKMZsYVU8tO3MMNCxvwAgtzUCvoxqOtEXYmVfCABwvF3jgvXCHup%2BdG3QYV7jHEfAgBLWI%2BMGI%2F%2FntPwdsdsMTxKhSJgymaUq8n8O4GmCSExT5o34U1uhAFpr2YPbrQWdYfuo%2FKIWGTHoBbikLf14yb1sa%2FicwMeVItzrTk%2FSvPAuJCSJh3Mnq%2BlXSSuviKpyMB226UjZPZ6zUYnSwwDHlQFueVRTJopaPvDh8LBlFQIiZqSxRDFqZDCC00rVv17pbD2tRT0kpVoAhE2QXIGzKiErsPJwsWYhOSra2idSUI3gRCHcJpvuTz2ZNBlY1G%2B%2BzJ%2B07LAkXQT4ppBbpO%2BUvo8pN4aTDvvsztgp2pK6wjWCKUBsRcdhpJ96W%2FzK5BepEflzbG%2BWyVaUuIgpd4OAVY4ieR%2BEDPCVqwb2J3tHWPLK1mnLFAKF5%2Fe68pnRpfLHqjl5h03IK5xbWWJZOCThQx%2FHJtA8EWqNUF372GmAKhfpDvc%2BxitjeV5ym4HZRBeCYTiPnM190yLNklriyXxzLFUxWp28B3mm77%2BFK82%2B3PYxWmFPn9WAWZ%2Fa9FszXNfJ7q%2FtjzvophCsww9psYvhgM9LTgXXUgM6CgVL1OP5qxUAEYuV5Hrg3QSWKchrYh0aMrjrOygBxIXhBj6VDkvVdqg4snlS0cTdgjFZTHDZBvFwLN380Vn0233AV%2FjSJGJzyCKPGR5aAGMirgAQFta0KzQHT52sAvNtD6xfYgB1LU6TLR7AL7Ei%2BmPgZ77VVPe8dRuh8%3D&Expires=1680245340"
}
]
inappropriate prompt:
value:
results: [
{
"description": "Query doesn't stand with Bria's ethic rules",
"error_code": "408"
}
]
'209':
description: Successful operation, a model version that is no longer available was requested. The request was redirected to the latest model version.
content:
application/json:
schema:
type: object
properties:
results:
type: array
description: there are multiple objects in this array (based on the amount specified in num_results) and each object represents a single image.
items:
type: object
properties:
seed:
type: integer
description: If you want to recreate the result again, you should use in the request the prompt and the seed of the response.
urls:
type: string
description: This is the URL where the generated image can be found. Bria recognizes offensive and inappropriate images. The URL will lead to a 0-byte file if an image like that is generated. It will take a few seconds for the image to become available via this URL if sync=false.
examples:
valid prompt:
value:
results: [
{
"seed": 1525972691,
"urls": "https://bria-temp.s3.amazonaws.com/api/generate_image/a_4k_symmetrical_portrait_of_a_woman_traveling_in_the_world_realistic_soft_natural_lighting_85mm_lens_photography_dramatic_lighting_photo_realism_High_contrast_shadows/seed_1109401663.jpg?AWSAccessKeyId=ASIAUL5JH7ABJT4HG6MN&Signature=DOKLVPYHKHbe7bA3hEl262EabLk%3D&x-amz-security-token=FwoGZXIvYXdzEND%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDEl1%2FfpVCJkRvEKkJyKYBBTbjfsDBPKMZsYVU8tO3MMNCxvwAgtzUCvoxqOtEXYmVfCABwvF3jgvXCHup%2BdG3QYV7jHEfAgBLWI%2BMGI%2F%2FntPwdsdsMTxKhSJgymaUq8n8O4GmCSExT5o34U1uhAFpr2YPbrQWdYfuo%2FKIWGTHoBbikLf14yb1sa%2FicwMeVItzrTk%2FSvPAuJCSJh3Mnq%2BlXSSuviKpyMB226UjZPZ6zUYnSwwDHlQFueVRTJopaPvDh8LBlFQIiZqSxRDFqZDCC00rVv17pbD2tRT0kpVoAhE2QXIGzKiErsPJwsWYhOSra2idSUI3gRCHcJpvuTz2ZNBlY1G%2B%2BzJ%2B07LAkXQT4ppBbpO%2BUvo8pN4aTDvvsztgp2pK6wjWCKUBsRcdhpJ96W%2FzK5BepEflzbG%2BWyVaUuIgpd4OAVY4ieR%2BEDPCVqwb2J3tHWPLK1mnLFAKF5%2Fe68pnRpfLHqjl5h03IK5xbWWJZOCThQx%2FHJtA8EWqNUF372GmAKhfpDvc%2BxitjeV5ym4HZRBeCYTiPnM190yLNklriyXxzLFUxWp28B3mm77%2BFK82%2B3PYxWmFPn9WAWZ%2Fa9FszXNfJ7q%2FtjzvophCsww9psYvhgM9LTgXXUgM6CgVL1OP5qxUAEYuV5Hrg3QSWKchrYh0aMrjrOygBxIXhBj6VDkvVdqg4snlS0cTdgjFZTHDZBvFwLN380Vn0233AV%2FjSJGJzyCKPGR5aAGMirgAQFta0KzQHT52sAvNtD6xfYgB1LU6TLR7AL7Ei%2BmPgZ77VVPe8dRuh8%3D&Expires=1680245340"
}
]
'400':
description: Bad request.
'405':
description: Method not allowed.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error.
/text-to-vector/fast/{model_version}:
post:
tags:
- Image Generation
summary: Generate Vector Graphics - Fast (Beta)
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/text-to-vector/fast"
description: >-
**Description**
The /text-to-vector/fast route is optimized for speed, enabling rapid vector graphics creation without compromising quality. This endpoint allows for generating high-quality vector graphics such as icons, logos, and other illustrations.
**Examples:**
**prompt**: An icon of a bird with a blue head and yellow beak against a solid background
### Guidance Methods
This API supports various guidance methods to provide greater control over text-to-image generation. These methods condition the model on additional inputs derived from user-provided images.
**ControlNets**:
A set of methods that allow conditioning the model on additional inputs, providing detailed control over image generation.
- **controlnet_canny**: Uses edge information from the input image to guide generation based on structural outlines.
- **controlnet_depth**: Derives depth information to influence spatial arrangement in the generated image.
- **controlnet_recoloring**: Uses a grayscale version of the input image to guide recoloring while preserving geometry.
- **controlnet_color_grid**: Extracts a 16x16 color grid from the input image to guide the color scheme of the generated image.
**Using ControlNets**
You can specify up to four ControlNet guidance methods in a single request. Each method requires an accompanying image and a scale parameter to determine its impact on the generation inference. The table below provides detailed information about each guidance method, with an example os use:
| Guidance Method |
Prompt |
Scale |
Input Image |
Guidance Image |
Output Image |
| ControlNet Canny |
An exotic colorful shell on the beach |
1.0 |
 |
 |
 |
| ControlNet Depth |
A dog, exploring an alien planet |
0.8 |
 |
 |
 |
| ControlNet Recoloring |
A vibrant photo of a woman |
1.00 |
 |
 |
 |
| ControlNet Color Grid |
A dynamic fantasy illustration of an erupting volcano |
0.7 |
 |
 |
 |
To use **ControlNets** guidance method, include the following parameters in your request:
- `guidance_method_X`: Specify the guidance method (where X is 1, 2). If the paramter guidance_method_2 is used, so does guidance_method_1 has to be used, and so on. If you would like to use only one method, use the paratmer guidance_method_1
- `guidance_method_X_scale`: Set the impact of the guidance (0.0 to 1.0)
- `guidance_method_X_image_file`: Provide the base64-encoded input image
**IP_adapter**:
Guides the model based on the input image and its associated style. This method offers two modes:
- **regular**: Uses the full input image to condition the model, influencing both content and style.
- **style_only**: Focuses only on the style of the input image, allowing the model to generate images based on the provided aesthetic without altering the content.
**Using IP-Adapter**
| Guidance Method |
Prompt |
Mode |
Scale |
Guidance Image |
Output Image |
| IP-adapter |
A drawing of a lion laid on a table. |
regular |
0.85 |
 |
 |
| IP-adapter |
A drawing of a bird. |
style |
1 |
 |
 |
operationId: text-to-vector/fast
parameters:
- in: path
name: model_version
schema:
type: string
enum: ["2.3"]
required: true
description: The model version you would like to use in the request.
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
prompt:
type: string
description: The prompt you would like to use to generate images. Bria currently supports prompts in English only, excluding special characters.
num_results:
type: integer
description: How many images you would like to generate. When using any Guidance Method, please use the value 1.
minimum: 1
maximum: 4
default: 4
aspect_ratio:
type: string
description: The aspect ratio of the image.
default: "1:1"
enum: ["1:1","2:3","3:2","3:4","4:3","4:5","5:4","9:16","16:9"]
sync:
type: boolean
description: Determines the response mode. When true, responses are synchronous. With false, responses are asynchronous, immediately providing URLs for images that are generated in the background. Use polling for the URLs to retrieve images once ready.
default: false
seed:
type: integer
description: You can choose whether you want your generated result to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response with the prompt, model type and model version. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.
steps_num:
type: integer
description: The number of iterations the model goes through to refine the generated image. This parameter is optional.
minimum: 4
maximum: 10
default: 8
guidance_method_1:
type: string
enum: ['controlnet_canny','controlnet_depth','controlnet_recoloring', 'controlnet_color_grid']
description: Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional.
guidance_method_1_scale:
type: number
format: float
minimum: 0.0
maximum: 1.0
default: 1.0
description: The impact of the guidance.
guidance_method_1_image_file:
type: string
description: The image that should be used as guidance, in base64 format, with the method defined in guidance_method_1. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.
guidance_method_2:
type: string
enum: ['controlnet_canny','controlnet_depth','controlnet_recoloring', 'controlnet_color_grid']
description: Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional.
guidance_method_2_scale:
type: number
format: float
minimum: 0.0
maximum: 1.0
default: 1.0
description: The impact of the guidance.
guidance_method_2_image_file:
type: string
description: The image that should be used as guidance, in base64 format, with the method defined in guidance_method_2. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.
image_prompt_mode:
type: string
enum: [regular, style_only]
default: regular
description: |
The mode to apply to the image guidance.
- `regular`: Uses both content and style from the provided image for the generation.
- `style_only`: Uses only the style from the provided image.
image_prompt_file:
type: string
description: |
The image file to be used as guidance for the IP-Adapter, in base64 format. Accepted formats are jpeg, jpg, png, webp.
Maximum file size 12MB.
image_prompt_urls:
type: array
items:
type: string
format: uri
description: |
A list of URLs of images that should be used as guidance for the IP-Adapter. Accepted formats are jpeg, jpg, png, webp.
The URLs should point to accessible, publicly available images.
image_prompt_scale:
type: number
format: float
minimum: 0.0
maximum: 1.0
default: 1.0
description: |
The impact of the provided image on the generated results. A value between 0.0 (no impact) and 1.0 (full impact).
examples:
valid prompt:
value:
prompt: "A simplistic flat icon of a megaphone"
num_results: 1
sync: true
inappropriate prompt:
value:
prompt: "sensual"
num_results: 1
sync: true
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
results:
type: array
description: there are multiple objects in this array (based on the amount specified in num_results) and each object represents a single image.
items:
type: object
properties:
seed:
type: integer
description: If you want to recreate the result again, you should use in the request the prompt and the seed of the response.
urls:
type: string
description: This is the URL where the generated image can be found. Bria recognizes offensive and inappropriate images. The URL will lead to a 0-byte file if an image like that is generated. It will take a few seconds for the image to become available via this URL if sync=false.
examples:
valid prompt:
value:
results: [
{
"seed": 1525972691,
"urls": "https://bria-temp.s3.amazonaws.com/api/generate_image/a_4k_symmetrical_portrait_of_a_woman_traveling_in_the_world_realistic_soft_natural_lighting_85mm_lens_photography_dramatic_lighting_photo_realism_High_contrast_shadows/seed_1109401663.jpg?AWSAccessKeyId=ASIAUL5JH7ABJT4HG6MN&Signature=DOKLVPYHKHbe7bA3hEl262EabLk%3D&x-amz-security-token=FwoGZXIvYXdzEND%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDEl1%2FfpVCJkRvEKkJyKYBBTbjfsDBPKMZsYVU8tO3MMNCxvwAgtzUCvoxqOtEXYmVfCABwvF3jgvXCHup%2BdG3QYV7jHEfAgBLWI%2BMGI%2F%2FntPwdsdsMTxKhSJgymaUq8n8O4GmCSExT5o34U1uhAFpr2YPbrQWdYfuo%2FKIWGTHoBbikLf14yb1sa%2FicwMeVItzrTk%2FSvPAuJCSJh3Mnq%2BlXSSuviKpyMB226UjZPZ6zUYnSwwDHlQFueVRTJopaPvDh8LBlFQIiZqSxRDFqZDCC00rVv17pbD2tRT0kpVoAhE2QXIGzKiErsPJwsWYhOSra2idSUI3gRCHcJpvuTz2ZNBlY1G%2B%2BzJ%2B07LAkXQT4ppBbpO%2BUvo8pN4aTDvvsztgp2pK6wjWCKUBsRcdhpJ96W%2FzK5BepEflzbG%2BWyVaUuIgpd4OAVY4ieR%2BEDPCVqwb2J3tHWPLK1mnLFAKF5%2Fe68pnRpfLHqjl5h03IK5xbWWJZOCThQx%2FHJtA8EWqNUF372GmAKhfpDvc%2BxitjeV5ym4HZRBeCYTiPnM190yLNklriyXxzLFUxWp28B3mm77%2BFK82%2B3PYxWmFPn9WAWZ%2Fa9FszXNfJ7q%2FtjzvophCsww9psYvhgM9LTgXXUgM6CgVL1OP5qxUAEYuV5Hrg3QSWKchrYh0aMrjrOygBxIXhBj6VDkvVdqg4snlS0cTdgjFZTHDZBvFwLN380Vn0233AV%2FjSJGJzyCKPGR5aAGMirgAQFta0KzQHT52sAvNtD6xfYgB1LU6TLR7AL7Ei%2BmPgZ77VVPe8dRuh8%3D&Expires=1680245340"
}
]
inappropriate prompt:
value:
results: [
{
"description": "Query doesn't stand with Bria's ethic rules",
"error_code": "408"
}
]
'400':
description: Bad request.
'405':
description: Method not allowed.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error.
# tailored routes
/text-to-image/tailored/{model_id}:
post:
tags:
- Tailored Generation
summary: Generate Image - Tailored model
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/text-to-image/tailored"
description: >-
**Description**
This route allows you to generate images using a Tailored Model. Tailored models are trained on a visual IP (illustrations, photos, vectors) to faithfully reproduce specific IP elements or guidelines. You can train an engine through our Console or implement training on your platform via API.
### Overview of Tailored Generation Training API
The Tailored Generation Training API provides a set of endpoints to manage the entire lifecycle of a tailored generation project:
1. **Project Management**: Create and manage projects which define the IP characteristics:
- **Create and Retrieve Projects**: Use the `/projects` endpoints to create a new project or retrieve existing projects that belong to your organization.
- **Define IP Type**: Specify the IP type (e.g., multi_object_set, defined_character, stylized_scene) and medium (currently illustration, with photography coming soon).
- **Manage Project Details**: Use the `/projects/{id}` endpoints to update or delete specific projects.
2. **Dataset Management**: Create and manage datasets within your projects. You can:
- **Create and Retrieve Datasets**: Use the `/datasets` endpoints to create new datasets or retrieve existing ones.
- **Upload and Manage Images**: Use the `/datasets/{dataset_id}/images` endpoints to upload images and manage their captions.
- **Clone Datasets**: Create variations of existing datasets using the clone functionality.
3. **Model Management**: Create and train models based on your datasets:
- **Create and Retrieve Models**: Use the `/models` endpoints to create new models or list existing ones.
- **Choose Training Version**: Select between "light" (for fast generation and structure reference compatibility) or "max" (for superior prompt alignment and enhanced learning capabilities).
- **Monitor and Control**: Manage the model lifecycle including training start/stop and status monitoring.
### Training Process Overview
To train a tailored model:
1. **Create a Project**: Use the `/projects` endpoint to create a project and define your IP type and medium.
2. **Create a Dataset**: Use the `/datasets` endpoint to create a dataset within your project.
3. **Upload Images**: Upload images to your dataset using the `/datasets/{dataset_id}/images` endpoint. Images must be 1024x1024px minimum.
4. **Prepare Dataset**: Review auto-generated captions and use the `/datasets/{id}` endpoint to set status to 'completed'.
5. **Create Model**: Use the `/models` endpoint to create a model, selecting light or max training version.
6. **Start Training**: Initiate training using the `/models/{id}/start_training` endpoint. Training takes 1-3 hours.
7. **Monitor Progress**: Check training status using the `/models/{id}` endpoint until status shows 'Completed'.
8. **Generate Images**: Once trained, your model can be used in multiple ways:
- Use the `/text-to-image/tailored/{model_id}` endpoint for text-to-image generation
- Use the `/text-to-vector/tailored/{model_id}` endpoint for generating illustrative vector graphics
- Use the `/reimagine/tailored/{model_id}` endpoint for generating using a structure reference images
- Access through the Bria platform interface
Alternatively, you can use the Bria platform to manage and train your tailored models through a user-friendly interface. Access the Bria platform [here](https://platform.bria.ai/console/tailored-generation).
### Guidance Methods
This API supports various guidance methods to provide greater control over text-to-image generation. These methods condition the model on additional inputs derived from user-provided images.
**ControlNets**:
A set of methods that allow conditioning the model on additional inputs, providing detailed control over image generation.
- **controlnet_canny**: Uses edge information from the input image to guide generation based on structural outlines.
- **controlnet_depth**: Derives depth information to influence spatial arrangement in the generated image.
- **controlnet_recoloring**: Uses a grayscale version of the input image to guide recoloring while preserving geometry.
- **controlnet_color_grid**: Extracts a 16x16 color grid from the input image to guide the color scheme of the generated image.
**Using ControlNets**
You can specify up to four ControlNet guidance methods in a single request. Each method requires an accompanying image and a scale parameter to determine its impact on the generation inference. The table below provides detailed information about each guidance method, with an example os use:
| Guidance Method |
Prompt |
Scale |
Input Image |
Guidance Image |
Output Image |
| ControlNet Canny |
An exotic colorful shell on the beach |
1.0 |
 |
 |
 |
| ControlNet Depth |
A dog, exploring an alien planet |
0.8 |
 |
 |
 |
| ControlNet Recoloring |
A vibrant photo of a woman |
1.00 |
 |
 |
 |
| ControlNet Color Grid |
A dynamic fantasy illustration of an erupting volcano |
0.7 |
 |
 |
 |
To use **ControlNets** guidance method, include the following parameters in your request:
- `guidance_method_X`: Specify the guidance method (where X is 1, 2). If the paramter guidance_method_2 is used, so does guidance_method_1 has to be used, and so on. If you would like to use only one method, use the paratmer guidance_method_1
- `guidance_method_X_scale`: Set the impact of the guidance (0.0 to 1.0)
- `guidance_method_X_image_file`: Provide the base64-encoded input image
**IP_adapter**:
Guides the model based on the input image and its associated style. This method offers two modes:
- **regular**: Uses the full input image to condition the model, influencing both content and style.
- **style_only**: Focuses only on the style of the input image, allowing the model to generate images based on the provided aesthetic without altering the content.
**Using IP-Adapter**
| Guidance Method |
Prompt |
Mode |
Scale |
Guidance Image |
Output Image |
| IP-adapter |
A drawing of a lion laid on a table. |
regular |
0.85 |
 |
 |
| IP-adapter |
A drawing of a bird. |
style |
1 |
 |
 |
operationId: text-to-image/tailored
parameters:
- in: path
name: model_id
schema:
type: string
required: true
description: The model id of the tailored model you would like to use in the request.
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
prompt:
type: string
description: The prompt you would like to use to generate images. Bria currently supports prompts in English only, excluding special characters.
num_results:
type: integer
description: How many images you would like to generate. This parameter is optional. When fast=false, only num_results 1, 2 are supported. and when using any guidance method, please use the value 1.
minimum: 1
maximum: 4
default: 4
aspect_ratio:
type: string
description: The aspect ratio of the image.
default: "1:1"
enum: ["1:1","2:3","3:2","3:4","4:3","4:5","5:4","9:16","16:9"]
sync:
type: boolean
description: Determines the response mode. When true, responses are synchronous. With false, responses are asynchronous, immediately providing URLs for images that are generated in the background. Use polling for the URLs to retrieve images once ready.
default: false
fast:
type: boolean
default: true
description: Determines the generation mode. When true, the generation will utilize the fast mode which provides the best balance between speed and quality. When false, the regular mode will be utilized. At the moment, tailored models trained using the 'Max' training version, do not support fast generation.
seed:
type: integer
description: You can choose whether you want your generated result to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response with the prompt, model type and model version. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.
steps_num:
type: integer
description: The number of iterations the model goes through to refine the generated image. This parameter is optional. When fast=false, the default value is 30, the minimum is 20 and the maximum is 50.
minimum: 4
maximum: 20
default: 8
model_influence:
type: number
format: float
minimum: 0.00
maximum: 1.00
default: 1.00
description: The influence of the structure reference on the generated image. This parameter is optional. Higher value means more adherence to the reference structure.
include_generation_prefix:
type: boolean
default: true
description: When true, the model's generation prefix is automatically prepended to your prompt to maintain consistency with the training data, while false allows you to override the training prefix and write the complete prompt yourself, including any preferred prefix text.
guidance_method_1:
type: string
enum: ['controlnet_canny','controlnet_depth','controlnet_recoloring', 'controlnet_color_grid']
description: Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional. At the moment, tailored models trained using the 'Max' training version, do not support generation with guidance methods.
guidance_method_1_scale:
type: number
format: float
minimum: 0.0
maximum: 1.0
default: 1.0
description: The impact of the guidance.
guidance_method_1_image_file:
type: string
description: The image that should be used as guidance, in base64 format, with the method defined in guidance_method_1. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.
guidance_method_2:
type: string
enum: ['controlnet_canny','controlnet_depth','controlnet_recoloring', 'controlnet_color_grid']
description: Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional. At the moment, tailored models trained using the 'Max' training version, do not support generation with guidance methods.
guidance_method_2_scale:
type: number
format: float
minimum: 0.0
maximum: 1.0
default: 1.0
description: The impact of the guidance.
guidance_method_2_image_file:
type: string
description: The image that should be used as guidance, in base64 format, with the method defined in guidance_method_2. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.
image_prompt_mode:
type: string
enum: [regular, style_only]
default: regular
description: |
The mode to apply to the image guidance.
- `regular`: Uses both content and style from the provided image for the generation.
- `style_only`: Uses only the style from the provided image.
image_prompt_file:
type: string
description: |
The image file to be used as guidance for the IP-Adapter, in base64 format. Accepted formats are jpeg, jpg, png, webp.
Maximum file size 12MB.
image_prompt_urls:
type: array
items:
type: string
format: uri
description: |
A list of URLs of images that should be used as guidance for the IP-Adapter. Accepted formats are jpeg, jpg, png, webp.
The URLs should point to accessible, publicly available images.
image_prompt_scale:
type: number
format: float
minimum: 0.0
maximum: 1.0
default: 1.0
description: |
The impact of the provided image on the generated results. A value between 0.0 (no impact) and 1.0 (full impact).
examples:
valid prompt:
value:
prompt: "a book"
num_results: 1
sync: true
inappropriate prompt:
value:
prompt: "sensual"
num_results: 1
sync: true
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
results:
type: array
description: there are multiple objects in this array (based on the amount specified in num_results) and each object represents a single image.
items:
type: object
properties:
seed:
type: integer
description: If you want to recreate the result again, you should use in the request the prompt and the seed of the response.
urls:
type: string
description: This is the URL where the generated image can be found. Bria recognizes offensive and inappropriate images. The URL will lead to a 0-byte file if an image like that is generated. It will take a few seconds for the image to become available via this URL if sync=false.
examples:
valid prompt:
value:
results: [
{
"seed": 1525972691,
"urls": "https://bria-temp.s3.amazonaws.com/api/generate_image/a_4k_symmetrical_portrait_of_a_woman_traveling_in_the_world_realistic_soft_natural_lighting_85mm_lens_photography_dramatic_lighting_photo_realism_High_contrast_shadows/seed_1109401663.jpg?AWSAccessKeyId=ASIAUL5JH7ABJT4HG6MN&Signature=DOKLVPYHKHbe7bA3hEl262EabLk%3D&x-amz-security-token=FwoGZXIvYXdzEND%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDEl1%2FfpVCJkRvEKkJyKYBBTbjfsDBPKMZsYVU8tO3MMNCxvwAgtzUCvoxqOtEXYmVfCABwvF3jgvXCHup%2BdG3QYV7jHEfAgBLWI%2BMGI%2F%2FntPwdsdsMTxKhSJgymaUq8n8O4GmCSExT5o34U1uhAFpr2YPbrQWdYfuo%2FKIWGTHoBbikLf14yb1sa%2FicwMeVItzrTk%2FSvPAuJCSJh3Mnq%2BlXSSuviKpyMB226UjZPZ6zUYnSwwDHlQFueVRTJopaPvDh8LBlFQIiZqSxRDFqZDCC00rVv17pbD2tRT0kpVoAhE2QXIGzKiErsPJwsWYhOSra2idSUI3gRCHcJpvuTz2ZNBlY1G%2B%2BzJ%2B07LAkXQT4ppBbpO%2BUvo8pN4aTDvvsztgp2pK6wjWCKUBsRcdhpJ96W%2FzK5BepEflzbG%2BWyVaUuIgpd4OAVY4ieR%2BEDPCVqwb2J3tHWPLK1mnLFAKF5%2Fe68pnRpfLHqjl5h03IK5xbWWJZOCThQx%2FHJtA8EWqNUF372GmAKhfpDvc%2BxitjeV5ym4HZRBeCYTiPnM190yLNklriyXxzLFUxWp28B3mm77%2BFK82%2B3PYxWmFPn9WAWZ%2Fa9FszXNfJ7q%2FtjzvophCsww9psYvhgM9LTgXXUgM6CgVL1OP5qxUAEYuV5Hrg3QSWKchrYh0aMrjrOygBxIXhBj6VDkvVdqg4snlS0cTdgjFZTHDZBvFwLN380Vn0233AV%2FjSJGJzyCKPGR5aAGMirgAQFta0KzQHT52sAvNtD6xfYgB1LU6TLR7AL7Ei%2BmPgZ77VVPe8dRuh8%3D&Expires=1680245340"
}
]
inappropriate prompt:
value:
results: [
{
"description": "Query doesn't stand with Bria's ethic rules",
"error_code": "408"
}
]
'400':
description: Bad request.
'405':
description: Method not allowed.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error.
/text-to-vector/tailored/{model_id}:
post:
tags:
- Tailored Generation
summary: Generate Vector Graphics - Tailored (Beta)
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/text-to-vector/tailored"
description: >-
**Description**
This route allows you to generate vector graphics using a Tailored Model. Tailored Models are trained on your visual IP (illustrations, photos, vectors) to preserve and faithfully reproduce specific IP elements or guidelines, ensuring consistency across all generated outputs.
To see a detailed description of the tailored models' functionalities, please refer to the /text-to-image/tailored/{model_id} route documentation.
*Text-to-vector is compatible with tailored models in the illustrative domain.
### Guidance Methods
This API supports various guidance methods to provide greater control over text-to-image generation. These methods condition the model on additional inputs derived from user-provided images.
**ControlNets**:
A set of methods that allow conditioning the model on additional inputs, providing detailed control over image generation.
- **controlnet_canny**: Uses edge information from the input image to guide generation based on structural outlines.
- **controlnet_depth**: Derives depth information to influence spatial arrangement in the generated image.
- **controlnet_recoloring**: Uses a grayscale version of the input image to guide recoloring while preserving geometry.
- **controlnet_color_grid**: Extracts a 16x16 color grid from the input image to guide the color scheme of the generated image.
**Using ControlNets**
You can specify up to four ControlNet guidance methods in a single request. Each method requires an accompanying image and a scale parameter to determine its impact on the generation inference. The table below provides detailed information about each guidance method, with an example os use:
| Guidance Method |
Prompt |
Scale |
Input Image |
Guidance Image |
Output Image |
| ControlNet Canny |
An exotic colorful shell on the beach |
1.0 |
 |
 |
 |
| ControlNet Depth |
A dog, exploring an alien planet |
0.8 |
 |
 |
 |
| ControlNet Recoloring |
A vibrant photo of a woman |
1.00 |
 |
 |
 |
| ControlNet Color Grid |
A dynamic fantasy illustration of an erupting volcano |
0.7 |
 |
 |
 |
To use **ControlNets** guidance method, include the following parameters in your request:
- `guidance_method_X`: Specify the guidance method (where X is 1, 2). If the paramter guidance_method_2 is used, so does guidance_method_1 has to be used, and so on. If you would like to use only one method, use the paratmer guidance_method_1
- `guidance_method_X_scale`: Set the impact of the guidance (0.0 to 1.0)
- `guidance_method_X_image_file`: Provide the base64-encoded input image
**IP_adapter**:
Guides the model based on the input image and its associated style. This method offers two modes:
- **regular**: Uses the full input image to condition the model, influencing both content and style.
- **style_only**: Focuses only on the style of the input image, allowing the model to generate images based on the provided aesthetic without altering the content.
**Using IP-Adapter**
| Guidance Method |
Prompt |
Mode |
Scale |
Guidance Image |
Output Image |
| IP-adapter |
A drawing of a lion laid on a table. |
regular |
0.85 |
 |
 |
| IP-adapter |
A drawing of a bird. |
style |
1 |
 |
 |
operationId: text-to-vector/tailored
parameters:
- in: path
name: model_id
schema:
type: string
required: true
description: The model id of the tailored model you would like to use in the request.
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
prompt:
type: string
description: The prompt you would like to use to generate images. Bria currently supports prompts in English only, excluding special characters.
num_results:
type: integer
description: How many images you would like to generate. This parameter is optional. When fast=false, only num_results 1, 2 are supported, and when using any guidance method, please use the value 1.
minimum: 1
maximum: 4
default: 4
aspect_ratio:
type: string
description: The aspect ratio of the image.
default: "1:1"
enum: ["1:1","2:3","3:2","3:4","4:3","4:5","5:4","9:16","16:9"]
sync:
type: boolean
description: Determines the response mode. When true, responses are synchronous. With false, responses are asynchronous, immediately providing URLs for images that are generated in the background. Use polling for the URLs to retrieve images once ready. This parameter is optional. When fast=false, it is reomcmned to use sync=false.
default: true
fast:
type: boolean
default: true
description: Determines the generation mode. When true, the generation will utilize the fast mode which provides the best balance between speed and quality. When false, the regular mode will be utilized. At the moment, tailored models trained using the 'Max' training version, do not support fast generation.
seed:
type: integer
description: You can choose whether you want your generated result to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response with the prompt, model type and model version. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.
steps_num:
type: integer
description: The number of iterations the model goes through to refine the generated image. This parameter is optional. When fast=false, the default value is 30, the minimum is 20 and the maximum is 50.
minimum: 4
maximum: 20
default: 8
model_influence:
type: number
format: float
minimum: 0.00
maximum: 1.00
default: 1.00
description: The influence of the tailored model on the generation. Only relevant if tailored_model_id is provided. This parameter is optional. Higher value gives more weight to the tailored model.
include_generation_prefix:
type: boolean
default: true
description: When true, the model's generation prefix is automatically prepended to your prompt to maintain consistency with the training data, while false allows you to override the training prefix and write the complete prompt yourself, including any preferred prefix text.
guidance_method_1:
type: string
enum: ['controlnet_canny','controlnet_depth','controlnet_recoloring', 'controlnet_color_grid']
description: Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional. At the moment, tailored models trained using the 'Max' training version, do not support generation with guidance methods.
guidance_method_1_scale:
type: number
format: float
minimum: 0.0
maximum: 1.0
default: 1.0
description: The impact of the guidance.
guidance_method_1_image_file:
type: string
description: The image that should be used as guidance, in base64 format, with the method defined in guidance_method_1. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.
guidance_method_2:
type: string
enum: ['controlnet_canny','controlnet_depth','controlnet_recoloring', 'controlnet_color_grid']
description: Which guidance type you would like to include in the generation. Up to 4 guidance methods can be combined during a single inference. This parameter is optional. At the moment, tailored models trained using the 'Max' training version, do not support generation with guidance methods.
guidance_method_2_scale:
type: number
format: float
minimum: 0.0
maximum: 1.0
default: 1.0
description: The impact of the guidance.
guidance_method_2_image_file:
type: string
description: The image that should be used as guidance, in base64 format, with the method defined in guidance_method_2. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. If more then one guidance method is used, all guidance images must be of the same aspect ratio, and this will be the aspect ratio of the generated results. If guidance_method_1 is selected, an image must be provided.
image_prompt_mode:
type: string
enum: [regular, style_only]
default: regular
description: |
The mode to apply to the image guidance.
- `regular`: Uses both content and style from the provided image for the generation.
- `style_only`: Uses only the style from the provided image.
image_prompt_file:
type: string
description: |
The image file to be used as guidance for the IP-Adapter, in base64 format. Accepted formats are jpeg, jpg, png, webp.
Maximum file size 12MB.
image_prompt_urls:
type: array
items:
type: string
format: uri
description: |
A list of URLs of images that should be used as guidance for the IP-Adapter. Accepted formats are jpeg, jpg, png, webp.
The URLs should point to accessible, publicly available images.
image_prompt_scale:
type: number
format: float
minimum: 0.0
maximum: 1.0
default: 1.0
description: |
The impact of the provided image on the generated results. A value between 0.0 (no impact) and 1.0 (full impact).
examples:
valid prompt:
value:
prompt: "a book"
num_results: 1
sync: true
inappropriate prompt:
value:
prompt: "sensual"
num_results: 1
sync: true
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
results:
type: array
description: there are multiple objects in this array (based on the amount specified in num_results) and each object represents a single image.
items:
type: object
properties:
seed:
type: integer
description: If you want to recreate the result again, you should use in the request the prompt and the seed of the response.
urls:
type: string
description: This is the URL where the generated image can be found. Bria recognizes offensive and inappropriate images. The URL will lead to a 0-byte file if an image like that is generated. It will take a few seconds for the image to become available via this URL if sync=false.
examples:
valid prompt:
value:
results: [
{
"seed": 1525972691,
"urls": "https://bria-temp.s3.amazonaws.com/api/generate_image/a_4k_symmetrical_portrait_of_a_woman_traveling_in_the_world_realistic_soft_natural_lighting_85mm_lens_photography_dramatic_lighting_photo_realism_High_contrast_shadows/seed_1109401663.jpg?AWSAccessKeyId=ASIAUL5JH7ABJT4HG6MN&Signature=DOKLVPYHKHbe7bA3hEl262EabLk%3D&x-amz-security-token=FwoGZXIvYXdzEND%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDEl1%2FfpVCJkRvEKkJyKYBBTbjfsDBPKMZsYVU8tO3MMNCxvwAgtzUCvoxqOtEXYmVfCABwvF3jgvXCHup%2BdG3QYV7jHEfAgBLWI%2BMGI%2F%2FntPwdsdsMTxKhSJgymaUq8n8O4GmCSExT5o34U1uhAFpr2YPbrQWdYfuo%2FKIWGTHoBbikLf14yb1sa%2FicwMeVItzrTk%2FSvPAuJCSJh3Mnq%2BlXSSuviKpyMB226UjZPZ6zUYnSwwDHlQFueVRTJopaPvDh8LBlFQIiZqSxRDFqZDCC00rVv17pbD2tRT0kpVoAhE2QXIGzKiErsPJwsWYhOSra2idSUI3gRCHcJpvuTz2ZNBlY1G%2B%2BzJ%2B07LAkXQT4ppBbpO%2BUvo8pN4aTDvvsztgp2pK6wjWCKUBsRcdhpJ96W%2FzK5BepEflzbG%2BWyVaUuIgpd4OAVY4ieR%2BEDPCVqwb2J3tHWPLK1mnLFAKF5%2Fe68pnRpfLHqjl5h03IK5xbWWJZOCThQx%2FHJtA8EWqNUF372GmAKhfpDvc%2BxitjeV5ym4HZRBeCYTiPnM190yLNklriyXxzLFUxWp28B3mm77%2BFK82%2B3PYxWmFPn9WAWZ%2Fa9FszXNfJ7q%2FtjzvophCsww9psYvhgM9LTgXXUgM6CgVL1OP5qxUAEYuV5Hrg3QSWKchrYh0aMrjrOygBxIXhBj6VDkvVdqg4snlS0cTdgjFZTHDZBvFwLN380Vn0233AV%2FjSJGJzyCKPGR5aAGMirgAQFta0KzQHT52sAvNtD6xfYgB1LU6TLR7AL7Ei%2BmPgZ77VVPe8dRuh8%3D&Expires=1680245340"
}
]
inappropriate prompt:
value:
results: [
{
"description": "Query doesn't stand with Bria's ethic rules",
"error_code": "408"
}
]
'400':
description: Bad request.
'403':
description: Forbidden. Insufficient permissions to access the image URL..
'405':
description: Method not allowed.
'415':
description: Unsupported Media Type. Invalid file type. Supported file types are jpeg, jpg, png, webp.
'422':
description: Unprocessable Entity. The URL does not point to a valid image or is inaccessible.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error.
/tailored-gen/projects:
post:
tags:
- Tailored Generation
summary: Create Project
description: |
Create a new project within the organization. A project encompasses all models trained and datasets created for the IP defined in the project.
The following IP types are supported:
**Multi-Object Set**
A collection of different objects sharing a common style, design language, or color scheme. Objects are typically isolated on solid backgrounds.
**Object Variants**
Multiple variations of the same object type, maintaining consistent style and structure while showing different interpretations. Objects are typically isolated on solid backgrounds.
**Icons**
A collection of cohesive, small-scale illustrations or symbols designed to represent concepts, actions, or objects in interfaces and applications. Maintains consistent visual style across the set.
**Defined Character**
A specific character that maintains consistent identity and unique traits while being reproduced in different poses, situations, and actions.
**Character Variants**
Multiple characters sharing the same fundamental structure, style, and color palette, allowing creation of new characters that fit within the established design system.
**Stylized Scene**
Complete environments or scenes created with a consistent visual style, look, and feel.
operationId: createProject
parameters:
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
project_name:
type: string
description: Name of the project (required)
project_description:
type: string
description: Description of the project (optional)
ip_name:
type: string
description: Required only for defined_character IP type. The name of the character (1-3 words, e.g., "Lora", "Captain Smith"). This name will be incorporated into the automatically created caption prefix and generation prefix, used consistently during training and generation.
ip_description:
type: string
description: Required only for defined_character and object_variants IP types. A short phrase (up to 6 words) describing only the most crucial distinguishing features of your character (e.g., "a female character with purple hair"). Keep it brief as the model will learn additional details from the training images. This description will be incorporated into the automatically created caption prefix and generation prefix, used during training and generation.
ip_medium:
type: string
enum:
- photography
- illustration
description: |
Medium of the IP (required)
* photography (Beta)
* illustration
ip_type:
type: string
enum:
- multi_object_set
- object_variants
- icons
- defined_character
- character_variants
- stylized_scene
- other
description: |
Type of the IP (required):
* multi_object_set: Multiple distinct objects that share a mutual style, design language, or color scheme. These objects are often isolated on a solid background. This is currently valid only when ip_medium = illustration.
* object_variants: Variations of the same object type, designed with consistent style, structure, and coloring, showcasing different interpretations. These objects are often isolated on a solid background. This is currently valid only when ip_medium = illustration.
* icons: A collection of small, visually distinct illustrations, such as symbols or graphical elements, designed with a cohesive style and used to represent concepts, actions, or objects in interfaces, applications, or visual communication materials. This is valid only when ip_medium = illustration.
* defined_character: A specific predefined character or person that can be reproduced consistently in different situations, poses, or actions, preserving their identity and unique traits.
* character_variants: Multiple characters sharing the same structure, style, and color palette, with the ability to create new characters that adhere to these shared characteristics while introducing unique elements. This is currently valid only when ip_medium = illustration.
* stylized_scene: A complete scene or environment, such as a gaming background or a series of photos with a shared color palette, created with a cohesive style, look, and feel.
* other: For IP types that don't fit into the above categories
example:
project_name: "Branded Character"
ip_name: "Adventure Series Characters"
ip_description: "A set of adventure game characters with unique personalities"
ip_medium: "illustration"
ip_type: "defined_character"
responses:
'201':
description: Project successfully created
content:
application/json:
schema:
type: object
properties:
id:
type: integer
description: Unique identifier for the project
project_name:
type: string
description: Name of the project
project_description:
type: string
description: Description of the project
ip_name:
type: string
description: Name of the IP
ip_description:
type: string
description: Description of the IP
ip_medium:
type: string
description: Medium of the IP
ip_type:
type: string
description: Type of the IP
status:
type: string
enum: [active]
description: Status of the project
created_at:
type: string
format: date-time
description: Timestamp when the project was created
example:
id: 123
project_name: "Branded Character"
project_description: ""
ip_name: "Lora"
ip_description: "A female character with purple hair"
ip_medium: "illustration"
ip_type: "defined_character"
status: "active"
created_at: "2024-05-26T12:00:00Z"
'400':
description: Bad request - validation error
'401':
description: Unauthorized
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
get:
tags:
- Tailored Generation
summary: Get Projects
description: Retrieve all projects within the organization. If there are no projects, returns an empty array.
operationId: getProjects
parameters:
- in: header
name: api_token
schema:
type: string
required: true
responses:
'200':
description: Successfully retrieved projects
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: integer
description: Unique identifier for the project
project_name:
type: string
description: Name of the project
project_description:
type: string
description: Description of the project
ip_name:
type: string
description: Name of the IP
ip_description:
type: string
description: Description of the IP
ip_medium:
type: string
description: Medium of the IP
enum:
- photography
- illustration
ip_type:
type: string
description: Type of the IP
enum:
- multi_object_set
- object_variants
- defined_object
- icons
- defined_character
- character_variants
- stylized_scene
- other
status:
type: string
description: Status of the project
enum: [active]
created_at:
type: string
format: date-time
description: Timestamp when the project was created
updated_at:
type: string
format: date-time
description: Timestamp when the project was last updated
example:
- id: 123
project_name: "Branded Character"
project_description: ""
ip_name: "Lora"
ip_description: "A female character with purple hair"
ip_medium: "illustration"
ip_type: "defined_character"
status: "active"
created_at: "2024-05-26T12:00:00Z"
updated_at: "2024-05-26T14:30:00Z"
- id: 124
project_name: "Branded icons"
project_description: ""
ip_name: ""
ip_description: ""
ip_medium: "illustration"
ip_type: "icons"
status: "active"
created_at: "2024-05-27T09:00:00Z"
updated_at: "2024-05-27T10:15:00Z"
'401':
description: Unauthorized
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
/tailored-gen/projects/{project_id}:
get:
tags:
- Tailored Generation
summary: Get Project by ID
description: Retrieve full project information including project name and description, IP name and description, IP medium (photography/illustration), IP type, status, and timestamps.
operationId: getProjectById
parameters:
- in: path
name: project_id
schema:
type: string
required: true
description: Project ID
- in: header
name: api_token
schema:
type: string
required: true
responses:
'200':
description: Successfully retrieved project
content:
application/json:
schema:
type: object
properties:
id:
type: integer
description: Unique identifier for the project
project_name:
type: string
description: Name of the project
project_description:
type: string
description: Description of the project
ip_name:
type: string
description: Name of the IP
ip_description:
type: string
description: Description of the IP
ip_medium:
type: string
description: Medium of the IP
enum:
- photography
- illustration
ip_type:
type: string
description: Type of the IP
enum:
- multi_object_set
- object_variants
- defined_object
- icons
- defined_character
- character_variants
- stylized_scene
- other
status:
type: string
description: Status of the project
enum: [active]
created_at:
type: string
format: date-time
description: Timestamp when the project was created
example:
id: 123
project_name: "Branded Character"
project_description: ""
ip_name: "Lora"
ip_description: "A female character with purple hair"
ip_medium: "illustration"
ip_type: "defined_character"
status: "active"
created_at: "2024-05-26T12:00:00Z"
'401':
description: Unauthorized
'404':
description: Project not found
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
put:
tags:
- Tailored Generation
summary: Update Project
description: Update a specific project
operationId: updateProject
parameters:
- in: path
name: project_id
schema:
type: string
required: true
description: Project ID
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
project_name:
type: string
description: New project name (optional)
project_description:
type: string
description: New project description (optional)
ip_name:
type: string
description: New IP name (optional)
ip_description:
type: string
description: New IP description (optional)
example:
ip_description: "A girl with purple hair"
responses:
'200':
description: Project successfully updated
content:
application/json:
schema:
type: object
properties:
id:
type: integer
description: Unique identifier for the project
project_name:
type: string
description: Name of the project
project_description:
type: string
description: Description of the project
ip_name:
type: string
description: Name of the IP
ip_description:
type: string
description: Description of the IP
ip_medium:
type: string
description: Medium of the IP
enum:
- photography
- illustration
ip_type:
type: string
description: Type of the IP
enum:
- multi_object_set
- object_variants
- defined_object
- icons
- defined_character
- character_variants
- stylized_scene
- other
status:
type: string
description: Status of the project
enum: [active]
created_at:
type: string
format: date-time
description: Timestamp when the project was created
example:
id: 123
project_name: "Branded Character"
project_description: ""
ip_name: "Lora"
ip_description: "A girl with purple hair"
ip_medium: "illustration"
ip_type: "defined_character"
status: "active"
created_at: "2024-05-26T12:00:00Z"
'401':
description: Unauthorized
'404':
description: Project not found
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
delete:
tags:
- Tailored Generation
summary: Delete Project
description: Permanently delete a project and all its associated resources, including all datasets, images, and models. This action cannot be undone. Training models must be stopped before deletion.
operationId: deleteProject
parameters:
- in: path
name: project_id
schema:
type: string
required: true
description: Project ID
- in: header
name: api_token
schema:
type: string
required: true
responses:
'204':
description: Project successfully deleted
'401':
description: Unauthorized
'404':
description: Project not found
'409':
description: Cannot delete project while models are in training
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
/tailored-gen/datasets:
post:
tags:
- Tailored Generation
summary: Create Dataset
description: |
Create a new dataset.
Constraints:
* Dataset must have at least 1 image to be completed
* Maximum of 200 images per dataset
operationId: createDataset
parameters:
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
project_id:
type: integer
description: Associated project ID (required)
name:
type: string
description: Dataset name (required)
example:
project_id: 123
name: "dataset v1"
responses:
'201':
description: Dataset successfully created
content:
application/json:
schema:
type: object
properties:
id:
type: integer
description: Unique identifier for the dataset
project_id:
type: integer
description: Associated project ID
name:
type: string
description: Dataset name
caption_prefix:
type: string
description: Text automatically prepended to all image captions in the dataset. Each image caption should naturally continues this prefix. A default prefix is automatically created but can be modified, and this same prefix is later used as the default generation prefix during image generation.
status:
type: string
description: Status of the dataset
enum: [draft]
captions_update_status:
type: string
description: Status of captions update process
enum: [empty,in_progress, completed]
created_at:
type: string
format: date-time
description: Timestamp when the dataset was created
updated_at:
type: string
format: date-time
description: Timestamp when the dataset was last updated
example:
id: 456
project_id: 123
name: "dataset v1"
caption_prefix: "An illustration of a character named Lora, a female character with purple hair,"
status: "draft"
captions_update_status: "empty"
created_at: "2024-05-26T12:00:00Z"
updated_at: "2024-05-26T12:00:00Z"
'400':
description: Bad request - validation error
'401':
description: Unauthorized
'404':
description: Project not found
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
get:
tags:
- Tailored Generation
summary: Get Datasets
description: Retrieve a list of all datasets. If there are no datasets, returns an empty array.
operationId: getDatasets
parameters:
- in: header
name: api_token
schema:
type: string
required: true
responses:
'200':
description: Successfully retrieved datasets
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: integer
description: Unique identifier for the dataset
project_id:
type: integer
description: Associated project ID
name:
type: string
description: Dataset name
caption_prefix:
type: string
description: Text automatically prepended to all image captions in the dataset. Each image caption should naturally continues this prefix. A default prefix is automatically created but can be modified, and this same prefix is later used as the default generation prefix during image generation.
status:
type: string
description: Status of the dataset
enum: [draft, completed]
captions_update_status:
type: string
description: Status of captions update process
enum: [empty,in_progress, completed]
created_at:
type: string
format: date-time
description: Timestamp when the dataset was created
updated_at:
type: string
format: date-time
description: Timestamp when the dataset was last updated
example:
- id: 456
project_id: 123
name: "dataset v1"
caption_prefix: "An illustration of a character named Lora, a female character with purple hair,"
status: "completed"
captions_update_status: "empty"
created_at: "2024-05-26T12:00:00Z"
updated_at: "2024-05-26T14:30:00Z"
- id: 457
project_id: 124
name: "dataset v2"
caption_prefix: "An illustration of a character named Max, a male character with spiky black hair,"
status: "draft"
captions_update_status: "empty"
created_at: "2024-05-27T09:00:00Z"
updated_at: "2024-05-27T09:00:00Z"
'401':
description: Unauthorized
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
/tailored-gen/projects/{project_id}/datasets:
get:
tags:
- Tailored Generation
summary: Get Datasets by Project
description: Retrieve all datasets for a specific project
operationId: getDatasetsByProject
parameters:
- in: path
name: project_id
schema:
type: string
required: true
description: Project ID
- in: header
name: api_token
schema:
type: string
required: true
- in: query
name: include_models
required: false
schema:
type: boolean
default: false
description: If true, a list of model objects using the dataset should be included in the response under the parameter 'models'
- in: query
name: include_models_ids
required: false
schema:
type: boolean
default: false
description: If true, a list of model ids using the dataset should be included in the response under the parameter 'model_ids'
responses:
'200':
description: Successfully retrieved datasets
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: integer
description: Unique identifier for the dataset
project_id:
type: integer
description: Associated project ID
name:
type: string
description: Dataset name
caption_prefix:
type: string
description: Text automatically prepended to all image captions in the dataset. Each image caption should naturally continues this prefix. A default prefix is automatically created but can be modified, and this same prefix is later used as the default generation prefix during image generation.
images_count:
type: integer
description: Number of images in the dataset
status:
type: string
description: Status of the dataset
enum: [draft, completed]
captions_update_status:
type: string
description: Status of captions update process
enum: [empty,in_progress, completed]
models:
type: array
description: List of model objects using this dataset. Only included when include_models=true
items:
type: object
model_ids:
type: array
description: List of model IDs using this dataset. Only included when include_models_ids=true
items:
type: string
created_at:
type: string
format: date-time
description: Timestamp when the dataset was created
updated_at:
type: string
format: date-time
description: Timestamp when the dataset was last updated
example:
- id: 456
project_id: 123
name: "dataset v1"
caption_prefix: "An illustration of a character named Lora, a female character with purple hair,"
images_count: 15
status: "completed"
captions_update_status: "empty"
created_at: "2024-05-26T12:00:00Z"
updated_at: "2024-05-26T14:30:00Z"
- id: 457
project_id: 123
name: "dataset v2"
caption_prefix: "An illustration of a character named Max, a male character with spiky black hair,"
images_count: 8
status: "draft"
captions_update_status: "empty"
created_at: "2024-05-27T09:00:00Z"
updated_at: "2024-05-27T09:00:00Z"
'401':
description: Unauthorized
'404':
description: Project not found
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
/tailored-gen/datasets/{dataset_id}:
get:
tags:
- Tailored Generation
summary: Get Dataset by ID
description: Retrieve a specific dataset
operationId: getDatasetById
parameters:
- in: path
name: dataset_id
schema:
type: string
required: true
description: Dataset ID
- in: header
name: api_token
schema:
type: string
required: true
responses:
'200':
description: Successfully retrieved dataset
content:
application/json:
schema:
type: object
properties:
id:
type: integer
description: Unique identifier for the dataset
project_id:
type: integer
description: Associated project ID
name:
type: string
description: Dataset name
caption_prefix:
type: string
description: Text automatically prepended to all image captions in the dataset. Each image caption should naturally continues this prefix. A default prefix is automatically created but can be modified, and this same prefix is later used as the default generation prefix during image generation.
status:
type: string
description: Status of the dataset
enum: [draft, completed]
captions_update_status:
type: string
description: Status of captions update process
enum: [empty,in_progress, completed]
images_count:
type: integer
description: Number of images in the dataset
images:
type: array
description: Array of images in the dataset
items:
type: object
properties:
id:
type: integer
description: Unique identifier for the image
dataset_id:
type: integer
description: ID of the dataset this image belongs to
caption:
type: string
description: Once an image is uploaded, a caption is generated automatically. The caption is a natural continuation of the caption_prefix.
caption_source:
type: string
description: Source of the caption
enum: [automatic, manual]
image_name:
type: string
description: Name of the image
image_url:
type: string
description: URL of the original image file
thumbnail_url:
type: string
description: URL of the image thumbnail
created_at:
type: string
format: date-time
description: Timestamp when the image was created
updated_at:
type: string
format: date-time
description: Timestamp when the image was last updated
created_at:
type: string
format: date-time
description: Timestamp when the dataset was created
updated_at:
type: string
format: date-time
description: Timestamp when the dataset was last updated
example:
id: 456
project_id: 123
name: "dataset v1"
caption_prefix: "An illustration of a character named Lora, a female character with purple hair,"
status: "completed"
captions_update_status: "empty"
images_count: 2
images:
- id: 789
dataset_id: 456
caption: "standing in a confident pose wearing a blue dress"
caption_source: "automatic"
image_name: "lora_standing.png"
image_url: "https://api.example.com/files/lora_standing.png"
thumbnail_url: "https://api.example.com/files/lora_standing_thumb.png"
created_at: "2024-05-26T12:30:00Z"
updated_at: "2024-05-26T12:30:00Z"
- id: 790
dataset_id: 456
caption: "sitting on a chair with a gentle smile"
caption_source: "automatic"
image_name: "lora_sitting.png"
image_url: "https://api.example.com/files/lora_sitting.png"
thumbnail_url: "https://api.example.com/files/lora_sitting_thumb.png"
created_at: "2024-05-26T12:45:00Z"
updated_at: "2024-05-26T12:45:00Z"
created_at: "2024-05-26T12:00:00Z"
updated_at: "2024-05-26T14:30:00Z"
'401':
description: Unauthorized
'404':
description: Dataset not found
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
put:
tags:
- Tailored Generation
summary: Update Dataset
description: |
Update a dataset.
In order to use a dataset in a model training, its status must be set to completed.
Once a dataset status is changed to completed:
* Images cannot be added or removed
* Image captions cannot be edited
* Caption prefix cannot be modified
It is recommended to use the route Clone Dataset As Draft in order to create a new version of a dataset.
Constraints:
* Cannot update caption_prefix if dataset status is completed
* Dataset must have at least 1 image to be marked as completed
operationId: updateDataset
parameters:
- in: path
name: dataset_id
schema:
type: string
required: true
description: Dataset ID
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
description: New dataset name (optional)
caption_prefix:
type: string
description: New caption prefix (optional). Cannot be updated if dataset status is completed. If the user has updated the caption prefix, it is crucial to Regenerate All Captions using the endpoint PUT /datasets/{dataset_id}/images/
status:
type: string
description: Dataset status (optional). Can be set to completed to enable usage in model training
enum: [draft, completed]
example:
status: "completed"
responses:
'200':
description: Dataset successfully updated
content:
application/json:
schema:
type: object
properties:
id:
type: integer
description: Unique identifier for the dataset
project_id:
type: integer
description: Associated project ID
name:
type: string
description: Dataset name
caption_prefix:
type: string
description: Text automatically prepended to all image captions in the dataset. Each image caption should naturally continues this prefix. A default prefix is automatically created but can be modified, and this same prefix is later used as the default generation prefix during image generation.
status:
type: string
description: Status of the dataset
enum: [draft, completed]
captions_update_status:
type: string
description: Status of captions update process
enum: [empty,in_progress, completed]
created_at:
type: string
format: date-time
description: Timestamp when the dataset was created
updated_at:
type: string
format: date-time
description: Timestamp when the dataset was last updated
example:
id: 456
project_id: 123
name: "dataset v1"
caption_prefix: "An illustration of a character named Lora, a female character with purple hair,"
status: "completed"
captions_update_status: "empty"
created_at: "2024-05-26T12:00:00Z"
updated_at: "2024-05-26T15:30:00Z"
'400':
description: Bad request - validation error
'401':
description: Unauthorized
'404':
description: Dataset not found
'409':
description: Conflict error
content:
application/json:
schema:
type: object
properties:
message:
type: string
description: Error message explaining the conflict
examples:
caption_prefix_error:
value:
message: "Cannot update caption prefix for a completed dataset"
completion_error:
value:
message: "Cannot mark dataset as completed. Dataset must have at least 1 image"
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
delete:
tags:
- Tailored Generation
summary: Delete Dataset
description: Delete a specific dataset. Deletes all associated images.
operationId: deleteDataset
parameters:
- in: path
name: dataset_id
schema:
type: string
required: true
description: Dataset ID
- in: header
name: api_token
schema:
type: string
required: true
responses:
'204':
description: Dataset successfully deleted
'401':
description: Unauthorized
'404':
description: Dataset not found
'409':
description: Cannot delete a dataset that is used by a model that is in training
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
/tailored-gen/datasets/{dataset_id}/clone:
post:
tags:
- Tailored Generation
summary: Clone Dataset As Draft
description: Create a new draft dataset based on existing one. This is useful when you would like to use the same dataset again for another training, but with some modification (create a variation).
operationId: cloneDataset
parameters:
- in: path
name: dataset_id
schema:
type: string
required: true
description: Dataset ID
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
name:
type: string
description: New dataset name. Defaults to "Copy of [original name]"
description:
type: string
description: New dataset description. Defaults to original description
example:
name: "Copy of dataset v1 - modified version"
description: "Modified version with additional poses"
responses:
'201':
description: Dataset successfully cloned
content:
application/json:
schema:
type: object
properties:
id:
type: integer
description: Unique identifier for the dataset
project_id:
type: integer
description: Associated project ID
name:
type: string
description: Dataset name
caption_prefix:
type: string
description: Text automatically prepended to all image captions in the dataset. Each image caption should naturally continues this prefix. A default prefix is automatically created but can be modified, and this same prefix is later used as the default generation prefix during image generation.
status:
type: string
description: Status of the dataset
enum: [draft]
captions_update_status:
type: string
description: Status of captions update process
enum: [empty, in_progress, completed]
images_count:
type: integer
description: Number of images in the dataset
images:
type: array
description: Array of images in the dataset
items:
type: object
properties:
id:
type: integer
description: Unique identifier for the image
dataset_id:
type: integer
description: ID of the dataset this image belongs to
caption:
type: string
description: Once an image is uploaded, a caption is generated automatically. The caption is a natural continuation of the caption_prefix.
caption_source:
type: string
description: Source of the caption
enum: [automatic]
image_name:
type: string
description: Name of the image
image_url:
type: string
description: URL of the original image file
thumbnail_url:
type: string
description: URL of the image thumbnail
created_at:
type: string
format: date-time
description: Timestamp when the image was created
updated_at:
type: string
format: date-time
description: Timestamp when the image was last updated
created_at:
type: string
format: date-time
description: Timestamp when the dataset was created
updated_at:
type: string
format: date-time
description: Timestamp when the dataset was last updated
example:
id: 457
project_id: 123
name: "Copy of dataset v1 - modified version"
caption_prefix: "An illustration of a character named Lora, a female character with purple hair,"
status: "draft"
captions_update_status: "empty"
images_count: 2
images:
- id: 791
dataset_id: 457
caption: "standing in a confident pose wearing a blue dress"
caption_source: "automatic"
image_name: "lora_standing.png"
image_url: "https://api.example.com/files/lora_standing.png"
thumbnail_url: "https://api.example.com/files/lora_standing_thumb.png"
created_at: "2024-05-26T15:30:00Z"
updated_at: "2024-05-26T15:30:00Z"
- id: 792
dataset_id: 457
caption: "sitting on a chair with a gentle smile"
caption_source: "automatic"
image_name: "lora_sitting.png"
image_url: "https://api.example.com/files/lora_sitting.png"
thumbnail_url: "https://api.example.com/files/lora_sitting_thumb.png"
created_at: "2024-05-26T15:30:00Z"
updated_at: "2024-05-26T15:30:00Z"
created_at: "2024-05-26T15:30:00Z"
updated_at: "2024-05-26T15:30:00Z"
'401':
description: Unauthorized
'404':
description: Dataset not found
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
/tailored-gen/datasets/{dataset_id}/images:
post:
tags:
- Tailored Generation
summary: Upload Image
description: |
Upload new image to a dataset.
Image Requirements:
- Minimum resolution: 1024x1024 pixels
- Supported formats: jpg, jpeg, png, webp
- Preferably use original high-quality assets
- For best results, use 1:1 aspect ratio or ensure main content is centered
Dataset Guidelines:
- Recommended: 5-50 images for optimal results when using Max training version, 15-100 for optimal results when using Light training version
- Maximum supported: 200 images
- Ensure consistency in style, structure, and visual elements
- Balance diversity in content (poses, scenes, objects) while maintaining consistency in key elements (style, colors, theme)
- Note: Larger datasets may introduce more variety, which can reduce overall consistency
For optimal training (especially for characters/objects):
- Subject should occupy most of the image area
- Minimize unnecessary margins around the subject
- Transparent backgrounds will be converted to black
- For character datasets: include diverse poses, environments, attires, and interactions
Captions and Generation:
- Each image receives an automatic caption that continues from the dataset's caption prefix
- Default caption prefix is recommended for initial training
- Captions can be modified to include domain-specific terms
- Both captions and prefix influence training and future generations
- Focus on essential elements rather than extensive details
Constraints:
- Dataset must have at least 1 image
- Dataset cannot exceed 200 images
- Cannot upload to a completed dataset
operationId: uploadImage
parameters:
- in: path
name: dataset_id
schema:
type: string
required: true
description: Dataset ID
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
file:
type: string
format: binary
description: Image file to upload (required if image_url not provided)
image_url:
type: string
description: URL of image to upload (required if file not provided)
image_name:
type: string
description: Custom name for the image (optional)
example:
image_url: "https://example.com/images/character_pose.jpg"
image_name: "character_standing_pose.jpg"
responses:
'201':
description: Image successfully uploaded
content:
application/json:
schema:
type: object
properties:
id:
type: integer
description: Unique identifier for the image
dataset_id:
type: integer
description: ID of the dataset this image belongs to
caption:
type: string
description: Once an image is uploaded, a caption is generated automatically. The caption is a natural continuation of the caption_prefix.
caption_source:
type: string
description: Source of the caption
enum: [automatic, manual]
image_name:
type: string
description: Name of the image
file:
type: string
description: file of the original image file in base64 format. Either file or image_url should be provided, not both.
image_url:
type: string
description: URL of the original image file.
thumbnail_url:
type: string
description: URL of the image thumbnail
created_at:
type: string
format: date-time
description: Timestamp when the image was created
updated_at:
type: string
format: date-time
description: Timestamp when the image was last updated
example:
id: 789
dataset_id: 456
caption: "standing in a confident pose wearing a blue dress"
caption_source: "automatic"
image_name: "lora_standing.png"
image_url: "https://api.example.com/files/lora_standing.png"
thumbnail_url: "https://api.example.com/files/lora_standing_thumb.png"
created_at: "2024-05-26T12:30:00Z"
updated_at: "2024-05-26T12:30:00Z"
'400':
description: Bad request
'401':
description: Unauthorized
'404':
description: Dataset not found
'409':
description: Conflict error
content:
application/json:
schema:
type: object
properties:
message:
type: string
description: Error message explaining the conflict
examples:
completed_dataset:
value:
message: "Cannot upload an image to a completed dataset"
max_images:
value:
message: "Maximum number of images (200) reached"
'412':
description: Precondition Failed.
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: Error message.
example:
error: "The image height and width must be at least 1024x1024 pixels."
'415':
description: Unsupported Media Type.
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: Error message.
example:
error: "The image format must be one of the following: jpg, jpeg, png, webp."
'422':
description: Unprocessable Entity.
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: Error message.
example:
error: "The provided image_url does not lead to an accessible image."
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
get:
tags:
- Tailored Generation
summary: Get Images
description: Retrieve all images in a specific dataset. If there are no images, returns an empty array.
operationId: getImages
parameters:
- in: path
name: dataset_id
schema:
type: string
required: true
description: Dataset ID
- in: header
name: api_token
schema:
type: string
required: true
responses:
'200':
description: Successfully retrieved images
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: integer
description: Unique identifier for the image
dataset_id:
type: integer
description: ID of the dataset this image belongs to
caption:
type: string
description: Caption describing the image
caption_source:
type: string
description: Source of the caption. 'unknown' value only appears for images that were uploaded using an old version of Tailored Generation.
enum: [automatic, manual, unknown]
image_name:
type: string
description: Name of the image
image_url:
type: string
description: URL of the original image file
thumbnail_url:
type: string
description: URL of the image thumbnail
created_at:
type: string
format: date-time
description: Timestamp when the image was created
updated_at:
type: string
format: date-time
description: Timestamp when the image was last updated
example:
- id: 789
dataset_id: 456
caption: "standing in a confident pose wearing a blue dress"
caption_source: "automatic"
image_name: "lora_standing.png"
image_url: "https://api.example.com/files/lora_standing.png"
thumbnail_url: "https://api.example.com/files/lora_standing_thumb.png"
created_at: "2024-05-26T12:30:00Z"
updated_at: "2024-05-26T12:30:00Z"
- id: 790
dataset_id: 456
caption: "sitting on a chair with a gentle smile"
caption_source: "manual"
image_name: "lora_sitting.png"
image_url: "https://api.example.com/files/lora_sitting.png"
thumbnail_url: "https://api.example.com/files/lora_sitting_thumb.png"
created_at: "2024-05-26T12:45:00Z"
updated_at: "2024-05-26T13:15:00Z"
'401':
description: Unauthorized
'404':
description: Dataset not found
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
put:
tags:
- Tailored Generation
summary: Regenerate All Captions
description: |
Regenerate captions for all images in dataset. This action is crucial after the user updates the caption_prefix, and then it's recommended to regenerate all the captions of all images, to have full compatibility with the new caption_prefix.
This is an asynchronous operation. Once this endpoint is called, Get Dataset by ID should be sampled until the captions_update_status changes to 'completed'.
operationId: regenerateAllCaptions
parameters:
- in: path
name: dataset_id
schema:
type: string
required: true
description: Dataset ID
- in: header
name: api_token
schema:
type: string
required: true
responses:
'202':
description: Caption regeneration process started
content:
application/json:
schema:
type: object
properties:
id:
type: integer
description: Unique identifier for the dataset
project_id:
type: integer
description: Associated project ID
name:
type: string
description: Dataset name
caption_prefix:
type: string
description: Text automatically prepended to all image captions in the dataset. Each image caption should naturally continues this prefix. A default prefix is automatically created but can be modified, and this same prefix is later used as the default generation prefix during image generation.
status:
type: string
description: Status of the dataset
enum: [draft, completed]
captions_update_status:
type: string
description: Status of captions update process
enum: [empty, in_progress, completed]
created_at:
type: string
format: date-time
description: Timestamp when the dataset was created
updated_at:
type: string
format: date-time
description: Timestamp when the dataset was last updated
example:
id: 456
project_id: 123
name: "dataset v1"
caption_prefix: "An illustration of a character named Lora, a female character with purple hair,"
status: "draft"
captions_update_status: "in_progress"
created_at: "2024-05-26T12:00:00Z"
updated_at: "2024-05-26T15:45:00Z"
'401':
description: Unauthorized
'404':
description: Dataset not found
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
/tailored-gen/datasets/{dataset_id}/images/{image_id}:
get:
tags:
- Tailored Generation
summary: Get Image by ID
description: Retrieve full image information including caption (which naturally continues the dataset's caption_prefix), caption source (automatic/manual/unknown), image name, URL and thumbnail URL, dataset ID, and timestamps.
operationId: getImage
parameters:
- in: path
name: dataset_id
schema:
type: string
required: true
description: Dataset ID
- in: path
name: image_id
required: true
schema:
type: integer
description: Image ID
- in: header
name: api_token
schema:
type: string
required: true
responses:
'200':
description: Successfully retrieved image
content:
application/json:
schema:
type: object
properties:
id:
type: integer
description: Unique identifier for the image
dataset_id:
type: integer
description: ID of the dataset this image belongs to
caption:
type: string
description: Caption describing the image
caption_source:
type: string
description: Source of the caption. 'unknown' value only appears for images that were uploaded using an old version of Tailored Generation.
enum: [automatic, manual, unknown]
image_name:
type: string
description: Name of the image
image_url:
type: string
description: URL of the original image file
thumbnail_url:
type: string
description: URL of the image thumbnail
created_at:
type: string
format: date-time
description: Timestamp when the image was created
updated_at:
type: string
format: date-time
description: Timestamp when the image was last updated
example:
id: 789
dataset_id: 456
caption: "standing in a confident pose wearing a blue dress"
caption_source: "automatic"
image_name: "lora_standing.png"
image_url: "https://api.example.com/files/lora_standing.png"
thumbnail_url: "https://api.example.com/files/lora_standing_thumb.png"
created_at: "2024-05-26T12:30:00Z"
updated_at: "2024-05-26T12:30:00Z"
'401':
description: Unauthorized
'404':
description: Image or dataset not found
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
put:
tags:
- Tailored Generation
summary: Update Image Caption
description: |
Update the caption of a specific image. There are two mutually exclusive ways to update a caption:
1. Provide a new caption text:
* Use the `caption` parameter
* This will set `caption_source` to "manual"
* Reflects a human-written caption
2. Request automatic caption regeneration:
* Set `regenerate_caption` to true
* This will set `caption_source` to "automatic"
* A new caption will be generated automatically based on the image and caption_prefix
* For the same caption_prefix, regenerate_caption will always return the same caption
* Useful for resetting captions or regenerating them after changing the caption_prefix
Note: You cannot provide both parameters simultaneously as they represent different update approaches.
Constraints:
* Cannot update captions in a completed dataset
* Cannot provide both caption and regenerate_caption in the same request
operationId: updateImageCaption
parameters:
- in: path
name: dataset_id
schema:
type: string
required: true
description: Dataset ID
- in: path
name: image_id
required: true
schema:
type: integer
description: Image ID
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
caption:
type: string
description: New caption text. When provided, sets caption_source to "manual"
regenerate_caption:
type: boolean
default: false
description: When true, generates new caption automatically and sets caption_source to "automatic"
examples:
manual_caption:
summary: Update with manual caption
value:
caption: "standing confidently in a defensive pose wearing armor"
regenerate_caption:
summary: Request automatic caption regeneration
value:
regenerate_caption: true
responses:
'200':
description: Caption successfully updated
content:
application/json:
schema:
type: object
properties:
id:
type: integer
description: Unique identifier for the image
dataset_id:
type: integer
description: ID of the dataset this image belongs to
caption:
type: string
description: Updated caption for the image
caption_source:
type: string
description: Source of the updated caption
enum: [automatic, manual]
image_name:
type: string
description: Name of the image
image_url:
type: string
description: URL of the original image file
thumbnail_url:
type: string
description: URL of the image thumbnail
created_at:
type: string
format: date-time
description: Timestamp when the image was created
updated_at:
type: string
format: date-time
description: Timestamp when the image was last updated
example:
id: 789
dataset_id: 456
caption: "standing confidently in a defensive pose wearing armor"
caption_source: "manual"
image_name: "lora_standing.png"
image_url: "https://api.example.com/files/lora_standing.png"
thumbnail_url: "https://api.example.com/files/lora_standing_thumb.png"
created_at: "2024-05-26T12:30:00Z"
updated_at: "2024-05-26T15:45:00Z"
'400':
description: Bad request - Both caption and regenerate_caption provided
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: Error message
example:
error: "Cannot provide both caption and regenerate_caption parameters"
'401':
description: Unauthorized
'404':
description: Image or dataset not found
'409':
description: Cannot update caption in a completed dataset
'410':
description: Dataset deleted
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
delete:
tags:
- Tailored Generation
summary: Delete Image
description: |
Permanently remove an image from a dataset. This will also delete the image files and associated thumbnails.
Constraints:
* Cannot delete images from completed datasets
operationId: deleteImage
parameters:
- in: path
name: dataset_id
schema:
type: string
required: true
description: Dataset ID
- in: path
name: image_id
required: true
schema:
type: integer
description: Image ID
- in: header
name: api_token
schema:
type: string
required: true
responses:
'204':
description: Image successfully deleted
'401':
description: Unauthorized
'404':
description: Image or dataset not found
'409':
description: Cannot delete an image from a completed dataset
content:
application/json:
schema:
type: object
properties:
message:
type: string
description: Error message explaining the conflict
example:
message: "Cannot delete an image from a completed dataset"
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
/tailored-gen/models:
post:
tags:
- Tailored Generation
summary: Create Model
description: Create new model. A dataset can be used to train multiple models with different training versions (e.g., one light and one max). The model will belong to the same project as its dataset.
operationId: createModel
parameters:
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
description: Name of the model (required)
dataset_id:
type: integer
description: ID of the dataset to use (required)
training_version:
type: string
enum: ["light", "max"]
description: |
Training version (required):
* Light: Choose this version when you need fast generation times and compatibility with our structure reference feature.
* Max: Best for complex IPs requiring high fidelity and precise prompt alignment. Choose this version when accurate replication of specific attributes is your top priority. This version is currently not available when ip_medium=photography.
description:
type: string
description: Description of the model (optional)
example:
name: "Lora Character Model"
dataset_id: 456
training_version: "max"
description: "A model trained on Lora character illustrations"
responses:
'201':
description: Model successfully created
content:
application/json:
schema:
type: object
properties:
id:
type: integer
description: Unique identifier for the model
name:
type: string
description: Name of the model
description:
type: string
description: Description of the model
status:
type: string
description: Status of the model
enum: [created]
training_version:
type: string
description: Training version
enum: ["light", "max"]
generation_prefix:
type: string
description: Text drawn from the dataset's caption_prefix that is automatically prepended to generation prompts to maintain consistency. It matches the dataset's caption_prefix. It can be bypassed during generation by setting include_generation_prefix=false. This field is empty upon model creation, and filled after the training starts.
project_id:
type: integer
description: ID of the project this model belongs to
dataset_id:
type: integer
description: ID of the dataset used for training
created_at:
type: string
format: date-time
description: Timestamp when the model was created
example:
id: 789
name: "Lora Character Model"
description: "A model trained on Lora character illustrations"
status: "created"
training_version: "max"
generation_prefix: "An illustration of a character named Lora, a female character with purple hair,"
project_id: 123
dataset_id: 456
created_at: "2024-05-26T12:00:00Z"
'400':
description: Bad request - validation error
'401':
description: Unauthorized
'404':
description: Dataset not found
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
get:
tags:
- Tailored Generation
summary: Get Models
description: Retrieve a list of models. If there are no models, an empty array is returned.
operationId: getModels
parameters:
- in: header
name: api_token
schema:
type: string
required: true
responses:
'200':
description: Successfully retrieved models
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: integer
description: Unique identifier for the model
name:
type: string
description: Name of the model
description:
type: string
description: Description of the model
status:
type: string
description: Status of the model
enum: [Created, InProgress, Completed, Failed, Stopping, Stopped]
training_version:
type: string
description: Training version
enum: ["light", "max"]
generation_prefix:
type: string
description: Text drawn from the dataset's caption_prefix that is automatically prepended to generation prompts to maintain consistency. It matches the dataset's caption_prefix. It can be bypassed during generation by setting include_generation_prefix=false.
project_id:
type: integer
description: ID of the project this model belongs to
dataset_id:
type: integer
description: ID of the dataset used for training
created_at:
type: string
format: date-time
description: Timestamp when the model was created
example:
- id: 789
name: "Lora Character Model"
description: "A model trained on Lora character illustrations"
status: "Completed"
training_version: "max"
generation_prefix: "An illustration of a character named Lora, a female character with purple hair,"
project_id: 123
dataset_id: 456
created_at: "2024-05-26T12:00:00Z"
- id: 790
name: "Max Character Model"
description: "A model trained for faster generation"
status: "InProgress"
training_version: "max"
generation_prefix: "An illustration of a character named Max, a male character with spiky black hair,"
project_id: 123
dataset_id: 457
created_at: "2024-05-27T09:00:00Z"
'401':
description: Unauthorized
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
/tailored-gen/projects/{project_id}/models:
get:
tags:
- Tailored Generation
summary: Get Models by Project
description: Retrieve all models for a project. If there are no models, an empty array is returned.
operationId: getModelsByProject
parameters:
- in: path
name: project_id
required: true
schema:
type: integer
description: Project ID
- in: header
name: api_token
schema:
type: string
required: true
responses:
'200':
description: Successfully retrieved models
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: integer
description: Unique identifier for the model
name:
type: string
description: Name of the model
description:
type: string
description: Description of the model
status:
type: string
description: Status of the model
enum: [Created, InProgress, Completed, Failed, Stopping, Stopped]
training_version:
type: string
description: Training version
enum: ["light", "max"]
generation_prefix:
type: string
description: Text drawn from the dataset's caption_prefix that is automatically prepended to generation prompts to maintain consistency. It matches the dataset's caption_prefix. It can be bypassed during generation by setting include_generation_prefix=false.
project_id:
type: integer
description: ID of the project this model belongs to
dataset_id:
type: integer
description: ID of the dataset used for training
created_at:
type: string
format: date-time
description: Timestamp when the model was created
updated_at:
type: string
format: date-time
description: Timestamp when the model was last updated
example:
- id: 789
name: "Lora Character Model"
description: "A model trained on Lora character illustrations"
status: "Completed"
training_version: "max"
generation_prefix: "An illustration of a character named Lora, a female character with purple hair,"
project_id: 123
dataset_id: 456
created_at: "2024-05-26T12:00:00Z"
updated_at: "2024-05-26T14:30:00Z"
- id: 790
name: "Max Character Model"
description: "A model trained for faster generation"
status: "InProgress"
training_version: "max"
generation_prefix: "An illustration of a character named Max, a male character with spiky black hair,"
project_id: 123
dataset_id: 457
created_at: "2024-05-27T09:00:00Z"
updated_at: "2024-05-27T09:00:00Z"
'401':
description: Unauthorized
'404':
description: Project not found
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
/tailored-gen/models/{model_id}:
get:
tags:
- Tailored Generation
summary: Get Model by ID
description: Retrieve full model information including name, description, status (Created/InProgress/Completed/Failed/Stopping/Stopped), training version (Light/Max), generation prefix, project ID, dataset ID, and timestamps.
operationId: getModel
parameters:
- in: path
name: model_id
required: true
schema:
type: integer
description: Model ID
- in: header
name: api_token
schema:
type: string
required: true
responses:
'200':
description: Successfully retrieved model
content:
application/json:
schema:
type: object
properties:
id:
type: integer
description: Unique identifier for the model
name:
type: string
description: Name of the model
description:
type: string
description: Description of the model
status:
type: string
description: Status of the model
enum: [Created, InProgress, Completed, Failed, Stopping, Stopped]
training_version:
type: string
description: Training version
enum: ["light", "max"]
generation_prefix:
type: string
description: Text drawn from the dataset's caption_prefix that is automatically prepended to generation prompts to maintain consistency. It matches the dataset's caption_prefix. It can be bypassed during generation by setting include_generation_prefix=false.
project_id:
type: integer
description: ID of the project this model belongs to
dataset_id:
type: integer
description: ID of the dataset used for training
created_at:
type: string
format: date-time
description: Timestamp when the model was created
example:
id: 789
name: "Lora Character Model"
description: "A model trained on Lora character illustrations"
status: "Completed"
training_version: "max"
generation_prefix: "An illustration of a character named Lora, a female character with purple hair,"
project_id: 123
dataset_id: 456
created_at: "2024-05-26T12:00:00Z"
'401':
description: Unauthorized
'404':
description: Model not found
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
put:
tags:
- Tailored Generation
summary: Update Model
description: Update a model's name and description. Other model attributes such as training version and dataset cannot be modified after creation.
operationId: updateModel
parameters:
- in: path
name: model_id
required: true
schema:
type: integer
description: Model ID
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
description: New model name (optional)
description:
type: string
description: New model description (optional)
example:
name: "Updated Lora Character Model"
description: "An updated model trained on Lora character illustrations"
responses:
'200':
description: Model successfully updated
content:
application/json:
schema:
type: object
properties:
id:
type: integer
description: Unique identifier for the model
name:
type: string
description: Name of the model
description:
type: string
description: Description of the model
status:
type: string
description: Status of the model
enum: [Created, InProgress, Completed, Failed, Stopping, Stopped]
training_version:
type: string
description: Training version
enum: ["light", "max"]
generation_prefix:
type: string
description: Text drawn from the dataset's caption_prefix that is automatically prepended to generation prompts to maintain consistency. It matches the dataset's caption_prefix. It can be bypassed during generation by setting include_generation_prefix=false.
project_id:
type: integer
description: ID of the project this model belongs to
dataset_id:
type: integer
description: ID of the dataset used for training
created_at:
type: string
format: date-time
description: Timestamp when the model was created
example:
id: 789
name: "Updated Lora Character Model"
description: "An updated model trained on Lora character illustrations"
status: "Completed"
training_version: "max"
generation_prefix: "An illustration of a character named Lora, a female character with purple hair,"
project_id: 123
dataset_id: 456
created_at: "2024-05-26T12:00:00Z"
'401':
description: Unauthorized
'404':
description: Model not found
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
delete:
tags:
- Tailored Generation
summary: Delete Model
description: Delete a specific model. Changes status to Deleted.
operationId: deleteModel
parameters:
- in: path
name: model_id
required: true
schema:
type: integer
description: Model ID
- in: header
name: api_token
schema:
type: string
required: true
responses:
'204':
description: Model successfully deleted
'401':
description: Unauthorized
'404':
description: Model not found
'409':
description: Cannot delete a model that is currently in training
content:
application/json:
schema:
type: object
properties:
message:
type: string
description: Error message explaining the conflict
example:
message: "Cannot delete model while it is in training"
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
/tailored-gen/models/{model_id}/start_training:
post:
tags:
- Tailored Generation
summary: Start Training
description: |
Start model training (1-3 hours duration). The associated dataset must have status 'completed' before training can begin.
Constraints:
* Dataset must be in 'completed' status
operationId: startTraining
parameters:
- in: path
name: model_id
required: true
schema:
type: integer
description: Model ID
- in: header
name: api_token
schema:
type: string
required: true
responses:
'200':
description: Training successfully started
content:
application/json:
schema:
type: object
properties:
id:
type: integer
description: Unique identifier for the model
status:
type: string
description: Status of the model
enum: [InProgress]
example:
id: 789
status: "InProgress"
'401':
description: Unauthorized
'404':
description: Model not found
'409':
description: Training already started/cannot be resumed
'412':
description: Dataset status must be 'completed' to start training
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
/tailored-gen/models/{model_id}/stop_training:
post:
tags:
- Tailored Generation
summary: Stop Training
description: Stop an ongoing model training process. Once stopped, training cannot be resumed - a new model would need to be created and trained.
operationId: stopTraining
parameters:
- in: path
name: model_id
required: true
schema:
type: integer
description: Model ID
- in: header
name: api_token
schema:
type: string
required: true
responses:
'200':
description: Training job successfully stopped
'401':
description: Unauthorized
'404':
description: Model not found
'409':
description: Training already stopped/not in training
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error
# product-shot routes
/product/cutout:
post:
tags:
- Product Shots Generation
summary: Product Cutout
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/product-cutout"
description: >
This capability allows you to create a precise cutout of a product from any given image. This feature is especially valuable for eCommerce platforms and applications, serving as a fundamental building block for crafting a user-friendly interface.
The following interactive Colab notebook demonstrates how to use this API effectively. Explore the example code and try it out for yourself to fully appreciate the potential of this suite.
operationId: productCutout
parameters:
- in: header
name: api_token
schema:
type: string
required: true
description: API token associated with the organization
requestBody:
content:
application/json:
schema:
type: object
properties:
sku:
type: string
description: The Stock Keeping Unit identifier for the product. This parameter is optional.
image_url:
type: string
description: The URL of the image containing the product to be cut out. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
file:
type: string
description: The image file containing the product to be cut out, in base64 format. Used if image_url is not provided. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
force_rmbg:
type: boolean
default: false
description:
Forces background removal, even if the original image already contains an alpha channel.
Useful for refining existing foreground/background separation or ignoring unnecessary alpha channels.
example:
sku: "12345"
image_url: "URL"
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
result_url:
type: string
description: The URL of the processed product cutout image. This is a temporary URL that expires after 1 hour.
example:
result_url: "URL"
'400':
description: Bad request.
'401':
description: Unauthorized. Invalid API key or authentication token.
'404':
description: Not found. Image could not be found at the provided URL.
'415':
description: Unsupported media type. Invalid file type. Supported file types are jpeg, jpg, png, webp.
'413':
description: Payload too large. Image file size exceeds the 12MB limit.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'460':
description: Failed to download image.
'451':
description: Unavailable for legal reasons.
'500':
description: Internal server error. An error occurred on the server.
/product/packshot:
post:
tags:
- Product Shots Generation
summary: Product Packshot
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/product-packshot"
description: >-
The Product Pack Shot feature is designed to create professional standard pack shots. The output is a 2000x2000 px image, with the product size and location according to best practices. This feature can allow users to take any photo of a product and transform it into a professional pack shot, placing the product on a clean, seamless background, typically white but customizable to any color.
The following interactive Colab notebook demonstrates how to use this API effectively. Explore the example code and try it out for yourself to fully appreciate the potential of this suite.
operationId: productPackshot
parameters:
- in: header
name: api_token
schema:
type: string
required: true
description: API token associated with the organization.
requestBody:
content:
application/json:
schema:
type: object
properties:
sku:
type: string
description: The Stock Keeping Unit identifier for the product. This parameter is optional.
image_url:
type: string
description: The URL of the product image or product cutout. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
file:
type: string
description: The product image or product cutout file, in base64 format. Used if image_url is not provided. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
background_color:
type: string
description: The background hex color code for the pack shot. Optionally, use 'transparent' for a transparent background. This parameter is optional.
default: "#FFFFFF"
force_rmbg:
type: boolean
default: false
description:
Forces background removal, even if the original image already contains an alpha channel.
Useful for refining existing foreground/background separation or ignoring unnecessary alpha channels.
example:
sku: "12345"
image_url: "URL"
background_color: "#FFFFFF"
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
result_url:
type: string
description: The URL of the processed product pack shot image. This is a temporary URL that expires after 1 hour.
example:
result_url: "URL"
'400':
description: Bad request.
'401':
description: Unauthorized. Invalid API key or authentication token.
'404':
description: Not found. Image could not be found at the provided URL.
'415':
description: Unsupported media type. Invalid file type. Supported file types are jpeg, jpg, png, webp.
'413':
description: Payload too large. Image file size exceeds the 12MB limit.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'460':
description: Failed to download image.
'451':
description: Unavailable for legal reasons.
'500':
description: Internal server error. An error occurred on the server.
/product/shadow:
post:
tags:
- Product Shots Generation
summary: Product Shadow
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/product-shadow"
description: >-
The Product Shadow API allows you to add consistent and customizable shadow to a product cutout. This feature is designed to work in combination with other capabilities like product cutout, product packshot and product lifestyle shots, enhancing the visual appeal of e-commerce and product imagery.
If the product image isn't a product cutout, you should use the product cutout API first. The product shadow API accepts a product cutout as input. Once you have a product cutout with a shadow, you can use it in product packshot or product lifestyle shot APIs, where needed.
The following interactive Colab notebook demonstrates how to use this API effectively. Explore the example code and try it out for yourself to fully appreciate the potential of this suite.
operationId: productShadow
parameters:
- in: header
name: api_token
schema:
type: string
required: true
description: API token associated with the organization.
requestBody:
content:
application/json:
schema:
type: object
properties:
sku:
type: string
description: The Stock Keeping Unit identifier for the product. This parameter is optional.
image_url:
type: string
description: The URL of the product image or product cutout. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. The input image must have a transparent background, could be obtained by using our background removal or cutout features.
file:
type: string
description: The product image or product cutout file, in base64 format. Used if image_url is not provided. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB. The input image must have a transparent background, could be obtained by using our background removal or cutout features.
type:
type: string
description: Specifies the type of shadow. It can be 'regular' or 'float'. This parameter is optional.
default: "regular"
background_color:
type: string
description: The background hex color code for the resulting image. If you would like to get a transparent background, don't include this parameter in the request. This parameter is optional.
shadow_color:
type: string
description: The shadow color hex code. This parameter is optional.
default: "#000000"
shadow_offset:
type: array
description: Controls the position of the shadow relative to the object, in pixels. Accepts a tuple-like list `[x, y]` where x and y can be positive or negative values. This parameter is optional.
items:
type: integer
default: [0, 15]
shadow_intensity:
type: integer
description: Adjusts the intensity of the shadow. This parameter is optional.
minimum: 0
maximum: 100
default: 60
shadow_blur:
type: integer
description: Controls the blur level of the shadow's edges. This parameter is optional. Default for 'shadow_type'=regular is 15, while for 'shadow_type'=float is 20.
shadow_width:
type: integer
description: (For floating shadows) Controls the width of the elliptical shadow, in pixels that could be positive and negative. As default the value is according to the width of the product. This parameter is optional.
shadow_height:
type: integer
description: (For floating shadows) Controls the height of the elliptical shadow, in pixels that could be positive and negative. This parameter is optional.
default: 70
force_rmbg:
type: boolean
default: false
description:
Forces background removal, even if the original image already contains an alpha channel.
Useful for refining existing foreground/background separation or ignoring unnecessary alpha channels.
example:
sku: "12345"
image_url: "URL"
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
result_url:
type: string
description: The URL of the processed product pack shot image. This is a temporary URL that expires after 1 hour.
example:
result_url: "URL"
'400':
description: Bad request.
'401':
description: Unauthorized. Invalid API key or authentication token.
'404':
description: Not found. Image could not be found at the provided URL.
'415':
description: Unsupported media type. Invalid file type. Supported file types are jpeg, jpg, png, webp.
'413':
description: Payload too large. Image file size exceeds the 12MB limit.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'460':
description: Failed to download image.
'451':
description: Unavailable for legal reasons.
'500':
description: Internal server error. An error occurred on the server.
/product/lifestyle_shot_by_text:
post:
tags:
- Product Shots Generation
summary: Lifestyle Product Shot by Text
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/lifestyle-product-shot-by-text"
description: >-
Creates enriched product shots by placing them in various environments using textual descriptions.
Additionally, you can change the image size of the final result as well as the positioning of the product in the image. This will enable you to create new and unique variations of your original image.
This capability is based on our BRIA 2.3 ControlNet BG-Gen. HF model card is available here. HF demo space of this pipeline can be found here.
operationId: productLifestyleShotByText
parameters:
- in: header
name: api_token
schema:
type: string
required: true
description: API token associated with the organization.
requestBody:
content:
application/json:
schema:
type: object
properties:
sku:
type: string
description: The Stock Keeping Unit identifier for the product. This parameter is optional.
sync:
type: boolean
default: false
description: Determines the response mode. When true, responses are synchronous. With false, responses are asynchronous, immediately providing URLs for images that are generated in the background. It is recommended to use sync=false for optimal performance. When generating more than 1 result, you should use the value false. When placement_type is automatic, sync has to be false.
fast:
type: boolean
default: true
description: Determines the generation mode. When true, the generation will utilize the fast mode which provides the best balance between speed and quality. The false, the regular mode will be utilized.
image_url:
type: string
description: The URL of the product shot to be placed in a lifestyle shot. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
file:
type: string
description: The product shot file to be placed in a lifestyle shot, in base64 format. Used if image_url is not provided. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
scene_description:
type: string
description: Text description of the new scene or background for the provided product shot. Bria currently supports prompts in English only, excluding special characters.
optimize_description:
type: boolean
default: true
description: When true, an additional logic takes the scene_description that was included and adjusts it to achieve optimal results. Built with Meta Llama 3.
num_results:
type: integer
default: 4
description: The number of lifestyle product shots you would like to generate. You will get num_results x 10 results when placement_type=automatic and according to the number of required placements x num_results if placement_type=manual_placement.
exclude_elements:
type: string
description: Elements or features that should be excluded from the generated scene. This parameter is optional and is available only when fast=false. Bria currently supports descriptions in English only, excluding special characters.
placement_type:
type: string
description:
This parameter allows you to control the positioning of the product in the image.
- **original** will preserve the original position of the product in the image.
- **automatic** will generate results with 7 of the recommended positions for the product (all except the upper ones).
- **manual_placement** will allow you to select predefined positions, using the parameter "manual_placement_selection".
- **custom_coordinates** Provides precise control over the size and position of the image using the parameters "foreground_image_size" and "foreground_image_location". This includes positions outside the canvas, which may result in cropping.
- **manual_padding** will allow you to control the position and size of the image by defining the desired padding in pixels around the product.
enum: ["original", "automatic", "manual_placement", "manual_padding", "custom_coordinates"]
original_quality:
type: boolean
default: false
description: This flag is only relevant when placement_type=original. If true, the output image retains the original input image's size; otherwise, the image is scaled to 1 megapixel (1MP) while preserving its aspect ratio.
shot_size:
type: array
items:
type: integer
default: [1000,1000]
description: The desired size of the final product shot. For optimal results, the total number of pixels should be around 1,000,000. This parameter is only relevant when placement_type is automatic,manual_placement or custom_coordinates.
foreground_image_size:
type: array
items:
type: integer
description:
Specifies the desired dimensions of the foreground image within the generated output.
The size is defined as an array of integers representing [width, height] in pixels.
foreground_image_location:
type: array
items:
type: integer
description:
Specifies the desired [x, y] coordinates for positioning the foreground image within the full shot.
The coordinates represent the upper-left corner of the foreground image.
Values can extend outside the shot, in which case the input image will be cropped accordingly.
manual_placement_selection:
type: array
items:
type: string
enum: ["upper_left", "upper_right", "bottom_left", "bottom_right", "right_center", "left_center", "upper_center", "bottom_center", "center_vertical", "center_horizontal"]
default: ["upper_left"]
description: If you've selected placement_type=manual_placement, you should use this parameter to specify which placements/positions you would like to use from the list. You can select more than one placement in one request.
padding_values:
type: array
items:
type: integer
default: [0,0,0,0]
description: The desired padding in pixels around the product, when using placement_type=manual_padding. The order of the values is [left, right, top, bottom]. For optimal results, the total number of pixels, including padding, should be around 1,000,000. It is recommended to first use the product cutout API, get the cutout and understand the size of the result, and then define the required padding and use the cutout as an input for this API.
force_rmbg:
type: boolean
default: false
description:
Forces background removal, even if the original image already contains an alpha channel.
Useful for refining existing foreground/background separation or ignoring unnecessary alpha channels.
examples:
Original placement:
value:
image_url: IMAGE_URL
scene_description: "In a living room interior, on a kitchen counter"
placement_type: "original"
num_results: 4
original_quality: true
optimize_description: true
Automatic placements:
value:
image_url: IMAGE_URL
scene_description: "in a living room interior, on a kitchen counter"
placement_type: "automatic"
shot_size: [900,550]
num_results: 1
optimize_description: true
Manual placement from a list:
value:
image_url: IMAGE_URL
scene_description: "in a living room interior, on a kitchen counter"
placement_type: "manual_placement"
shot_size: [900,550]
manual_placement_selection: ["upper_center","bottom_center"]
num_results: 1
optimize_description: true
Manual padding:
value:
image_url: IMAGE_URL
scene_description: "in a living room interior, on a kitchen counter"
placement_type: "manual_padding"
padding_values: [20,30,20,30]
num_results: 1
optimize_description: true
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
result:
type: array
items:
type: array
description: The array contains the results created in the request. In each result, the first value represents the URL of the result, the second value represents the seed, and the third value represents the session id of the result. Bria recognizes offensive and inappropriate images. The URL will lead to a 0-byte file if an image like that is generated. It will take a few seconds for the image to become available via the URL if sync=false. You can recreate the same result in the future by using the seed as part of the request. When placement_type=automatic, each set of 10 results will use the following predefined placements, according to this order upper_left, upper_right, bottom_left, bottom_right, right_center, left_center, upper_center, bottom_center, center_vertical, center_horizontal. This means that the first result URL will include a result using the placement upper_left and so on.
example:
result: [['result_url', 244184855]]
'400':
description: Bad request. Missing or invalid parameters.
'401':
description: Unauthorized. Invalid API key or authentication token.
'404':
description: Not found. Image could not be found at the provided URL.
'415':
description: Unsupported media type. Invalid file type. Supported file types are jpeg, jpg, png, webp.
'413':
description: Payload too large. Image file size exceeds the 12MB limit.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'460':
description: Failed to download image.
'451':
description: Unavailable for legal reasons.
'500':
description: Internal server error. An error occurred on the server.
/product/lifestyle_shot_by_image:
post:
tags:
- Product Shots Generation
summary: Lifestyle Product Shot by Image
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/lifestyle-product-shot-by-image"
description: >-
Generates enriched product shots by placing them in visually compelling environments, guided by a reference image.
Additionally, you can change the image size of the final result as well as the positioning of the product in the image. This will enable you to create new and unique variations of your original image.
This capability is powered by BRIA 2.3 ControlNet BG-Gen (HF model card) and BRIA 2.3 IP-Adapter (HF model card). You can explore the Hugging Face demo space for this pipeline here.
operationId: productLifestyleShotByImage
parameters:
- in: header
name: api_token
schema:
type: string
required: true
description: API token associated with the organization.
requestBody:
content:
application/json:
schema:
type: object
properties:
sku:
type: string
description: The Stock Keeping Unit identifier for the product. This parameter is optional.
sync:
type: boolean
default: false
description: Determines the response mode. When true, responses are synchronous. With false, responses are asynchronous, immediately providing URLs for images that are generated in the background. It is recommended to use sync=false for optimal performance. When generating more than 1 result, you should use the value false.
image_url:
type: string
description: The URL of the product shot to be placed in a lifestyle shot. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
file:
type: string
description: The product shot file to be placed in a lifestyle shot, in base64 format. Used if image_url is not provided. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
ref_image_url:
type: array
items:
type: string
description: The URL of the reference image to be used for generating the lifestyle shot. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
ref_image_file:
type: array
items:
type: string
description: The reference image file to be used for generating the lifestyle shot, in base64 format. Only a single refernce image is supported at the moment. Used if ref_image_url is not provided. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
enhance_ref_image:
type: boolean
default: true
description: When set to True, enhances the reference image by applying adjustments, such as lighting, shadows, and texture refinements, to produce more realistic and visually cohesive results. When enabled, this may also incorporate subtle elements from the reference image into the generated background for added authenticity.
ref_image_influence:
type: number
format: float
minimum: 0
maximum: 1
default: 1
description: Controls the degree of similarity between the generated background and the reference image, where 0.0 produces minimal resemblance and 1.0 creates a highly similar output.
num_results:
type: integer
default: 4
description: The number of lifestyle product shots you would like to generate.
placement_type:
type: string
description:
This parameter allows you to control the positioning of the product in the image.
- **original** will preserve the original position of the product in the image.
- **automatic** will generate results with 7 of the recommended positions for the product (all except the upper ones).
- **manual_placement** will allow you to select predefined positions, using the parameter "manual_placement_selection".
- **custom_coordinates** Provides precise control over the size and position of the image using the parameters "foreground_image_size" and "foreground_image_location". This includes positions outside the canvas, which may result in cropping.
- **manual_padding** will allow you to control the position and size of the image by defining the desired padding in pixels around the product.
enum: ["original", "automatic", "manual_placement", "manual_padding", "custom_coordinates"]
original_quality:
type: boolean
default: false
description: This flag is only relevant when placement_type=original. If true, the output image retains the original input image's size (and not the reference image size); otherwise, the image is scaled to 1 megapixel (1MP) while preserving its aspect ratio.
shot_size:
type: array
items:
type: integer
default: [1000,1000]
description: The desired size of the final product shot. For optimal results, the total number of pixels should be around 1,000,000. This parameter is only relevant when placement_type is automatic,manual_placement or custom_coordinates.
foreground_image_size:
type: array
items:
type: integer
description:
Specifies the desired dimensions of the foreground image within the generated output.
The size is defined as an array of integers representing [width, height] in pixels.
foreground_image_location:
type: array
items:
type: integer
description:
Specifies the desired [x, y] coordinates for positioning the foreground image within the full shot.
The coordinates represent the upper-left corner of the foreground image.
Values can extend outside the shot, in which case the input image will be cropped accordingly.
manual_placement_selection:
type: array
items:
type: string
enum: ["upper_left", "upper_right", "bottom_left", "bottom_right", "right_center", "left_center", "upper_center", "bottom_center", "center_vertical", "center_horizontal"]
default: ["upper_left"]
description: If you've selected placement_type=manual_placement, you should use this parameter to specify which placements/positions you would like to use from the list. You can select more than one placement in one request.
padding_values:
type: array
items:
type: integer
default: [0,0,0,0]
description: The desired padding in pixels around the product, when using placement_type=manual_padding. The order of the values is [left, right, top, bottom]. For optimal results, the total number of pixels, including padding, should be around 1,000,000. It is recommended to first use the product cutout API, get the cutout and understand the size of the result, and then define the required padding and use the cutout as an input for this API.
force_rmbg:
type: boolean
default: false
description:
Forces background removal, even if the original image already contains an alpha channel.
Useful for refining existing foreground/background separation or ignoring unnecessary alpha channels.
example:
image_url: "URL"
ref_image_urls: ["REFERENCE_URL"]
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
result:
type: array
items:
type: array
description: The array contains the results created in the request. In each result, the first value represents the URL of the result, the second value represents the seed, and the third value represents the session id of the result. Bria recognizes offensive and inappropriate images. The URL will lead to a 0-byte file if an image like that is generated. It will take a few seconds for the image to become available via the URL if sync=false. You can recreate the same result in the future by using the seed as part of the request.
example:
result: [['result_url', 244184855, 'ef3d9a20-4d5d-11ee-8741-8e22fc45bbfc.JPEG']]
'400':
description: Bad request. Missing or invalid parameters.
'401':
description: Unauthorized. Invalid API key or authentication token.
'404':
description: Not found. Image could not be found at the provided URL.
'415':
description: Unsupported media type. Invalid file type. Supported file types are jpeg, jpg, png, webp.
'413':
description: Payload too large. Image file size exceeds the 12MB limit.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'460':
description: Failed to download image.
'451':
description: Unavailable for legal reasons.
'500':
description: Internal server error. An error occurred on the server.
/products/consistent_shots:
post:
tags:
- Product Shots Generation
summary: Consistent Product Shots (Coming Soon)
description: >-
**Description**
This feature allows users to create consistent product shots by providing either a textual description of a scene or an image, along with a group of product images. The resulting consistent product shots are ideal for use on social media, eCommerce websites, product catalogs, and other marketing materials, ensuring a uniform and professional appearance across all platforms.
operationId: consistentProductShots
responses:
'200':
description: Successful operation.
/product/contextual_keyword_extraction:
post:
tags:
- Product Shots Generation
summary: Contextual Keyword Extraction (Coming Soon)
description: >-
**Description**
This feature allows users to extract relevant keywords from an image and its context, focusing on the primary product rather than secondary elements. This capability enhances search optimization in eCommerce by ensuring that the keywords accurately represent the product being sold. It can be particularly useful for improving product searchability on eCommerce websites, enhancing SEO for product listings, automating content management, and optimizing social media marketing efforts.
operationId: productContextualKeywordExtraction
responses:
'200':
description: Successful operation.
# campaign gen routes
/campaign_api/generate:
post:
tags:
- Campaign Generation (Coming soon)
summary: Generate a Campaign
description: >
The Campaign Generation API enables the creation of multiple ads (scenes) in various sizes and resolutions, all unified by the same branding, style, and messaging. This is essential for testing different ad variations, repurposing successful ad formats, and significantly reducing the manual effort required to create multiple ads.
BRIA's Campaign Generation API provides a unique and scalable solution for producing professional-grade ads while minimizing the need for time-consuming design work.
**Smart Image Feature**
A standout feature of BRIA's Campaign Generation API is its ability to seamlessly embed objects, products, and presenter images into another image (a "smart image"). This AI-powered capability allows for generating diverse backgrounds for the embedded image or extending the background to fit the ad's design perfectly.
**How It Works**
The Campaign Generation API works by sending a template ID along with inputs such as text, images, the main object with its background definition, and a brand ID (including logos, colors, and fonts). In response, the API generates a set of ad images.
Templates can be easily created using BRIA’s Campaign Editor application. Once a template is ready, it can be used to produce multiple ad versions with varying messaging, branding, and images.
operationId: generateCampaign
parameters:
- in: header
name: api_token
schema:
type: string
required: true
description: API token associated with the organization.
requestBody:
content:
application/json:
schema:
type: object
properties:
template_id:
type: string
description: The ID of the template to be used for generating the campaign scenes.
brand_id:
type: string
description: The ID of the brand.
canvas_color:
default: "#FFFFFF"
type: string
description: Canvas background color in hex format.
smart_image:
type: object
description: >
Smart image object for generating an image based on the embedded image, including the main object and its background definition (`expand` or `generate_by_text`).
properties:
main_object_url:
type: string
description: URL of the main image that will be embedded within the smart image.
background:
description: >
Background object to determine the operation type and its associated input.
type: object
properties:
operation:
type: string
description: >
Choose whether to expand the existing image background or replace it by generating a new one.
enum:
- expand
- generate_by_text
input:
type: string
description: Background prompt or hex color for the image’s background.
required:
- main_object_url
elements:
type: array
description: List of text/images objects
items:
type: object
properties:
layer_type:
type: string
description: The element type, either "text" or "image".
enum: [text, image]
content_type:
type: string
description: >
The heading level configuration for the text. This allows the same text to be inserted into multiple elements across scenes.
Value should be in the format - `Heading *`, `Body *`, `Image *` when * can be replaced with any number between 1-5.
content:
type: string
description: >
Content of the text or image, if `content_type` is set to `text` it should be a string, and if `content_type` is `image` it should be an image URL.
To ignore this element, set this parameter to an empty string.
id:
type: string
description: Unique identifier for the element.
text_configs:
type: object
description: >
Text configs object to set text configuration to be applied to the text element
properties:
highlight_color:
type: string
description: Color to highlight the text.
strikethrough:
type: boolean
description: Strike through the text.
shadow:
type: object
properties:
blur:
type: integer
description: Blur amount for the text shadow.
color:
type: string
description: Color of the text shadow.
offset:
type: object
properties:
x:
type: number
format: int
description: Shadow's x-axis offset.
y:
type: number
format: int
description: Shadow's y-axis offset.
fix_text_box:
type: object
description: >-
The “Fix text box” object allows you to specify the text box dimensions and the max font size and it will resize the content text within the text box.
properties:
width:
type: number
format: float
description: The width of the text box in pixels
height:
type: number
format: float
description: The height of the text box in pixels
max_font_size:
type: number
format: int
description: The maximum font size to ensure that, during rescaling, the font size does not exceed this value.
example:
template_id: "123"
smart_image:
main_object_url: "https://example.com/image.jpg"
background:
operation: "generate_by_text"
input: "A scenic background"
brand_id: "456"
background_color: "#FFFFFF"
elements:
- layer_type: "text"
content_type: "Heading 1"
content: "Sale Now!"
text_configs:
highlight_color: "#FF5733"
strikethrough: false
shadow:
blur: 10
color: "#000000"
offset:
x: 2
y: 2
responses:
'200':
description: Campaign generated successfully.
content:
application/json:
schema:
type: array
items:
type: string
description: URL of the generated campaign ad.
'400':
description: Bad request.
'401':
description: Unauthorized. Invalid API key or authentication token.
'422':
description: Value error in the request body.
'500':
description: Internal server error.
/campaign_api/brands:
get:
tags:
- Campaign Generation (Coming soon)
summary: Get Brands
description: >
Get a list of brands that can be used to customize your campaign with the brand's colors, fonts, and logos. Brands are created in BRIA’s Campaign Editor application by the organization's Admins.
operationId: getBrands
parameters:
- in: header
name: api_token
schema:
type: string
required: true
description: API token associated with the organization.
responses:
'200':
description: The list of brands, where each brand is an object containing the following properties - ID, name, description, and creation date.
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: integer
name:
type: string
description:
type: string
created_at:
type: string
'401':
description: Unauthorized. Invalid API key or authentication token.
/campaign_api/templates:
get:
tags:
- Campaign Generation (Coming soon)
summary: Get List of Templates
description: Retrieve a list of templates available for campaign generation.
operationId: getTemplates
parameters:
- in: header
name: api_token
schema:
type: string
required: true
description: API token associated with the organization.
responses:
'200':
description: The list of templates, where each template is an object containing the following properties - ID, name, description, creation date, number of scenes and a preview.
content:
application/json:
schema:
type: array
items:
type: object
properties:
id:
type: integer
name:
type: string
description:
type: string
created_at:
type: string
number_of_scenes:
type: integer
preview:
type: string
'401':
description: Unauthorized. Invalid API key or authentication token.
/campaign_api/templates/{template_id}:
get:
tags:
- Campaign Generation (Coming soon)
summary: Get Template Information
description: Retrieve details for a specific template by template ID.
operationId: getTemplateInfo
parameters:
- in: header
name: api_token
schema:
type: string
required: true
description: API token associated with the organization.
- in: path
name: template_id
schema:
type: string
required: true
description: The ID of the template.
responses:
'200':
description: The requested template ID object, containing its ID, scene number, and the elements object.
content:
application/json:
schema:
type: object
properties:
id:
type: string
scene_number:
type: integer
elements:
type: array
items:
type: object
properties:
layer_type:
type: string
content_type:
type: string
content:
type: string
'401':
description: Unauthorized. Invalid API key or authentication token.
'404':
description: Template not found for the provided template ID.
# video editing routes
/video/background/remove:
post:
tags:
- Video Editing
summary: Remove Background from Video
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/remove-video-background"
description: >
**Description**
This endpoint allows users to remove the background from videos. It supports various video file formats and retains the original video's framerate and resolution in the output.
**Supported Inputs**:
- File types: `mp4`, `avi`, `mov`, `gif`, `webm`
- Framerate: All framerates are supported; the original video's framerate is preserved in the output.
- Resolutions: No limit; the output resolution matches the input resolution.
**Output**:
- File type: `webm`
- Framerate: Matches the original video.
- Resolution: Matches the original video.
operationId: removeVideoBackground
parameters:
- in: header
name: api_token
schema:
type: string
required: true
description: API token associated with the organization.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
video_url:
type: string
description: A publicly accessible URL of the video to process. The input video time limit is up to 1 minute.
example:
video_url: "https://example.com/input_video.mp4"
responses:
'200':
description: Background successfully removed.
content:
application/json:
schema:
type: object
properties:
result_url:
type: string
description: URL of the video with the background removed.
example:
result_url: "https://example.com/processed_video.webm"
'400':
description: Bad request. Invalid input parameters.
'415':
description: Unsupported Media Type. Invalid file type. Supported file types are `mp4`, `avi`, `mov`, `gif`, `webm`.
'422':
description: Unprocessable Entity. The URL does not point to a valid video or is inaccessible.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error.
# image editing route
/eraser:
post:
tags:
- Image Editing
summary: Eraser
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/eraser"
description: >-
**Description**
The *Eraser Route* enables the removal of elements or specific areas from a given image.
You can define the area to be removed by providing a mask that outlines the region to be erased. There are two main ways recommended to generate these masks:
1. Masks can be created by allowing users to draw directly on the image with a brush, for example. To access the SDK that demonstrates how to implement a brush feature in your interface, please refer to the following link.
2. By using the `/objects/mask_generator` route, which will generate all the possible masks for an image.
This capability is powered by our fast ControlNet inpainting model. HF model card is available here, and the HF demo space can be found here
Additionally, ComfyUI nodes that enable running this API route can be found here
operationId: eraser
parameters:
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
content:
application/json:
schema:
type: object
properties:
image_url:
type: string
description:
The URL of the input image. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp.
file:
type: string
description:
The file of the input image, in base64 format. Used if image_url is not provided. Accepted formats are jpeg, jpg, png, webp.
mask_url:
type: string
description:
The URL of the binary mask image that represents the area that will be cleaned. If both mask_url and mask_file are provided, mask_url will be used.
Accepted formats - jpeg, jpg, png, webp. The area to be removed should have the value 255 (white), while the rest of the image should have the value 0 (black).
**Note:** The input image and mask must have the same aspect ratio.
mask_file:
type: string
description:
The file of the binary mask image that represents the area that will be cleaned, in base64 format. This parameter is used if mask_url is not provided.
Accepted formats - jpeg, jpg, png, webp. The area to be removed should have the value 255 (white), while the rest of the image should have the value 0 (black).
**Note:** The input image and mask must have the same aspect ratio.
mask_type:
type: string
default: 'manual'
description: You can use this parameter to specify the type of the input mask from the list. 'manual' opttion should be used in cases in which the mask had been generated by a user (e.g. with a brush tool), and 'automatic' mask type should be used when mask had been generated by an algorithm like 'SAM'.
enum: ['manual', 'automatic']
examples:
send using url:
value:
image_url: 'URL'
mask_url: 'URL'
send using base64 string:
value:
file: 'base64_encoded_string_for_image'
mask_file: 'base64_encoded_string_for_image'
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
result_url:
type: string
description: URL that represents the updated visual created in the request. It is a temporary URL that will expire
example: "URL"
'400':
description: Bad request. Missing or invalid parameters.
'401':
description: Unauthorized. Invalid API key or authentication token.
'404':
description: Not found. Image could not be found at the provided URL.
'415':
description: Unsupported media type. Invalid file type. Supported file types are jpeg, jpg, png, webp.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'460':
description: Failed to download image.
'500':
description: Internal server error. An error occurred on the server.
/gen_fill:
post:
tags:
- Image Editing
summary: Generative Fill
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/gen-fill"
description: >-
**Description**
The *GenFill Route* enables the generation of objects by prompt in a specific region of an image.
You can define the area for object generation by using a mask that outlines the region where the object will be created. Our model is optimized to work seamlessly with blob-shaped masks.
Masks can be created by allowing users to draw directly on the image with a brush, for example. To access the SDK that demonstrates how to implement a brush feature in your interface, please refer to the following link.
This capability is powered by our fast ControlNet inpainting model. HF model card is available here. And the HF demo space can be found here.
operationId: gen_fill
parameters:
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
content:
application/json:
schema:
type: object
properties:
image_url:
type: string
description:
The URL of the input image. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp.
file:
type: string
description: The file of the input image, in base64 format. Used if image_url is not provided. Accepted formats are jpeg, jpg, png, webp.
mask_url:
type: string
description:
The URL of the binary mask image that represents the area in which the object will be generated.
If both mask_url and mask_file are provided, mask_url will be used. Accepted formats are jpeg, jpg, png, webp.
The area in which the object will be generated should have the value 255 (white), while the rest of the image should have the value 0 (black).
**Note:** The input image and mask must have the same aspect ratio.
mask_file:
type: string
description:
The file of the binary mask image that represents the area in which the object will be generated, in base64 format.
This parameter is used if mask_url is not provided. Accepted formats are jpeg, jpg, png, webp.
The area in which the object will be generated should have the value 255 (white), while the rest of the image should have the value 0 (black).
**Note:** The input image and mask must have the same aspect ratio.
mask_type:
type: string
default: 'manual'
description: You can use this parameter to specify the type of the input mask from the list. 'manual' opttion should be used in cases in which the mask had been generated by a user (e.g. with a brush tool), and 'automatic' mask type should be used when mask had been generated by an algorithm like 'SAM'.
enum: ['manual', 'automatic']
prompt:
type: string
description: The prompt you would like to use to generate the object within the masked region.
negative_prompt:
type: string
description: The prompt you would like to use to specify details or attributes to avoid in the object generated within the masked region.
num_results:
type: integer
description: The number of images you would like to generate.
minimum: 1
default: 4
maximum: 4
sync:
type: boolean
default: false
description: Determines the response mode. When true, responses are synchronous. With false, responses are asynchronous, immediately providing URLs for images that are generated in the background. It is recommended to use sync=false for optimal performance. When generating more than 1 result, you should use the value false.
seed:
type: integer
description: You can choose whether you want your generated results to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.
examples:
send using url:
value:
image_url: 'URL'
mask_url: 'URL'
prompt: 'object description'
send using base64 string:
value:
file: 'base64_encoded_string_for_image'
mask_file: 'base64_encoded_string_for_image'
prompt: 'object description'
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
urls:
type: array
items:
type: string
description: |
An array of URLs representing the updated visuals generated by the request.
These URLs are temporary and will eventually expire.
example: ["RESULT_URL_1", "RESULT_URL_2"]
seed:
type: array
items:
type: integer
description: |
An array of integers representing the seeds used to generate each result.
These seeds ensure reproducibility and are compatible with the results URL structure.
example: [12345, 67890]
'400':
description: Bad request. Missing or invalid parameters.
'401':
description: Unauthorized. Invalid API key or authentication token.
'404':
description: Not found. Image could not be found at the provided URL.
'415':
description: Unsupported media type. Invalid file type. Supported file types are jpeg, jpg, png, webp.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'460':
description: Failed to download image.
'500':
description: Internal server error. An error occurred on the server.
/background/remove:
post:
tags:
- Image Editing
summary: Remove Background
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/remove-background"
description: >-
**Description**
The *Remove BG* Route can be used to remove the background of an image. This route leverages Bria's newest model, RMBG 2.0. For more details and to explore the model, check out the [Hugging Face demo](https://huggingface.co/spaces/briaai/BRIA-RMBG-2.0).
**The main difference between the regular and this isolated background removal endpoint is that you can use this endpoint without uploading or registering the image to Bria.**
**Constraints**
The Bria API currently supports only JPEG and PNG files in RGB, RGBA, or CMYK color modes. When the file is of a different type or color mode, the status code 415 will be returned.
**Remove the background from an image using the image file**
In our documentation request example, we demonstrate how to remove the background from an image using the image URL.
If you want to use an image from a file, follow the example below:
import requests
url = "https://engine.prod.bria-api.com/v1/background/remove"
payload = {}
files=[
('file',('image_name.jpeg',open('/path_to_local_file/image_name.jpeg','rb'),'image/jpeg'))
]
headers = {
'api_token': 'xxxx'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
operationId: background/remove
parameters:
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
file:
description: The image file you would like to remove the background from.
type: string
format: binary
image_url:
description: The URL of the image file you would like to remove the background from. The URL should lead to an image publicly available online. Either a file or an image_url should be provided. If both are provided, then the route will use image_url.
type: string
examples:
image url:
value:
image_url: "https://i.natgeofe.com/n/548467d8-c5f1-4551-9f58-6817a8d2c45e/NationalGeographic_2572187_square.jpg"
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
result_url:
type: string
description: URL that represents the updated visual created in the request. It is a temporary URL that will expire.
'206':
description: File value was not provided.
'400':
description: Request doesn't contain file part.
'405':
description: Method not allowed.
'415':
description: Unsupported media type.
'460':
description: Failed to download image.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error.
'506':
description: Insufficient data. The given input is not supported by the Bria API.
/background/replace:
post:
tags:
- Image Editing
summary: Generate Background
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/generate-background"
description: >-
**Description**
The *Replace BG Route* is used to replace the background of any image with a generated background using the state-of-the-art BRIA 2.3 ControlNet BG-Gen model (available on Hugging Face).
We offer a fast version of this feature, powered by Bria 2.3 Fast LoRA (model card on Hugging Face), which provides an optimal balance between speed and quality.
This endpoint also supports solid colors - you can take a color code and use it in the prompt.
Here are some examples:
**original image**:
**bg_prompt**: in a parking lot
**num_results**: 3
**results**:
operationId: background/replace
parameters:
- in: header
name: api_token
schema:
type: string
required: true
description: API token associated with the organization.
requestBody:
content:
application/json:
schema:
type: object
properties:
sync:
type: boolean
default: false
description: Determines the response mode. When true, responses are synchronous. With false, responses are asynchronous, immediately providing URLs for images that are generated in the background. It is recommended to use sync=false for optimal performance. When generating more than 1 result, you should use the value false.
fast:
type: boolean
default: true
description: Determines the generation mode. When true, the generation will utilize the fast mode which provides the best balance between speed and quality. When false, the regular mode will be utilized.
image_url:
type: string
description: The URL of the image to which a new background should be generated. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
file:
type: string
description: The product of the image to which a new background should be generated, in base64 format. Used if image_url is not provided. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
ref_image_url:
type: string
description: The URL of the reference image to be used for generating the new background. Either ref_image_url or bg_prompt has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
ref_image_file:
type: string
description: The reference image file to be used for generating the new background. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp.
bg_prompt:
type: string
description: Text description of the new scene or background for the provided image. Either ref_image_url or bg_prompt has to be provided but not both. Bria currently supports prompts in English only, excluding special characters.
refine_prompt:
type: boolean
default: true
description: When true, an additional logic takes the bg_prompt that was included and adjusts it to achieve optimal results. Built with Meta Llama 3.
enhance_ref_image:
type: boolean
default: true
description: When set to true, additional logic processes the included reference image to make adjustments for optimal results.
original_quality:
type: boolean
default: false
description: When true, the output image retains the original input image's size; otherwise, the image is scaled to 1 megapixel (1MP) while preserving its aspect ratio.
num_results:
type: integer
default: 4
description: The number of results you would like to generate.
force_rmbg:
type: boolean
default: false
description:
Forces background removal, even if the original image already contains an alpha channel.
Useful for refining existing foreground/background separation or ignoring unnecessary alpha channels.
negative_prompt:
type: string
description: Elements or features that should be excluded from the generated scene. This parameter is optional and is available only when fast=false. Bria currently supports descriptions in English only.
seed:
type: integer
description: You can choose whether you want your generated results to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.
example:
bg_prompt: "in a living room interior, on a kitchen counter"
num_results: 1
sync: false
image_url: "URL"
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
result:
type: array
items:
type: array
description: The array contains the results created in the request. In each result, the first value represents the URL of the result, the second value represents the seed, and the third value represents the sessions id of the result. Bria recognizes offensive and inappropriate images. The URL will lead to a 0-byte file if an image like that is generated. It will take a few seconds for the image to become available via the URL if sync=false. You can recreate the same result in the future by using the seed as part of the request. The sid (session id) represents the result of the current route request.
example:
result: [['result_url', 244184855, 'ef3d9a20-4d5d-11ee-8741-8e22fc45bbfc.JPEG']]
'400':
description: Bad request. Missing or invalid parameters.
'401':
description: Unauthorized. Invalid API key or authentication token.
'404':
description: Not found. Image could not be found at the provided URL.
'415':
description: Unsupported media type. Invalid file type. Supported file types are jpeg, jpg, png, webp.
'413':
description: Payload too large. Image file size exceeds the 12MB limit.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'460':
description: Failed to download image.
'451':
description: Unavailable for legal reasons.
'500':
description: Internal server error. An error occurred on the server.
/erase_foreground:
post:
tags:
- Image Editing
summary: Erase Foreground
description: >-
**Description**
This route is used to erase the foreground from a provided image, while generating the area behind it.
operationId: erase_foreground
parameters:
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
content:
application/json:
schema:
type: object
properties:
image_url:
type: string
description: The URL of the input image. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
file:
type: string
description: The file of the input image, in base64 format. Used if image_url is not provided. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
example:
image_url: 'URL'
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
result_url:
type: string
description: URL that represents the updated visual created in the request. It is a temporary URL that will expire
example: "URL"
'400':
description: Bad request. Missing or invalid parameters.
'401':
description: Unauthorized. Invalid API key or authentication token.
'404':
description: Not found. Image could not be found at the provided URL.
'415':
description: Unsupported media type. Invalid file type. Supported file types are jpeg, jpg, png, webp.
'413':
description: Payload too large. Image file size exceeds the 12MB limit.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'460':
description: Failed to download image.
'451':
description: Unavailable for legal reasons.
'500':
description: Internal server error. An error occurred on the server.
/background/blur:
post:
tags:
- Image Editing
summary: Blur Background
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/blur-background"
description: >-
**Description**
The *background/blur Route* is used to create a blur effect on the background of an image.
operationId: blur_bg
parameters:
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
content:
application/json:
schema:
type: object
properties:
image_url:
type: string
description: The URL of the input image. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
file:
type: string
description: The file of the input image, in base64 format. Used if image_url is not provided. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
scale:
type: integer
minimum: 1
maximum: 5
default: 5
description: A scale for determining how blurry the background of the image should be. The options are 1, 2, 3, 4, 5. This parameter is optional.
force_rmbg:
type: boolean
default: false
description:
Forces background removal, even if the original image already contains an alpha channel.
Useful for refining existing foreground/background separation or ignoring unnecessary alpha channels.
example:
image_url: 'URL'
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
result_url:
type: string
description: URL that represents the updated visual created in the request. It is a temporary URL that will expire
example: "URL"
'400':
description: Bad request. Missing or invalid parameters.
'401':
description: Unauthorized. Invalid API key or authentication token.
'404':
description: Not found. Image could not be found at the provided URL.
'415':
description: Unsupported media type. Invalid file type. Supported file types are jpeg, jpg, png, webp.
'413':
description: Payload too large. Image file size exceeds the 12MB limit.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'460':
description: Failed to download image.
'451':
description: Unavailable for legal reasons.
'500':
description: Internal server error. An error occurred on the server.
/image_expansion:
post:
tags:
- Image Editing
summary: Expand Image
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/expand-image"
description: >-
**Description**
The *Image Expension Route* can be used to expand an image, by utilizing generative AI.
You can decide on the image size of the final result as well as the position and size of the original image compared to the final result.
In this way, you can create unique variations of your original image instead of cropping it into different aspect ratios and losing important details.
**Optimal input range**
***Input Image Area:*** Ensure that the ratio of the input image foreground or main subject to the canvas area is greater than 15% to achieve optimal results.
***Canvas Size:*** The canvas size should be up to an area of 5000x5000 pixels.
Here are some examples:
**original image (Generated by Bria)**:
**results**:
**original image (Stock Image)**:
**results**:
operationId: image_expansion
parameters:
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
content:
application/json:
schema:
type: object
properties:
image_url:
type: string
description: The URL of the input image. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
file:
type: string
description: The file of the input image, in base64 format. Used if image_url is not provided. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
canvas_size:
type: array
items:
type: integer
default: [1000,1000]
description: The desired size of the final image, after the expansion. should have an area of less than 5000x5000 pixels.
original_image_size:
type: array
items:
type: integer
description: The desired size of the original image, inside the full canvas. Ensure that the ratio of input image foreground or main subject to the canvas area is greater than 15% to achieve optimal results.
original_image_location:
type: array
items:
type: integer
description: The desired location of the original image, inside the full canvas. Provide the location of the upper left corner of the original image. The location can also be outside the canvas (the original image will be cropped).
prompt:
type: string
description: Text on which you wish to base the image expansion. This parameter is optional. Bria currently supports prompts in English only, excluding special characters.
seed:
type: integer
description: You can choose whether you want your generated expension to be random or predictable. You can recreate the same result in the future by using the seed value of a result from the response. You can exclude this parameter if you are not interested in recreating your results. This parameter is optional.
negative_prompt:
type: string
description: This parameter is optional. Bria currently supports prompts in English only.
example:
image_url: "URL"
canvas_size: [1200,674]
original_image_size: [610,855]
original_image_location: [301,-66]
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
code:
type: integer
example: 200
description:
type: string
example: "SUCCESS"
message:
type: string
example: "Finished sucessfully"
description: A message that describes the request status. The options are Finished sucessfully, Content might not be safe for work.
prompt:
type: string
example: "a man in a shirt sitting down in front of a brick wall looking off to the side"
description: The prompt used to generate the expansion. If you want to recreate the result again, you should use in the request the prompt and the seed of the response.
result_url:
type: string
description: URL that represents the updated visual created in the request. It is a temporary URL that will expire
example: "URL"
seed:
type: integer
example: 1525972691
description: If you want to recreate the result again, you should use in the request the prompt and the seed of the response.
status:
type: string
example: "SUCCESS"
description: The request status. The options are SUCCESS, NSFW.
'400':
description: Bad request. Missing or invalid parameters.
'401':
description: Unauthorized. Invalid API key or authentication token.
'404':
description: Not found. Image could not be found at the provided URL.
'415':
description: Unsupported media type. Invalid file type. Supported file types are jpeg, jpg, png, webp.
'413':
description: Payload too large. Image file size exceeds the 12MB limit.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'460':
description: Failed to download image.
'451':
description: Unavailable for legal reasons.
'500':
description: Internal server error. An error occurred on the server.
/image/increase_resolution:
post:
tags:
- Image Editing
summary: Increase Resolution
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/increase-resolution"
description: >-
**Description**
The *Isolated Increase Resolution Route* is used to upscale the resolution of any image.
**The main difference between the regular and this isolated Increase Resolution endpoint is that you can use this endpoint without uploading or registering the image to Bria.**
**Constraints**
The Bria API currently supports only JPEG and PNG files in RGB, RGBA, or CMYK color modes. When the file is of a different type or color mode, the status code 415 will be returned.
It's possible to increase the resolution of an image up to a total area of 8192x8192 pixels.
**Increase the Resolution of an image using the image file**
In our documentation request example, we demonstrate how to Increase the Resolution of an image using the image URL.
If you want to use an image from a file, follow the example below:
import requests
url = "https://engine.prod.bria-api.com/v1/image/increase_resolution?desired_increase=2"
payload = {}
files=[
('file',('image_name.jpeg',open('/path_to_local_file/image_name.jpeg','rb'),'image/jpeg'))
]
headers = {
'api_token': 'xxxx'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
operationId: increase_resolution
parameters:
- in: header
name: api_token
schema:
type: string
required: true
- in: query
name: desired_increase
schema:
type: integer
example: 2
description: The resolution multiplier. The possible value are 2,4. It's possible to increase the resolution of an image up to a total area of 8,192x8,192 pixels.
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
file:
description: The image file you would like to increase the resolution for. Minimum resolution supported for width and/or height is 216 pixels.
type: string
format: binary
image_url:
description: The URL of the image file you would like to increase the resolution for. The URL should lead to an image publicly available online. Either a file or an image_url should be provided. If both are provided, then the route will use image_url. Minimum resolution supported for width and/or height is 216 pixels.
type: string
examples:
image url:
value:
image_url: "https://i.natgeofe.com/n/548467d8-c5f1-4551-9f58-6817a8d2c45e/NationalGeographic_2572187_square.jpg"
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
result_url:
type: string
description: URL that represents the updated visual created in the request. It is a temporary URL that will expire
example: "https://bria-temp.s3.amazonaws.com/engine_no_bg/727b73c6-b723-11ec-947a-c28fc8b4a55b.jpeg?AWSAccessKeyId=ASIAUL5JH7ABNOAGDDHM&Signature=IIZp7MtiAoY32wIq%2BAVoUd7U3XY%3D&x-amz-security-token=FwoGZXIvYXdzEEwaDJNBqgbCH8ZLEjbtwCKYBByHo1V0nSnkoDy3kvaujvGHcNdmw0pYIwWYuvYdnKYv5zmzE4k%2FcgcB8YfY8DXKBOZR9DB%2FpzwoMPYf%2FxDMy4NenzSXw4VymF3j97bTEy6M00j%2BVO3K5fJOpN7iWlrxTaFHQICUW7%2FHE4CvaQ%2FB%2BWoCakNiEESUQxGglIygfJpviyexXNsxNGpeq7BPSSrTdsuD6R27pKmdFgdkL3xzUgMQMKzSeTJL4hUVGVldOp5sI4Qlvwnb8L%2FW7ciHHjUCf8WuHtDjDSdBIAqNci6wtXL6SQwLG%2Fo3oryPr0tNOMsbnrIIoFP5ZnH3VQISPCITBkWuUu9bdXkBm2R7rJyfPPOusFLuom2GDyVEHJfA%2FUtwGELxtv7Co29Tujd2N%2BHRhcdyrNsngwYwU2AiLyopMglYIDNQpv9%2FIKnH9ikuki%2F%2FWQ2PnzepcttQuXzlsqlUJRg%2Fcqhqis%2BxwJXZL1vpPJb%2BJz22oMp%2FJqZw%2BOIBWdxiL0pRq%2FF6EmyQz8iuhVBkr%2BnN5eWWxOrizMLFoVRTP34NPOWvWLwZJlrHzryCY8wZ01u2OLu3jxMcBhwypIp4pCzwx%2BAo39AXU1iMHJq36S6Bl5uptEr1NONKQvvz%2BpndF5t1dnoK7lfD9XExjk16shJXIImqiN7kxP2RTIrKsvm8wJY6iPxE35%2Bn0Cw8BS1eRmXFIOdEcfzbJVq80SQRIMko4CePyoOiKPCRwJIGMipiGM2hMspLQDThPJdlIiCOIh670Q2pu95y27iI3i87WQB55KJ9JNTL39I%3D&Expires=1650276342"
'400':
description: Bad request
'405':
description: Method not allowed.
'406':
description: The input image's resolution is too low.
'460':
description: Failed to download image.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error.
'506':
description: Insufficient data. The given input is not supported by the Bria API.
/{visual_id}/image_to_psd:
post:
tags:
- Image Editing
summary: Delayer Image
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/delayer-image"
description: >-
**Description**
***Note: This API route requires the image to be registered via the `/register` route.***
**It will be replaced soon with isolated version, that doesn't require image registration.**
The *Image to PSD Route* is used to create a layered PSD file from any image.
The image is divided into different layers (depending on the image): a background layer with all identified objects removed, a foreground layer without the background, and a layer for each object.
You can also use this route on a modified image by providing the sid from the response of the previously used route.
operationId: image_to_psd
parameters:
- in: header
name: api_token
schema:
type: string
required: true
- in: path
name: visual_id
required: true
schema:
type: string
example: "8487fb411f3c6716"
description: visual id of the image, for which the user would like to create a layered PSD file
- in: query
name: sid
schema:
type: string
example: "Remove this parameter if the image has not been modified using Bria."
description: This session id was obtained from the response of a route that had been applied to this visual id. If you have used another route on the provided visual before, and you would like the current route to apply on the result of that route, please provide this information. This parameter is optional.
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
image_res:
type: string
description: URL that represents the updated visual created in the request. It is a temporary URL that will expire
example: "https://bria-temp.s3.amazonaws.com/engine_no_bg/727b73c6-b723-11ec-947a-c28fc8b4a55b.psd?AWSAccessKeyId=ASIAUL5JH7ABNOAGDDHM&Signature=IIZp7MtiAoY32wIq%2BAVoUd7U3XY%3D&x-amz-security-token=FwoGZXIvYXdzEEwaDJNBqgbCH8ZLEjbtwCKYBByHo1V0nSnkoDy3kvaujvGHcNdmw0pYIwWYuvYdnKYv5zmzE4k%2FcgcB8YfY8DXKBOZR9DB%2FpzwoMPYf%2FxDMy4NenzSXw4VymF3j97bTEy6M00j%2BVO3K5fJOpN7iWlrxTaFHQICUW7%2FHE4CvaQ%2FB%2BWoCakNiEESUQxGglIygfJpviyexXNsxNGpeq7BPSSrTdsuD6R27pKmdFgdkL3xzUgMQMKzSeTJL4hUVGVldOp5sI4Qlvwnb8L%2FW7ciHHjUCf8WuHtDjDSdBIAqNci6wtXL6SQwLG%2Fo3oryPr0tNOMsbnrIIoFP5ZnH3VQISPCITBkWuUu9bdXkBm2R7rJyfPPOusFLuom2GDyVEHJfA%2FUtwGELxtv7Co29Tujd2N%2BHRhcdyrNsngwYwU2AiLyopMglYIDNQpv9%2FIKnH9ikuki%2F%2FWQ2PnzepcttQuXzlsqlUJRg%2Fcqhqis%2BxwJXZL1vpPJb%2BJz22oMp%2FJqZw%2BOIBWdxiL0pRq%2FF6EmyQz8iuhVBkr%2BnN5eWWxOrizMLFoVRTP34NPOWvWLwZJlrHzryCY8wZ01u2OLu3jxMcBhwypIp4pCzwx%2BAo39AXU1iMHJq36S6Bl5uptEr1NONKQvvz%2BpndF5t1dnoK7lfD9XExjk16shJXIImqiN7kxP2RTIrKsvm8wJY6iPxE35%2Bn0Cw8BS1eRmXFIOdEcfzbJVq80SQRIMko4CePyoOiKPCRwJIGMipiGM2hMspLQDThPJdlIiCOIh670Q2pu95y27iI3i87WQB55KJ9JNTL39I%3D&Expires=1650276342"
'400':
description: Bad request.
'404':
description: Specified Image does not exist.
'405':
description: Method not allowed.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error.
'506':
description: Insufficient data. The given input is not supported by the Bria API.
/crop:
post:
tags:
- Image Editing
summary: Crop out foreground
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/crop-out-foreground"
description: >-
**Description**
The Crop Route is used to remove the background from an image and crop tightly around the foreground or remaining region of interest. It supports both images with and without a background.
operationId: crop
parameters:
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
image_url:
type: string
description: The URL of the input image. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
file:
type: string
description: The file of the input image, in base64 format. Used if image_url is not provided. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
padding:
type: integer
description: Cropping the object with padding around it. Currently, padding is applied to all four borders of the remaining region. This parameter is optional.
default: 0
force_rmbg:
type: boolean
default: false
description:
Forces background removal, even if the original image already contains an alpha channel.
Useful for refining existing foreground/background separation or ignoring unnecessary alpha channels.
example:
image_url: 'URL'
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
result_url:
type: string
description: URL that represents the updated visual created in the request. It is a temporary URL that will expire
example: "URL"
'400':
description: Bad request. Missing or invalid parameters.
'401':
description: Unauthorized. Invalid API key or authentication token.
'404':
description: Not found. Image could not be found at the provided URL.
'415':
description: Unsupported media type. Invalid file type. Supported file types are jpeg, jpg, png, webp.
'413':
description: Payload too large. Image file size exceeds the 12MB limit.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'460':
description: Failed to download image.
'451':
description: Unavailable for legal reasons.
'500':
description: Internal server error. An error occurred on the server.
/objects/mask_generator:
post:
tags:
- Image Editing
summary: Get Masks
externalDocs:
description: "Try it in the Sandbox"
url: "https://platform.bria.ai/apps/get-masks"
description: >-
**Description**
***Note: This API route requires the image to be registered via the `/register` route.***
The *Objects/Mask Generator Route* is used to generate all possible masks for an image, creating a full segmentation of the image.
The response contains a zip file named as the visual_id of the provided image.
There are k mask files in the zip, each named with the visual_id and mask_id.
The zip file contains an additional file whose name ends with "panoptic". It's not an image, it's a panoptic map. It can be transformed into a regular matrix.
Each point in the image (x,y) is mapped to the mask that applies to that point. In the panoptic map, each pixel's grayscale value includes the mask_id.
You can display those masks to the user, let them pick one or more masks, and use objects/remove route to remove the masked area.
In order to use the objects/remove route on the mask the user selected, you should provide the mask_id, and use the parameter mask_source=generated.
You can see below an example of the content of the zip:
92bf8ce17584de82_panoptic.png
92bf8ce17584de82_1.png
92bf8ce17584de82_2.png
92bf8ce17584de82_3.png
...
92bf8ce17584de82_86.png
You can access the SDK that demonstrates how to use this endpoint in a UI in the following link.
operationId: objects/mask_generator
parameters:
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
content:
application/json:
schema:
type: object
properties:
image_url:
type: string
description: The URL of the input image. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
file:
type: string
description: The file of the input image, in base64 format. Used if image_url is not provided. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
examples:
send using url:
value:
image_url: 'URL'
send using base64 string:
value:
file: 'base64_encoded_string_for_image'
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
objects_masks:
type: string
example: "https://bria-image-repository.s3.amazonaws.com/mask2click/masks/92bf8ce17584de82.zip?AWSAccessKeyId=AKIAUL5JH7ABJXXBAV6D&Signature=vCX%2BHEAnGmUolwLxKfPBBKPUZaM%3D&Expires=1690732111"
'400':
description: Bad request.
'404':
description: Specified Image does not exist.
'405':
description: Method not allowed.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error.
'506':
description: Insufficient data. The given input is not supported by the Bria API.
/{visual_id}/person/info:
get:
tags:
- Image Editing
summary: Get Presenter info
description: >-
**Description**
***Note: This API route requires the image to be registered via the `/register` route.***
The *Person/Info Route* is used to retrieve useful information on the people in a specific
visual that was previously uploaded to the database.
Additionally, it provides a description of each person within the scene
along with its available changes, which are supported by the Bria API.
This route should be used instead of the main /info route when you are only interested in
information and available actions for the people in the image.
With this route, you will save time by only obtaining information that is relevant to your needs.
operationId: person/info
parameters:
- in: header
name: api_token
schema:
type: string
required: true
- in: path
name: visual_id
required: true
schema:
type: string
example: "f49943971e3039c7"
description: visual id of the image, received after using the /upload or register route.
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: array
items:
type: object
properties:
actions:
type: object
description: The available API actions for this specific person.
id:
type: string
description: The id of the person
labels:
type: array
description: The known information about the person, such as age range and gender
oracle:
type: object
description: The predicted quality of the available actions for this specific person
rect:
type: object
description: The location of the face inside the image. x and y represent the upper left corner of the face, and by using the w (width) and h (height) you can create a rectangle around the face.
type:
type: string
description: In this route it will allways be 'person'
examples:
example:
value:
[
{
actions:{
"age":[
"mid-20",
"mid-40",
"mid-60"
],
"Beard":[
"shaved",
"medium",
"full"
],
"diversity":[
"original",
"africa",
"korea",
"india",
"japan",
"sweden",
"germany",
"russia",
"mexico",
"brazil",
"england",
"spain",
"france",
"unsplash"
],
"expression":[
"happy",
"surprised",
"dreaming",
"angry",
"fear",
"contempt",
"disgusted",
"sad",
"smile"
],
"gender":[
"femininity",
"masculinity"
],
"glasses":[
"light",
"none",
"heavy"
],
"hair_line":[
"high",
"low"
],
"haircolor":[
"black",
"brown",
"red",
"blond",
"gray"
],
"makeup":[
"light",
"heavy",
"none"
]
},
id:"c6bbe1cd719300c11e5c581889e9383245a0c1d923f210a3445e8ea5a25500e0",
labels:[
"age_14-26",
"glasses",
"Female"
],
oracle:{
"age":{
"age":"low"
},
"Beard":{
"Beard":"low"
},
"diversity":{
"africa":"low",
"brazil":"low",
"england":"low",
"france":"low",
"germany":"low",
"india":"low",
"japan":"low",
"korea":"low",
"mexico":"low",
"russia":"low",
"spain":"low",
"sweden":"low"
},
"expression":{
"angry":"high",
"calm":"high",
"contempt":"high",
"disgusted":"high",
"dreaming":"high",
"fear":"high",
"happy":"high",
"surprised":"high"
},
"gender":{
"gender":"low"
},
"glasses":{
"glasses":"low"
},
"hair_line":{
"hair_line":"low"
},
"haircolor":{
"haircolor":"low"
}
},
rect:{
"h":375.98625326156616,
"w":280.4049072265625,
"x":1134.1341552734375,
"y":290.6307406425476
},
type:"person"
},
{
actions:{
"age":[
"mid-20",
"mid-40",
"mid-60"
],
"Beard":[
"shaved",
"medium",
"full"
],
"diversity":[
"original",
"africa",
"korea",
"india",
"japan",
"sweden",
"germany",
"russia",
"mexico",
"brazil",
"england",
"spain",
"france",
"unsplash"
],
"expression":[
"happy",
"surprised",
"dreaming",
"angry",
"fear",
"contempt",
"disgusted",
"sad",
"smile"
],
"gender":[
"femininity",
"masculinity"
],
"glasses":[
"light",
"none",
"heavy"
],
"hair_line":[
"high",
"low"
],
"haircolor":[
"black",
"brown",
"red",
"blond",
"gray"
],
"makeup":[
"light",
"heavy",
"none"
]
},
id:"d74da71f722b45de5f18f93e9dd7fc64a50a5a5dda001985ab9c2374807182b8",
labels:[
"age_26-42",
"happy",
"Female"
],
oracle:{
"age":{
"age":"high"
},
"Beard":{
"Beard":"high"
},
"diversity":{
"africa":"high",
"brazil":"high",
"england":"high",
"france":"high",
"germany":"high",
"india":"high",
"japan":"high",
"korea":"high",
"mexico":"high",
"russia":"high",
"spain":"high",
"sweden":"high"
},
"expression":{
"angry":"high",
"calm":"high",
"contempt":"high",
"disgusted":"high",
"dreaming":"high",
"fear":"high",
"happy":"high",
"surprised":"high"
},
"gender":{
"gender":"high"
},
"glasses":{
"glasses":"high"
},
"hair_line":{
"hair_line":"high"
},
"haircolor":{
"haircolor":"high"
}
},
rect:{
"h":354.8530983924866,
"w":282.885498046875,
"x":555.80419921875,
"y":486.4655692577362
},
type:"person"
}
]
'205':
description: File hasn’t finished onboarding. Please call /info again until you get 200.
'400':
description: One of the details does not meet specification. Please call person/info again.
'404':
description: Specified Image does not exist.
'405':
description: Method not allowed.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error.
'506':
description: Insufficient data. The given input is not supported by the Bria API.
/{visual_id}/create:
post:
tags:
- Image Editing
summary: Modify Presenter
description: >-
**Description**
***Note: This API route requires the image to be registered via the `/register` route.***
The *Create Route* is used to create a new visual, based on the changes
requested by the user for a previously uploaded visual.
You can also use this route on a modified image by providing the sid from the response of the previously used route.
This route returns both the URL and the sid associated with the updated image.
Before making any modifications, please call the /info or person/info route to obtain information on the available presenters in the image, the available modifications, and their oracle values.
You should always include all the required changes in the request if you want to use multiple changes on a single person. It is not supported to make one request on a person with one change, take the SId from the result, and then use it in another request with a different change.
When you want to make changes on multiple people, you can make one request with all the desired changes on all the relevant people or make one request with all the desired changes on one person and then use the sid from the response in the request on the other person.
operationId: create
parameters:
- in: header
name: api_token
schema:
type: string
required: true
- in: path
name: visual_id
required: true
schema:
type: string
example: "8487fb411f3c6716"
description: visual id of the image the user wants to create a new visual from.
requestBody:
content:
application/json:
schema:
type: object
properties:
sid:
type: string
description: This session id was obtained from the response of a route that had been applied to this visual id. If you have used another route on the provided visual before, and you would like the current route to modify the result of that route, please provide this information. This parameter is optional.
desired_resolution:
type: string
description: The desired resolution of the updated image. This parameter is optional.
enum: ["original", "nhd", "svga", "xga", "had", "wuxga", "uwfhd", "wqxga", "uwqhd", "uhd"]
changes:
type: array
description: The requested changes to the original visual.
items:
type: object
properties:
id:
type: string
description: Id of the selected object in the image, to which the user would like to make changes.
actions:
type: object
description: The changes the user wishes to perform for this object in the image. Each action the user chooses to use must be included in the info route response for this object and image. This is essential for the /create request to be successful.
properties:
age:
type: string
enum: ["mid-20", "mid-40", "mid-60"]
description: Changing the age of a selected person. It is possible to use one of the enum values or to provide a value between -10 and 10. Decimal values are acceptable.
diversity:
type: string
enum:
- africa
- korea
- india
- japan
- sweden
- germany
- russia
- mexico
- brazil
- england
- spain
- france
description: Changing the diversity of a selected person. It is possible to use one of the enum values or to provide in addition to the enum a value between 0 and 1.
expression:
type: string
enum:
- happy
- surprised
- dreaming
- angry
- fear
- contempt
- disgusted
- sad
description: Changing the expression of a selected person. It is possible to use one of the enum values or to provide in addition to the enum a value between 0 and 1.5.
glasses:
type: string
enum: ["light", "heavy", "none"]
description: Changing the glasses of a selected person. It is possible to use one of the enum values or to provide a value between 0 and 6. Only integer values are acceptable.
haircolor:
type: string
enum: ["black", "brown", "red", "blond", "gray"]
description: Changing the hair color of a selected person. It is possible to use one of the enum values or to provide a value between 0 and 4. Only integer values are acceptable.
gender:
type: string
enum: ["femininity","masculinity"]
description: Changing the gender of a selected person. It is possible to use one of the enum values or to provide a value between -10 and 10. Decimal values are acceptable.
makeup:
type: string
enum: ["light", "heavy", "none"]
description: Changing the makeup of a selected person. It is possible to use one of the enum values or to provide a value between -10 and 10. Decimal values are acceptable.
hair_line:
type: string
enum: ["high", "low"]
description: Changing the hair line of a selected person. It is possible to use one of the enum values or to provide a value between -20 and 20. Decimal values are acceptable.
Beard:
type: string
enum: ["shaved", "medium", "full"]
description: Changing the facial hair of a selected person. It is possible to use one of the enum values or to provide a value between -2 and 2. Decimal values are acceptable.
examples:
Using enum values:
value:
changes:
[
{
"id": "c6bbe1cd719300c11e5c581889e9383245a0c1d923f210a3445e8ea5a25500e0",
"actions": {
"age": "mid-60",
"diversity": "france",
"expression": "happy"
}
}
]
Using continuous numeric values:
value:
changes:
[
{
"id": "c6bbe1cd719300c11e5c581889e9383245a0c1d923f210a3445e8ea5a25500e0",
"actions": {
"age": {"key":"age","value":6.2},
"diversity": {"key":"france","value":0.8},
"expression": {"key":"happy","value":0.6}
}
}
]
Using enum values and continuous numeric values:
value:
changes:
[
{
"id": "c6bbe1cd719300c11e5c581889e9383245a0c1d923f210a3445e8ea5a25500e0",
"actions": {
"age": {"key":"age","value":6.2},
"diversity": "france",
"expression": {"key":"happy","value":0.6}
}
}
]
Multiple People:
value:
changes:
[
{
"id": "person_1",
"actions": {
"age": {"key":"age","value":6.2},
"diversity": "france",
"expression": {"key":"happy","value":0.6}
}
},
{
"id": "person_1",
"actions": {
"age": {"key":"age","value":6.2},
"diversity": "france",
"expression": {"key":"happy","value":0.6}
}
}
]
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
image_res:
type: string
description: URL that represents the new visual created in the request. It is a temporary URL that will expire
example: "https://d1uzvjowrxhw13.cloudfront.net/api/create_results/8487fb411f3c6716_05e8a8dc-b723-11ec-be15-c28fc8b4a55b.JPEG?AWSAccessKeyId=ASIAUL5JH7ABM5GPF244&Signature=OaE%2BTJW%2FBJFDB2xGXpy%2F%2F8TYkAE%3D&x-amz-security-token=FwoGZXIvYXdzEEsaDHAX5TxTwymFAQYSwSKYBK3lKAwEipl9tjg1QQwWMdQDqS%2B0rYkexasgxxW78Vz4DvJUVPISpnTOZk4h%2Fy6%2BikLC5%2FYGY86SL8980ZHZzRgqcodDJ0n6ljB7SgbkfJnSpgx%2F8iCHzoDH%2BS7YrUjnR7e%2FUz%2B4sIbV%2BSHGn36EXTNnrm%2FOgCsiL9vqLSGFEo5R1pLYIbezxWCEWMLcDO5x9WsVoPRYW7c%2B5B%2B1Ku3qybQEBFRex4BVisJU4NTXbwQKFWMbkTjHg5vK%2FEdQn7OzmCA7SfCSHe%2FqDZIBQG0ki%2BHt%2Fs4bAYYTZpl%2FjoUJTldlltdWH2uitj%2BBeyQKcUnHrPjTY1CsAOEC6OV%2FKlZfOjbNJTvlmHc7%2BKP3iICKlCVJwvRK6%2FnmU7mUVOb%2FmgD2kIvBq5G6fNxXQlKfFGZE2lSs8HR83sp44Qz8hm60DPfK45hE0XdVnIS2jY%2F1a%2BYBmijCr4HDTgv52D53CdnOiQ%2BQ8Yld0bBZRC4aDBATcvcsDcnO4BBMY0NS1c%2BSJ6b4IMxDK2OKdanf9EYiDgzr3ebsS1m7j4NX3pEvNC99YF%2B5PQwDYhbMwlMCAG9AMs9%2FF86Al3czOJFOxV1ClBEoUKy2TgntGraCp76UoLmRrHuRq7WKQUvIj2HAXsIlyNkBg3z498M1Gh7vyD%2F7xQgA0Ny6zYeC1gBH4HmYtFlBS%2BJimmxFlCoCuyFhBmUXp7p6oBI3APuSyQYLKLmQwJIGMioiS3mUno68q7GAsD%2FPmSCM8xMeEWF8IegvlU4XWAQuNnQJLVtqwkZb1Qo%3D&Expires=1650276159"
sid:
type: string
example: "aaeec35e-9904-21ed-a479-964fdf514767.JPEG"
description: This session id represents the result of the current route request. If you wish to use this result in other routes, please provide this sid in their input.
'400':
description: Bad request.
'404':
description: Specified Image does not exist.
'405':
description: Method not allowed.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error.
'506':
description: Insufficient data. The given input is not supported by the Bria API.
# search routes
/caption:
post:
tags:
- AI Search
summary: Get Caption
description: >-
**Description**
The *Caption Route* is used to get a caption that describes the given image.
operationId: caption
parameters:
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
image_url:
type: string
description: The URL of the input image. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
file:
type: string
description: The file of the input image, in base64 format. Used if image_url is not provided. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB.
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
results:
type: array
items:
type: object
properties:
caption:
type: string
example: "woman walking on a bridge in the jungle"
'400':
description: Bad request. Missing or invalid parameters.
'401':
description: Unauthorized. Invalid API key or authentication token.
'404':
description: Not found. Image could not be found at the provided URL.
'415':
description: Unsupported media type. Invalid file type. Supported file types are jpeg, jpg, png, webp.
'413':
description: Payload too large. Image file size exceeds the 12MB limit.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'460':
description: Failed to download image.
'451':
description: Unavailable for legal reasons.
'500':
description: Internal server error. An error occurred on the server.
/search:
get:
tags:
- AI Search
summary: Search by text
description: >-
**Description**
By using the *Search Route*, you can utilize Bria's generative search capabilities, which don't require labels or keywords.
The user can send any text query and receive relevant images that match the query.
The *Search Route* returns the images, sorted by the match score, from highest match to lowest match.
The images are returned in batches, and you can specify how many images to receive in one batch, and which batch to receive in each call.
Search will only work on images that have been onboarded using the `register` endpoint.
**Note:** To use this endpoint, please contact us at [support@bria.ai](mailto:support@bria.ai).
operationId: search
parameters:
- in: header
name: api_token
schema:
type: string
required: true
- name: query
in: query
schema:
type: string
example: "woman traveling in the world"
description: the text query for which the user is looking for matching images.
- name: num_results_per_page
in: query
schema:
type: integer
example: 1
description: how many images you would like to receive from the gallery search. The default value is 50. The maximum value is 500. No need to use this parameter when gallery_search=false.
- name: page
in: query
schema:
type: integer
example: 1
description: which batch of images you would like to receive in the current call. Synthetic results will only be included in page no. 1. The default value is 1. For each query, we support 800 results, so if you set num_results_per_page=50, you will have 16 pages of results.
- name: gallery_id
in: query
schema:
type: string
example: "425"
description: Bria will provide you with this parameter which represents your account's image gallery. You must include this parameter.
- name: style
in: query
schema:
type: string
example: "photo realistic"
enum: ['stock photography','photo realistic','fashion','retro','sports','still life','hyper realistic','travel','artistic','3d render','realistic','fantasy','comic book','minimalistic']
description: Which style you would like to see in your results, this parameter is optional.
- name: atmosphere
in: query
schema:
type: string
enum: ['dramatic','vivid','warm','cool']
example: "dramatic"
description: Which atmosphere you would like to get in your results, this parameter is optional.
- name: camera
in: query
schema:
type: string
enum: ['portrait','close up','aerial','landscape']
example: "portrait"
description: Which camera angle you would like to see in your results, this parameter is optional.
- name: medium
in: query
schema:
type: string
enum: ['photography','art']
example: "photography"
description: Which medium should be included in your results, this parameter is optional.
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
results:
type: array
description: there are multiple objects in this array (based on the amount specified in num_results_per_page) and each object represents a single image. The images in the array are sorted by the similarity score, from the highest to the lowest. If the specified batch (=page) is empty, the results array will be empty.
items:
type: object
properties:
visual_id:
type: string
description: visual id of the image, documented in Bria.
example: "a169a6862f24de75"
org_image_key:
type: string
description: It will be returned if the image was registered using an org_image_key.
example: None
source_url:
type: string
description: It will be returned if the image was registered using a URL.
example: None
'400':
description: Bad request.
'404':
description: Specified Image does not exist.
'405':
description: Method not allowed.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error.
'506':
description: Insufficient data. The given input is not supported by the Bria API.
/search_similar_images:
get:
tags:
- AI Search
summary: Search by Image
description: >-
**Description**
By using the *Search Route*, you can utilize Bria's generative search capabilities, which don't require labels or keywords.
The user can send any text query and receive relevant images that match the query.
The *Search Route* returns the images, sorted by the match score, from highest match to lowest match.
The images are returned in batches, and you can specify how many images to receive in one batch, and which batch to receive in each call.
Search will only work on images that have been onboarded using the `register` endpoint.
**Note:** To use this endpoint, please contact us at [support@bria.ai](mailto:support@bria.ai).
operationId: search_similar_images
parameters:
- in: header
name: api_token
schema:
type: string
required: true
- name: vhash
in: query
schema:
type: string
example: "e01592ef1188df76"
description: the visual id of the image for which the user is looking for similar images.
- name: num_results_per_page
in: query
schema:
type: integer
example: 1
description: how many images you would like to receive in the current call. The default value is 50. The maximum value is 500.
- name: page
in: query
schema:
type: integer
example: 1
description: which batch of images you would like to receive in the current call. The default value is 1. For each query, we support 800 results, so if you set num_results_per_page=50, you will have 16 pages of results.
- name: gallery_id
in: query
schema:
type: string
example: "425"
description: Bria will provide you with this parameter which represents your account's image gallery. You must include this parameter.
- name: url
in: query
schema:
type: string
example: "If you are using the vhash paramater, there is no need to use this parameter"
description: URL of an image, for which you would like to find similar images. When you want to search based on modified images, or images that have not been uploaded or registered to Bria, you can use this parameter. When this parameter is provided, the visual_id parameter can be None. The supported file types are jpg, jpeg and png, up to 12 mb.
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
results:
type: array
description: there are multiple objects in this array (based on the amount specified in num_results_per_page) and each object represents a single image. The images in the array are sorted by the similarity score, from the highest to the lowest. If the specified batch (=page) is empty, the results array will be empty.
items:
type: object
properties:
visual_id:
type: string
description: visual id of the image, documented in Bria.
example: "a169a6862f24de75"
org_image_key:
type: string
description: It will be returned if the image was registered using an org_image_key.
example: None
source_url:
type: string
description: It will be returned if the image was registered using a URL.
example: None
'400':
description: Bad request.
'404':
description: Specified Image does not exist.
'405':
description: Method not allowed.
'429':
description: Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
'500':
description: Internal server error.
'506':
description: Insufficient data. The given input is not supported by the Bria API.
# image onboarding
/register:
post:
tags:
- Image Onboarding
summary: Register Image
description: >-
**Description**
A new visual can be registered to Bria without being uploaded to the database using the *Register Route*.
This route returns a visual identification to the user. This is the recommended method to onboard images to Bria, when needed.
It's the first step for consuming the Bria API for new visuals (instead of using the /upload route).
**Response**
The visual id in the response of the *Register Route* must be kept by the
user in order to query image info, modify the image and use the search routes.
```{ "visual_id": "9ea9a4d2d19977a7c" }```
The *visual_id* in the response of the /upload route will be used for all
other routes.
Store the visual_id in your database and map it to your image identification method for easy reference
**Constraints**
Files should not be larger than 12MB. The status code 413 will be returned if the file exceeds its
maximum size.
The Bria API currently supports only JPEG and PNG files in RGB, RGBA, or CMYK color modes. When the file is of a different type or color mode, the status code 415 will be returned.
operationId: register
parameters:
- in: header
name: api_token
schema:
type: string
required: true
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
org_image_key:
type: string
description: The internal image id in your API, of the image you would like to register to Bria. If accessing your images requires authentication, you will be able to register them using org_image_key only after giving Bria the API authentication information. It is also possible to register images using an org_image_key, without any authentication data.
image_url:
description: The URL of the image you would like to register to Bria. The URL should lead to an image publicly available online. Either an org_image_key or an image_url should be provided. If both are provided, then the route will use image_url and org_image_key will be saved but not used. Images can only be registered using an image_url if they do not require authentication.
type: string
is_private:
description: The image can be included in the Bria public gallery (is_private=false) or only in the Bria gallery of your organization (is_private=true). This parameter is optional and the default value is true.
type: string
default: true
examples:
only image_url:
value:
image_url: "https://i.natgeofe.com/n/548467d8-c5f1-4551-9f58-6817a8d2c45e/NationalGeographic_2572187_square.jpg"
only org_image_key:
value:
org_image_key: "12345acbd"
image_url & org_image_key:
value:
image_url: "https://i.natgeofe.com/n/548467d8-c5f1-4551-9f58-6817a8d2c45e/NationalGeographic_2572187_square.jpg"
org_image_key: "12345acbd"
responses:
'200':
description: Successful operation.
content:
application/json:
schema:
type: object
properties:
visual_id:
type: string
description: Unique visual identification
'208':
description: Image already registered.
content:
application/json:
schema:
type: object
properties:
visual_id:
type: string
description: Unique visual identification
'400':
description: Bad request.
'405':
description: Method not allowed.
'460':
description: Failed to download image.
'500':
description: Internal server error.
'506':
description: Insufficient data. The given input is not supported by the Bria API.
/{visual_id}/remove_image:
post:
tags:
- Image Onboarding
summary: Remove Image
description: >-
**Description**
With this route, you can remove an image from the gallery of your organization. The image won't be removed from Bria.
operationId: remove_image
parameters:
- in: header
name: api_token
schema:
type: string
required: true
- in: path
name: visual_id
schema:
type: string
required: true
example: "b3cecc33cc31cc31"
responses:
'200':
description: Successful operation.
'400':
description: Bad request.
'405':
description: Method not allowed.
'460':
description: Failed to download image.
'500':
description: Internal server error.
'506':
description: Insufficient data. The given input is not supported by the Bria API.