Skip to content

Overview

Bria's Ads Generation API enables builders to create multiple ads (scenes) in various sizes and resolutions, all unified by the same branding, style, and messaging. You can start exploring immediately with our public templates and brands.

For creating your own private templates and brands, please Contact Us.

Getting Started with Public Assets

You can start exploring the API immediately using our public templates and brands, with no setup required. You can also explore them in our Playground Demo.

  • Public Template IDs:
    • 1062: A template that requires a brand ID.
    • 1061: A brand-independent template (does not require a brand ID).
  • Public Brand IDs: 167, 166, 122, 121, 120. These can be used for testing with compatible templates like 1062.
  • Important: Public templates and brands can only be used with each other and cannot be mixed with private assets.

The Ads Generation API provides a set of endpoints to manage the assets needed for ads generation:

  1. Templates: Pre-designed ad layouts that can be reused and customized:

    • Access template libraries and their configurations
    • Each template contains multiple scenes with customizable elements
    • Templates can be created using BRIA's Ads Editor
  2. Brands: Define and manage brand assets:

    • Store and retrieve brand-specific elements like logos, colors, and fonts
    • Ensure brand consistency across all generated ads
  3. Ads Generation: Create ads using templates and brand assets:

    • Customize text, images, and smart image backgrounds
    • Generate multiple ad variations at scale
    • Configure scene-specific elements and properties
Download OpenAPI description
Languages
Servers
https://engine.prod.bria-api.com/v1/

Endpoints

Operations

Generate Ads

Request

Bria's Ads Generation API enables builders to create multiple ads (scenes) in various sizes and resolutions, all unified by the same branding, style, and messaging. You can start exploring immediately with our public templates and brands. For creating your own private templates and brands, please Contact Us. Getting Started with Public Assets You can start exploring the API immediately using our public templates and brands, with no setup required. You can also explore them in our Playground Demo.

  • Public Template IDs:
    • 1062: A template that requires a brand ID.
    • 1061: A brand-independent template (does not require a brand ID).
  • Public Brand IDs: 167, 166, 122, 121, 120. These can be used for testing with compatible templates like 1062. * Important: Public templates and brands can only be used with each other and cannot be mixed with private assets.

Template
Templates enable to repurpose and reuse well-design ads that share the same style, content and branded elements.It consists of multiple ads (“scenes”) and includes configurations for customizing the content at scale.

Smart Image Feature
A standout feature of BRIA's Ads 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 Ads 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.

In thie endpoint, responses are asynchronous, immediately providing URLs for ads that are generated in the background. Use polling for the URLs to retrieve ads once ready.

Templates can be easily created using BRIA’s Ads Editor. Once a template is ready, it can be used to produce multiple ad versions with varying messaging, branding, and images.

This API endpoint supports content moderation via an optional parameter that can prevent generation if input images contain inappropriate content, and filters out unsafe generated images - the first blocked input image will fail the entire request.

Headers
api_tokenstringrequired

API token associated with the organization.

Bodyapplication/json
content_moderationboolean

When enabled, applies content moderation to both input visuals and generated outputs.

For input images:

  • Processing stops at the first image that fails moderation
  • Returns a 422 error with details about which parameter failed

For generated ads:

  • Failed ads are replaced with zero-byte files at their placeholder URLs
  • Successful ads are stored at their original placeholder URLs
Default false
template_idstring

The ID of the template to be used for generating the ads scenes.

brand_idstring

The ID of the brand to be used across all generated ads. A required field, unless the template is non brand related template and in that case even if brand if is provided, it isn't used.

smart_imageobject

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).

smart_image.​input_image_urlstring

URL of the input image that will be embedded within the smart image.

smart_image.​sceneobject
smart_image.​scene.​operationstring
Enum"expand_image""lifestyle_shot_by_text"
smart_image.​scene.​inputstring

Background prompt or hex color for the image’s background. If the operation chosen is "expand" this parameter is ignored.

elementsArray of objects

List of text/images objects

elements[].​layer_typestring

The element type, either "text" or "image".

