Skip to content
Last updated

The Bria API enables developers and enterprises to generate and edit high-quality visual content at scale with predictable, consistent, and compliant results, offering enterprise-grade tools built for commercial use.

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 and Generate visuals: Create models that preserve and faithfully reproduce your visual IP, ensuring consistency across all generated outputs.

  • Generate Ads: Utilize Bria's Ads Generation APIs to automate the creation of ads at scale, ensuring brand consistency and efficiency.

  • Edit Product Imagery: Use specialized features to create professional product shots, packshots, and lifestyle images.

  • 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 capabilities, 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.


API Access

You can register and access the API Token through Bria's platform by clicking here.


Authentication

All API requests must include your API token in the request header:

api_token: <your_api_token>


Rate Limiting

To ensure stable and reliable performance for all users, Bria's API enforces rate limits based on your plan type. If you exceed your allocated request rate, the API will return a 429 Too Many Requests error. We recommend implementing retry logic with exponential backoff in your client to gracefully handle rate limits.

Rate Limits by Plan

Plan TypeRequest Limit
Free Trial10 requests per minute, per endpoint
Starter60 requests per minute, per endpoint
Pro & Enterprise1000 requests per minute, per endpoint

Asynchronous Requests and the Status Service

Bria API V2 endpoints process requests asynchronously by default. When an asynchronous request is made, the API immediately returns a request_id and a status_url instead of the final result. You can use the Status Service to track the request’s progress until it reaches a completed state.

How It Works

  1. Submit the request – Send your API call with sync=false (default).
  2. Receive tracking details – The response includes:
    • status_url – The endpoint you can poll for updates.
    • request_id – The unique job identifier.
  3. Poll for updates – Continuously query the status_url or /status/{request_id} until the status field changes to a completed state:
    • IN_PROGRESS – Request accepted and processing.
    • COMPLETED – Request finished successfully; result.image_url contains the generated asset. Additional fields such as seed, prompt, or refined_prompt may be included.
    • ERROR – Processing failed; details are in the error object.
    • UNKNOWN – Unexpected error; contact Support with the request_id.
  4. Retrieve results – Once COMPLETED, download your assets from the image_url provided.

Error Handling

If you exceed the limit:

  • The server responds with HTTP 429 Too Many Requests.
  • The response includes a message indicating that you have hit the rate limit.
  • You should wait before making additional requests.

For applications with higher throughput requirements, we recommend upgrading to a Pro or Enterprise plan.

Tip: To monitor your usage and avoid interruptions, track your request rate and incorporate automatic retries with delay mechanisms.


Preparing Images for API Requests

Bria's API supports images in two formats:

  1. Image URLs – Provide a publicly accessible URL to the image.
  2. Base64-encoded images – Convert an image to a Base64 string and send it in the request.

Converting an Image to Base64 in Python:

import base64

def image_to_base64(image_path):
    with open(image_path, "rb") as image_file:
        encoded_string = base64.b64encode(image_file.read()).decode("utf-8")
    return encoded_string

# Example usage
base64_string = image_to_base64("example.jpg")
print(base64_string)  # Use this string in the API request

Note: ensure that you do not include the Base64 headers (e.g., data:image/png;base64,), as the API expects only the raw encoded string.


Contact

If you have any questions, feel free to contact us: support@bria.ai