The Bria API

We are happy to answer any questions you may have at: support@bria.ai

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 Branded Models: Create and manage custom-branded models to generate images in specific styles or themes using your datasets.

  • Generate Vector Graphics (beta): Use the base and branded 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.

  • Modify and Transform Images: Bring your own images and modify them using various routes to suit your needs.

This document provides an overview of the API's capabilities and guides users on how to effectively implement them.

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.

Branded Generation: The Branded Generation API allows you to create and manage custom-branded models for generating unique visual content based on your datasets. Branded models can be trained using the API or through the Bria platform here.

Using the Branded Generation API:

  • Dataset Management:
    • Use the /datasets endpoint to create a new dataset or retrieve existing datasets that belong to the client organization.
    • Use the /datasets/{dataset_id}/images endpoint to upload new images to a dataset or retrieve existing images that belong to the dataset.
    • Use the /datasets/{dataset_id}/images/{image_id} endpoint to get or delete a specific image from a dataset.
  • Model Management:
    • Use the /models endpoint to create a new model or retrieve all models that belong to the client organization.
    • Use the /models/{id} endpoint to retrieve a specific model by its ID or delete a specific model.
  • Training Management:
    • Use the /models/{id}/start_training endpoint to initiate the training process. Ensure that the dataset includes the minimum required number of images and has a status of 'completed' before starting training.
    • Use the /models/{id}/stop_training endpoint to stop a training job for a model.

Training a Branded Model:

  1. Create a Dataset: Use the /datasets endpoint to create a dataset.
  2. Upload Images: Upload your images to this dataset using the /datasets/{dataset_id}/images endpoint.
  3. Create a Model: Use the /models endpoint to create a model associated with your dataset.
  4. Complete the Dataset: Ensure the dataset meets the minimum image requirements and change its status to 'completed'.
  5. Start Training: Initiate the training process using the /models/{id}/start_training endpoint.
  6. Monitor Training: Optionally, you can check the training status to monitor progress.
  7. Generate Images: Once the model is trained, use the /text-to-image/tailored/{model_id} route to generate images.

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.

Modifying Images

Bria supports both isolated and registration-required routes for modifying 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.

  • /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.