Enum"text""image"
elements[].​content_typestring

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 value between #1-#5 (for example Heading #1, Image #1 and etc.)

elements[].​contentstring

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.

elements[].​idstring

Unique identifier for the element.

curl -i -X POST \
  https://engine.prod.bria-api.com/v1/ads/generate \
  -H 'Content-Type: application/json' \
  -H 'api_token: string' \
  -d '{
    "template_id": "123",
    "smart_image": {
      "input_image_url": "https://example.com/image.jpg",
      "scene": {
        "operation": "lifestyle_shot_by_text",
        "input": "A scenic background"
      }
    },
    "brand_id": "456",
    "elements": [
      {
        "layer_type": "text",
        "content_type": "Heading #1",
        "content": "Sale Now!"
      }
    ]
  }'

Responses

Successfull operation.

Bodyapplication/json
resultArray of objects

A list of objects, where each object contains an image URL corresponding to a scene in the template, the scene's name, and its resolution.

result[].​idstring

The unique ID for the generated scene.

result[].​namestring

The name of the scene from the template used to generate the image.

Example: "scene_name"
result[].​urlstring

The URL to download the generated scene result as a .png image.

Example: "IMAGE_URL"
result[].​resolutionobject

An object containing the width and height of the generated image. Can be an empty object if resolution is not available.

Example: {"width":1920,"height":1080}
result[].​resolution.​widthinteger
Example: 1920
result[].​resolution.​heightinteger
Example: 1080
Response
application/json
{ "result": [ { "id": "string", "name": "scene_name", "url": "IMAGE_URL", "resolution": { "width": 1920, "height": 1080 } } ] }

Get Brands

Request

Retrieves the list of your private brands. For initial testing, you can use our public brand IDs directly in the /ads/generate endpoint. To create your own private brands that will appear in this list, please Contact Us.

Headers
api_tokenstringrequired

API token associated with the organization.

curl -i -X GET \
  https://engine.prod.bria-api.com/v1/ads/brands \
  -H 'api_token: string'

Responses

Successfully retrieved list of brands.

Bodyapplication/jsonArray [
idinteger
namestring
descriptionstring
created_atstring
]
Response
application/json
[ { "id": 0, "name": "string", "description": "string", "created_at": "string" } ]

Get Templates

Request

Retrieves the list of your private templates. To start experimenting right away, use our public template IDs (1062, 1061) directly in the /ads/generate endpoint. You can see these in action in our Playground Demo. To create your own private templates that will appear here, please Contact Us.

Headers
api_tokenstringrequired

API token associated with the organization.

curl -i -X GET \
  https://engine.prod.bria-api.com/v1/ads/templates \
  -H 'api_token: string'

Responses

Successfully retrieved list of templates.

Bodyapplication/jsonArray [
idinteger
namestring
descriptionstring
created_atstring
number_of_adsinteger
previewstring
]
Response
application/json
[ { "id": 0, "name": "string", "description": "string", "created_at": "string", "number_of_ads": 0, "preview": "string" } ]

Get Template info by ID

Request

Retrieve details for a specific private template by its ID. Please note: This endpoint is for inspecting your private templates only and cannot be used to retrieve details for public template IDs.

Path
template_idstringrequired

The ID of the template.

Headers
api_tokenstringrequired

API token associated with the organization.

curl -i -X GET \
  'https://engine.prod.bria-api.com/v1/ads/templates/{template_id}' \
  -H 'api_token: string'

Responses

Successfully retrieved template details.

Bodyapplication/json
property name*Array of objectsadditional property
property name*[].​idstring

The unique identifier for the element.

property name*[].​layer_typestring

The type of element, either "text" or "image".

property name*[].​content_typestring or null

The configurable content type, like "Heading

property name*[].​contentstring

The default content of the element (text or an image URL).

property name*[].​scene_numberinteger

The scene number this element belongs to.

Response
application/json
{ "property1": [ { "id": "string", "layer_type": "string", "content_type": "string", "content": "string", "scene_number": 0 } ], "property2": [ { "id": "string", "layer_type": "string", "content_type": "string", "content": "string", "scene_number": 0 } ] }