---
title: "Generate a Campaign"
method: POST
path: "/campaign_api/generate"
tags: ["Campaign Generation (Coming soon)"]
---

# Generate a Campaign

`POST /campaign_api/generate`

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.

<img src="https://bria-datasets.s3.us-east-1.amazonaws.com/temp_exp_or/Campaign.jpg" width="400"/>

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

## Headers

- `api_token` string, required

## Request body

- object
  - `template_id` string — The ID of the template to be used for generating the campaign scenes.
  - `brand_id` string — The ID of the brand.
  - `canvas_color` string — Canvas background color in hex format.
  - `smart_image` object — 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`).
    - `main_object_url` string, required — URL of the main image that will be embedded within the smart image.
    - `background` object — Background object to determine the operation type and its associated input.
      - `operation` 'expand' | 'generate_by_text' — Choose whether to expand the existing image background or replace it by generating a new one.
      - `input` string — Background prompt or hex color for the image’s background.
  - `elements` object[] — List of text/images objects
    - `layer_type` 'text' | 'image' — The element type, either "text" or "image".
    - `content_type` string — 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` string — 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` string — Unique identifier for the element.
    - `text_configs` object — Text configs object to set text configuration to be applied to the text element
      - `highlight_color` string — Color to highlight the text.
      - `strikethrough` boolean — Strike through the text.
      - `shadow` object
        - `blur` integer — Blur amount for the text shadow.
        - `color` string — Color of the text shadow.
        - `offset` object
          - `x` number — Shadow's x-axis offset.
          - `y` number — Shadow's y-axis offset.
      - `fix_text_box` object — 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.
        - `width` number, float — The width of the text box in pixels
        - `height` number, float — The height of the text box in pixels
        - `max_font_size` number — The maximum font size to ensure that, during rescaling, the font size does not exceed this value.

## Response `200`

Campaign generated successfully.

- string[]

## Other responses

- `400` — Bad request.
- `401` — Unauthorized. Invalid API key or authentication token.
- `422` — Value error in the request body.
- `500` — Internal server error.

---

[API](https://skmtc.net/bria-ai/apis/the-bria-api.md) · [All operations](https://skmtc.net/bria-ai/apis/the-bria-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/bria-ai/the-bria-api/revisions/2768230345a5/schema)
