openapi: 3.0.0
info:
  title: Overview
  version: ''
  description: >
    Bria's Image Editing API equips builders with a comprehensive suite of tools
    for manipulating and enhancing images.


    The API provides advanced capabilities including background operations
    (removal, replacement, blur), content manipulation (eraser, generative
    fill), image transformation (expansion, resolution increase), automatic
    cropping, person modification and automatic mask generation.  



    **Asynchronous Requests and the Status Service**  


    Bria API v2 endpoints process requests asynchronously by default. When you
    make an asynchronous request, the API immediately returns a `request_id` and
    a `status_url` instead of the final result. Use the Status Service to track
    the request's progress until it reaches a completed state.  


    See the full guide at [Status Service
    Documentation](https://docs.bria.ai/status) for complete details and usage
    examples.



    **Advanced Customization and Access:**  

    As part of Bria’s **Source Code & Weights** product, developers seeking
    deeper customization can access Bria’s source-available GenAI models via
    [Hugging Face](https://huggingface.co/briaai).  

    This allows full control over fine-tuning, pipeline creation, and
    integration into proprietary workflows—empowering AI teams to develop and
    optimize their own generative AI solutions.
tags:
  - name: v2 endpoints
    description: |
      Endpoints that are part of BRIA API version 2.
  - name: v1 endpoints
    description: |
      Endpoints that are part of BRIA API version 1.
externalDocs:
  description: Register and get API Access
  url: https://platform.bria.ai/console/account/api-keys
servers:
  - url: https://engine.prod.bria-api.com/v2/image/edit
  - url: https://engine.prod.bria-api.com/v1
paths:
  /erase:
    post:
      summary: Eraser
      tags:
        - v2 endpoints
      servers:
        - url: https://engine.prod.bria-api.com/v2/image/edit
      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 <a
        href="https://github.com/Bria-AI/js-api-sdk/blob/main/manual_brush_ui"
        target="_blank">link</a>.


        2. By using the `/objects/mask_generator` route, which will generate all
        the possible masks for an image.



        **Output Characteristics**


        - The modified image is returned at the original resolution, preserving
        full visual quality without any automatic resizing or downscaling.

        - All areas outside the provided mask remain completely unchanged,
        ensuring pixel-perfect preservation of unedited regions.
      operationId: erase
      parameters:
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - image
                - mask
              properties:
                image:
                  type: string
                  description: >
                    The source image to be handled by the API.  

                    Supported input types:  

                    - **Base64-encoded string**  

                    - **URL** pointing to an image file that is publicly
                    accessible and available at the time of processing.  


                    Accepted formats: **JPEG**, **JPG**, **PNG**, **WEBP**.
                mask:
                  type: string
                  description: >
                    The binary mask image that defines the region where object
                    generation will occur.


                    **Mask Requirements**

                    - The region to generate content must have a pixel value of
                    **255 (white)**.

                    - All other areas must have a pixel value of **0 (black)**.

                    - The mask must have the **same aspect ratio** as the input
                    image.


                    **Supported Input Types**

                    - **Base64-encoded string** – provide the mask data directly
                    in the request.

                    - **URL** – provide a publicly accessible URL to the mask
                    image.


                    Accepted formats: **JPEG**, **JPG**, **PNG**, **WEBP**.


                    Ensure that any provided URL is publicly accessible at the
                    time of the request.
                mask_type:
                  type: string
                  default: manual
                  enum:
                    - manual
                    - automatic
                  description: >
                    Specifies how the input mask was created.


                    - **`manual` (default)** – Use when the mask was generated
                    by a user, for example, using a brush tool.  

                    - **`automatic`** – Use when the mask was generated by an
                    algorithm, such as **SAM** or other automated segmentation
                    methods.
                sync:
                  type: boolean
                  default: false
                  description: |
                    Specifies the response mode.
                      - When `false` (default), the request is processed asynchronously: the API immediately returns a status URL to track progress.
                      - When `true`, the request is processed synchronously: the API hold the connection open until the proccess is complete and then returns the final image URL in the response.
                visual_input_content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to input visual.


                    Expected behavior:

                    - Processing stops if the image fails moderation.

                    - Returns a 422 error with details about which parameter
                    failed.
                visual_output_content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to result visual.


                    Expected behavior:

                    - If the modified image fails moderation, returns a 422
                    error.
            examples:
              send using url:
                value:
                  image: example
                  mask: example
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SyncSuccessResponse'
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncInitialResponse'
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found. Image could not be found at the provided URL.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '415':
          description: Unsupported media type.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Request limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '460':
          description: Failed to download image.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        5XX:
          description: >
            **Internal Server Error** – A critical failure occurred in Bria's
            infrastructure, preventing the Status Service from responding.  

            - This response indicates a service outage or unexpected runtime
            failure.  

            - Check [Bria's Status Page](https://status.bria.ai) for real-time
            updates.

            - Contact [Support](mailto:support@bria.ai).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /gen_fill:
    post:
      summary: Generative Fill
      tags:
        - v2 endpoints
      servers:
        - url: https://engine.prod.bria-api.com/v2/image/edit
      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 <a
        href="https://github.com/Bria-AI/js-api-sdk/blob/main/manual_brush_ui"
        target="_blank">link</a>.



        **Output Characteristics**


        - The modified image is returned at the original resolution, preserving
        full visual quality without any automatic resizing or downscaling.

        - All areas outside the provided mask remain completely unchanged,
        ensuring pixel-perfect preservation of unedited regions.

        - If the input includes an alpha channel and `preserve_alpha=true`, the
        original transparency values (both full and partial) are maintained in
        the output.



        **Content Moderation**


        This endpoint includes granular content moderation controls to ensure
        safe usage across all stages of processing:
          
        - **Prompt Moderation** – Validates the provided prompt and rejects
        requests containing unsafe or prohibited terms before processing starts.

        - **Input Image Moderation** – Scans the uploaded image and stops
        processing if inappropriate or restricted content is detected.

        - **Output Image Moderation** – Evaluates the generated image and blocks
        the response if it violates safety guidelines.      
      operationId: gen-fill
      parameters:
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - image
                - mask
                - prompt
              properties:
                image:
                  type: string
                  description: >
                    The source image to be handled by the API.  

                    Supported input types:  

                    - **Base64-encoded string**  

                    - **URL** pointing to an image file that is publicly
                    accessible and available at the time of processing.  


                    Accepted formats: **JPEG**, **JPG**, **PNG**, **WEBP**.
                mask:
                  type: string
                  description: >
                    The binary mask image that defines the region where object
                    generation will occur.


                    **Mask Requirements**

                    - The region to generate content must have a pixel value of
                    **255 (white)**.

                    - All other areas must have a pixel value of **0 (black)**.

                    - The mask must have the **same aspect ratio** as the input
                    image.


                    **Supported Input Types**

                    - **Base64-encoded string** – provide the mask data directly
                    in the request.

                    - **URL** – provide a publicly accessible URL to the mask
                    image.


                    Accepted formats: **JPEG**, **JPG**, **PNG**, **WEBP**.


                    Ensure that any provided URL is publicly accessible at the
                    time of the request.
                mask_type:
                  type: string
                  default: manual
                  enum:
                    - manual
                    - automatic
                  description: >
                    Specifies how the input mask was created.


                    - **`manual` (default)** – Use when the mask was generated
                    by a user, for example, using a brush tool.  

                    - **`automatic`** – Use when the mask was generated by an
                    algorithm, such as **SAM** or other automated segmentation
                    methods.
                prompt:
                  type: string
                  description: >-
                    The prompt you would like to use to generate the object
                    within the masked region.
                prompt_content_moderation:
                  type: boolean
                  default: true
                  description: >
                    When enabled (default: `true`), the input prompt is
                    moderated before processing.


                    **Expected Behavior**

                    - The prompt is scanned for NSFW content and terms that
                    violate Bria’s ethical guidelines.  

                    - If the prompt fails moderation, the request is blocked and
                    the API responds with a 422 error.
                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.
                preserve_alpha:
                  type: boolean
                  default: true
                  description: >
                    Controls whether the alpha channel values from the input
                    image are retained in the output, if the input includes an
                    alpha channel.

                    - When true: The output image maintains the original
                    transparency of fully and partially transparent pixels.

                    - When false: The output image is fully opaque.

                    - Has no effect if the input image does not include an alpha
                    channel.
                sync:
                  type: boolean
                  default: false
                  description: |
                    Specifies the response mode.
                      - When `false` (default), the request is processed asynchronously: the API immediately returns a status URL to track progress.
                      - When `true`, the request is processed synchronously: the API hold the connection open until the proccess is complete and then returns the final image URL in the response.
                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.
                visual_input_content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to input visual.


                    Expected behavior:

                    - Processing stops if the image fails moderation.

                    - Returns a 422 error with details about which parameter
                    failed.
                visual_output_content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to result visual.


                    Expected behavior:

                    - If the modified image fails moderation, returns a 422
                    error.
            examples:
              send using url:
                value:
                  image: example
                  mask: example
                  prompt: textual description
      responses:
        '200':
          description: Successful operation with seed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SyncSuccessWithSeed'
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncInitialResponse'
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found. Image could not be found at the provided URL.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '415':
          description: Unsupported media type.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Request limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '460':
          description: Failed to download image.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        5XX:
          description: >
            **Internal Server Error** – A critical failure occurred in Bria's
            infrastructure, preventing the Status Service from responding.  

            - This response indicates a service outage or unexpected runtime
            failure.  

            - Check [Bria's Status Page](https://status.bria.ai) for real-time
            updates.

            - Contact [Support](mailto:support@bria.ai).

            content:
              application/json:
                schema:
                  $ref: '#/components/schemas/ErrorResponse'
  /remove_background:
    post:
      summary: Remove Background
      tags:
        - v2 endpoints
      servers:
        - url: https://engine.prod.bria-api.com/v2/image/edit
      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).



        **Content Moderation**


        This endpoint includes granular content moderation controls to ensure
        safe usage across all stages of processing:
          
        - **Input Image Moderation** – Scans the uploaded image and stops
        processing if inappropriate or restricted content is detected.

        - **Output Image Moderation** – Evaluates the generated image and blocks
        the response if it violates safety guidelines.



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



        **Transparency and Customizable Binarization**



        This endpoint returns an image where the background is removed, and the
        foreground remains with varying levels of transparency, allowing for
        smoother edges and more natural blending when placed over different
        backgrounds. Additionally, this unique output provides developers with
        the flexibility to binarize the result—transforming it into a binary
        mask—by setting a custom transparency threshold according to their
        specific use case. A binary mask is an image where pixels are either
        fully visible (foreground) or fully transparent (background), commonly
        used in visual generative AI and image processing pipelines. This
        capability enables seamless integration into workflows that require
        clear separation between subject and background, while still offering
        control over how strict this separation should be.



        Below is a simple Python script to demonstrate how you can binarize the
        output image from the API. This allows you to set your own threshold to
        determine which areas are considered "foreground" and which are
        "background."

          ```python
          from PIL import Image
          import numpy as np

          # Load the image (the output from the API)
          image = Image.open('output_image.png').convert('RGBA')

          # Convert to numpy array
          data = np.array(image)

          # Define your threshold (0-255, where 255 is fully opaque)
          threshold = 128

          # Apply the threshold: if alpha > threshold, set to fully opaque (255), otherwise transparent (0)
          data[:, :, 3] = np.where(data[:, :, 3] > threshold, 255, 0)

          # Create a new Image from the modified array
          binarized_image = Image.fromarray(data)

          # Save or display
          binarized_image.save('binarized_output.png')
          binarized_image.show()
            ```
      operationId: background-remove
      parameters:
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - image
              properties:
                image:
                  type: string
                  description: >
                    The image that you would like to remove the background from.

                    Supported input types:  

                    - **Base64-encoded string**  

                    - **URL** pointing to an image file that is publicly
                    accessible and available at the time of processing.  


                    Accepted formats: **JPEG**, **JPG**, **PNG**, **WEBP**.
                preserve_alpha:
                  type: boolean
                  default: true
                  description: >
                    Controls whether partially transparent areas from the input
                    image are retained in the output after background removal,
                    if the input includes an alpha channel.

                    - When true: Partially transparent pixels preserve their
                    original alpha values in the output.

                    - When false: All non-background areas in the output are
                    rendered fully opaque.

                    - Has no effect if the input image does not include an alpha
                    channel.
                sync:
                  type: boolean
                  default: false
                  description: |
                    Specifies the response mode.
                      - When `false` (default), the request is processed asynchronously: the API immediately returns a status URL to track progress.
                      - When `true`, the request is processed synchronously: the API hold the connection open until the proccess is complete and then returns the final image URL in the response.
                visual_input_content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to input visual.


                    Expected behavior:

                    - Processing stops if the image fails moderation.

                    - Returns a 422 error with details about which parameter
                    failed.
                visual_output_content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to result visual.


                    Expected behavior:

                    - If the modified image fails moderation, returns a 422
                    error.
            examples:
              send using url:
                value:
                  image: example
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SyncSuccessResponse'
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncInitialResponse'
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found. Image could not be found at the provided URL.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '415':
          description: Unsupported media type.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Request limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '460':
          description: Failed to download image.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        5XX:
          description: >
            **Internal Server Error** – A critical failure occurred in Bria's
            infrastructure, preventing the Status Service from responding.  

            - This response indicates a service outage or unexpected runtime
            failure.  

            - Check [Bria's Status Page](https://status.bria.ai) for real-time
            updates. 

            - Contact [Support](mailto:support@bria.ai). 
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /replace_background:
    post:
      summary: Generate Background
      tags:
        - v2 endpoints
      servers:
        - url: https://engine.prod.bria-api.com/v2/image/edit
      description: "\n\n**Description**\n\n\n\nThe\_*Replace BG Route*\_is used to replace the background of any image.\n\n\nWe offer a fast version of this feature, powered by Bria 2.3 Fast LoRA (<a href=\"https://huggingface.co/briaai/BRIA-2.3-FAST-LORA\" target=\"_blank\">model card on Hugging Face</a>), which provides an optimal balance between speed and quality.\n\n\nThis endpoint also allows replacing the background with a solid color of your choice. You can specify a hex color code (e.g., #FF5733) in the prompt to control the background color.\n\n\nHere are some examples:\n\n\n**original image**: \n\n\n<img src=\"https://i.ibb.co/n6JtktM/unnamed-13.jpg\" width=\"200\"/>\n\n\n**prompt**: in a parking lot\n        \n\n\n**result**:\n\n\n<img src=\"https://i.ibb.co/1zvT5h4/unnamed-14.jpg\" width=\"200\"/>\n\n\n**Content Moderation**\n\nThis endpoint includes granular content moderation controls to ensure safe usage across all stages of processing:\n\n- **Prompt Moderation** – Validates the provided prompt and rejects requests containing unsafe or prohibited terms before processing starts.\n- **Input Image Moderation** – Scans the uploaded image and stops processing if inappropriate or restricted content is detected.\n- **Output Image Moderation** – Evaluates the generated image and blocks the response if it violates safety guidelines."
      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
              required:
                - image
              properties:
                image:
                  type: string
                  description: >
                    The image that you would like to remove the background from.

                    Supported input types:  

                    - **Base64-encoded string**  

                    - **URL** pointing to an image file that is publicly
                    accessible and available at the time of processing.  


                    Accepted formats: **JPEG**, **JPG**, **PNG**, **WEBP**.
                ref_images:
                  type: string
                  description: >
                    One or more reference images to guide the background
                    generation.  


                    **Supported Input Types**  

                    - **Base64-encoded string** – provide the image data
                    directly in the request.  

                    - **URL** – provide a publicly accessible URL to the
                    image.  

                    - **List** – multiple images can be supplied as a list of
                    Base64 strings or URLs.  


                    **Usage Constraints**  

                    - You must provide **either** `ref_images` **or** `prompt`,
                    but not both.  

                    - Accepted formats: **JPEG**, **JPG**, **PNG**, **WEBP**.  


                    All provided images must be accessible and in a supported
                    format at the time of processing.
                enhance_ref_images:
                  type: boolean
                  default: true
                  description: >-
                    When set to true, additional logic processes the included
                    reference image to make adjustments for optimal results.
                prompt:
                  type: string
                  description: >-
                    Text description of the new scene or background for the
                    provided image. Either ref_images or 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 prompt that was
                    included and adjusts it to achieve optimal results.
                prompt_content_moderation:
                  type: boolean
                  default: true
                  description: >
                    When enabled (default: `true`), the input prompt is
                    moderated before processing.


                    **Expected Behavior**

                    - The prompt is scanned for NSFW content and terms that
                    violate Bria’s ethical guidelines.  

                    - If the prompt fails moderation, the request is blocked and
                    the API responds with a 422 error.
                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.
                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.
                force_background_detection:
                  type: boolean
                  default: false
                  description: >-
                    When `true`, forces background detection and removal, even
                    if the original image already contains an alpha channel.
                    Useful for refining existing foreground/background
                    separation or ignoring unnecessary alpha channels.
                sync:
                  type: boolean
                  default: false
                  description: |
                    Specifies the response mode.
                      - When `false` (default), the request is processed asynchronously: the API immediately returns a status URL to track progress.
                      - When `true`, the request is processed synchronously: the API hold the connection open until the proccess is complete and then returns the final image URL in the response.
                fast:
                  type: boolean
                  default: false
                  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.
                visual_input_content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to input visual.


                    Expected behavior:

                    - Processing stops if the image fails moderation.

                    - Returns a 422 error with details about which parameter
                    failed.
                visual_output_content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to result visual.


                    Expected behavior:

                    - If the modified image fails moderation, returns a 422
                    error. 
                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:
              image: example
              prompt: in a living room interior, on a kitchen counter
      responses:
        '200':
          description: >-
            Successful operation (sync) with seed and conditional refined prompt
            in result.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SyncSuccessWithSeedAndRefinedPrompt'
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncInitialResponse'
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found. Image could not be found at the provided URL.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '415':
          description: Unsupported media type.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Request limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '460':
          description: Failed to download image.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        5XX:
          description: >
            **Internal Server Error** – A critical failure occurred in Bria's
            infrastructure, preventing the Status Service from responding.  

            - This response indicates a service outage or unexpected runtime
            failure.  

            - Check [Bria's Status Page](https://status.bria.ai) for real-time
            updates.  

            - Contact [Support](mailto:support@bria.ai).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /erase_foreground:
    post:
      summary: Erase Foreground
      tags:
        - v2 endpoints
      servers:
        - url: https://engine.prod.bria-api.com/v2/image/edit
      description: >


        **Description**




        The **Erase Foreground** endpoint removes the primary subject
        (foreground) from the input image and intelligently generates the
        background to fill the erased area.  


        **Output Characteristics**  

        - Returns the edited image at its original resolution, ensuring full
        visual fidelity without any automatic resizing or downscaling.  

        - Only the foreground is removed; all other areas remain unaltered,
        preserving pixel-perfect accuracy in untouched regions.  

        - When `preserve_alpha=true` and the input image includes an alpha
        channel, the output maintains original transparency values (both full
        and partial).  




         **Content Moderation**

        This endpoint includes granular content moderation controls to ensure
        safe usage across all stages of processing:


        - **Input Image Moderation** – Scans the uploaded image and stops
        processing if inappropriate or restricted content is detected.

        - **Output Image Moderation** – Evaluates the generated image and blocks
        the response if it violates safety guidelines.
      operationId: erase-foreground
      parameters:
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - image
              properties:
                image:
                  type: string
                  description: >
                    The image that you would like to remove the background from.

                    Supported input types:  

                    - **Base64-encoded string**  

                    - **URL** pointing to an image file that is publicly
                    accessible and available at the time of processing.  


                    Accepted formats: **JPEG**, **JPG**, **PNG**, **WEBP**.
                preserve_alpha:
                  type: boolean
                  default: true
                  description: >
                    Controls whether the alpha channel values from the input
                    image are retained in the output, if the input includes an
                    alpha channel.

                    - When true: The output image maintains the original
                    transparency of fully and partially transparent pixels.

                    - When false: The output image is fully opaque.

                    - Has no effect if the input image does not include an alpha
                    channel.
                sync:
                  type: boolean
                  default: false
                  description: |
                    Specifies the response mode.
                      - When `false` (default), the request is processed asynchronously: the API immediately returns a status URL to track progress.
                      - When `true`, the request is processed synchronously: the API hold the connection open until the proccess is complete and then returns the final image URL in the response.
                visual_input_content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to input visual.


                    Expected behavior:

                    - Processing stops if the image fails moderation.

                    - Returns a 422 error with details about which parameter
                    failed.
                visual_output_content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to result visual.


                    Expected behavior:

                    - If the modified image fails moderation, returns a 422
                    error. 
              example:
                image_url: example
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SyncSuccessResponse'
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncInitialResponse'
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found. Image could not be found at the provided URL.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '415':
          description: Unsupported media type.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Request limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '460':
          description: Failed to download image.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        5XX:
          description: >
            **Internal Server Error** – A critical failure occurred in Bria's
            infrastructure, preventing the Status Service from responding.  

            - This response indicates a service outage or unexpected runtime
            failure.  

            - Check [Bria's Status Page](https://status.bria.ai) for real-time
            updates.  

            - Contact [Support](mailto:support@bria.ai).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /blur_background:
    post:
      summary: Blur Background
      tags:
        - v2 endpoints
      servers:
        - url: https://engine.prod.bria-api.com/v2/image/edit
      description: "\n\n**Description**\n\n\n\nThe\_*background/blur Route*\_is used to create a blur effect on the background of an image. \n\n**Content Moderation**\n\nThis endpoint includes granular content moderation controls to ensure safe usage across all stages of processing:\n\n- **Input Image Moderation** – Scans the uploaded image and stops processing if inappropriate or restricted content is detected.\n- **Output Image Moderation** – Evaluates the generated image and blocks the response if it violates safety guidelines."
      operationId: blur-bg
      parameters:
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - image
              properties:
                image:
                  type: string
                  description: >
                    The source image to be handled by the API.  

                    Supported input types:  

                    - **Base64-encoded string**  

                    - **URL** pointing to an image file that is publicly
                    accessible and available at the time of processing.  


                    Accepted formats: **JPEG**, **JPG**, **PNG**, **WEBP**.
                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.
                preserve_alpha:
                  type: boolean
                  default: true
                  description: >
                    Controls whether the alpha channel values from the input
                    image are retained in the output, if the input includes an
                    alpha channel.

                    - When true: The output image maintains the original
                    transparency of fully and partially transparent pixels.

                    - When false: The output image is fully opaque.

                    - Has no effect if the input image does not include an alpha
                    channel.
                sync:
                  type: boolean
                  default: false
                  description: |
                    Specifies the response mode.
                      - When `false` (default), the request is processed asynchronously: the API immediately returns a status URL to track progress.
                      - When `true`, the request is processed synchronously: the API hold the connection open until the proccess is complete and then returns the final image URL in the response.
                visual_input_content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to input visual.


                    Expected behavior:

                    - Processing stops if the image fails moderation.

                    - Returns a 422 error with details about which parameter
                    failed.
                visual_output_content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to result visual.


                    Expected behavior:

                    - If the modified image fails moderation, returns a 422
                    error.
            examples:
              using_url:
                summary: Remove background using URL
                value:
                  image: example
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SyncSuccessResponse'
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncInitialResponse'
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found. Image could not be found at the provided URL.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '415':
          description: Unsupported media type.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Request limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '460':
          description: Failed to download image.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        5XX:
          description: >
            **Internal Server Error** – A critical failure occurred in Bria's
            infrastructure, preventing the Status Service from responding.  

            - This response indicates a service outage or unexpected runtime
            failure.  

            - Check [Bria's Status Page](https://status.bria.ai) for real-time
            updates.  

            - Contact [Support](mailto:support@bria.ai).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /expand:
    post:
      summary: Expand Image
      tags:
        - v2 endpoints
      servers:
        - url: https://engine.prod.bria-api.com/v2/image/edit
      description: "\n\n**Description**\n\n\n\nThe\_*Image Expension Route*\_can be used to expand an image, by utilizing generative AI.\n\n\nYou 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.\n\n\nAlternatively, you can define a desired aspect_ratio, and the service will automatically place the input image in the center and expand the canvas to match that ratio.\n\n\nIn this way, you can create unique variations of your original image instead of cropping it into different aspect ratios and losing important details.\n\n\nIf aspect_ratio is not provided, both original_image_size and original_image_location must be specified.\n\n\n\n**Optimal input range**\n\n\n***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.\n\n\n***Canvas Size:*** The canvas size should be up to an area of 5000x5000 pixels.\n\n\n***Prompt:*** This parameter is optional. If not provided or left empty, the service will automatically generate a prompt based on the input image.\n\n\n**Alpha Channel Handling**\n\n\n- If the input image includes an alpha channel and `preserve_alpha=true`, newly generated pixels inherit the alpha values of the nearest original pixels along the same row or column, ensuring smooth transparency transitions.\n\n\n- If the input image contains fully transparent pixels along any edge (top, bottom, left, or right), the request is rejected with a 422 error. Expansion is not supported in such cases to avoid undefined transparency behavior.\n\n\n\nHere are some examples:\n\n\n**original image (Generated by Bria)**: \n\n\n<img src=\"https://bria-image-repository.s3.amazonaws.com/images/caeaa19524d69ad6.jpg\" width=\"200\"/>\n\n\n**results**:\n\n\n<img src=\"https://bria-image-repository.s3.amazonaws.com/images/d4d49719b5a54e49.jpg\" width=\"400\"/> <img src=\"https://bria-image-repository.s3.amazonaws.com/images/cbf61f2b859662c0.jpg\" width=\"200\"/>\n<img src=\"https://bria-image-repository.s3.amazonaws.com/images/aa9b3036e5c6d43a.jpg\" width=\"600\"/> \n\n\n **original image (Stock Image)**: \n\n\n<img src=\"https://bria-image-repository.s3.amazonaws.com/images/c64220ebda5ce787.jpg\" width=\"200\"/>\n\n\n**results**:\n\n\n<img src=\"https://bria-image-repository.s3.amazonaws.com/images/d35530e95ab7c509.jpg\" width=\"400\"/> <img src=\"https://bria-image-repository.s3.amazonaws.com/images/84752d2fca8a6ae3.jpg\" width=\"200\"/>\n<img src=\"https://bria-image-repository.s3.amazonaws.com/images/904f62b0dce4fb8c.jpg\" width=\"600\"/> \n\n\n\n **Content Moderation**\n\n  This endpoint includes granular content moderation controls to ensure safe usage across all stages of processing:\n\n  - **Prompt Moderation** – Validates the provided prompt and rejects requests containing unsafe or prohibited terms before processing starts.\n  - **Input Image Moderation** – Scans the uploaded image and stops processing if inappropriate or restricted content is detected.\n  - **Output Image Moderation** – Evaluates the generated image and blocks the response if it violates safety guidelines."
      operationId: image-expansion
      parameters:
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - image
              properties:
                image:
                  type: string
                  description: >
                    The source image to be handled by the API.  

                    Supported input types:  

                    - **Base64-encoded string**  

                    - **URL** pointing to an image file that is publicly
                    accessible and available at the time of processing.  


                    Accepted formats: **JPEG**, **JPG**, **PNG**, **WEBP**.
                aspect_ratio:
                  type:
                    - string
                    - number
                  description: >
                    Automatically expands or crops the input image to the
                    specified aspect ratio.


                    Either `aspect_ratio` or the combination of
                    `original_image_size` and `original_image_location` must be
                    provided.


                    When provided, `canvas_size`, `original_image_size`, and
                    `original_image_location` are ignored.


                    Centers the input image, expanding edges to reach the target
                    ratio.


                    Accepts either:

                    - A predefined string: "1:1", "2:3", "3:2", "3:4", "4:3",
                    "4:5", "5:4", "9:16", "16:9"

                    - A custom float between 0.5 and 3.0


                    If the target ratio equals the input image’s current ratio,
                    no changes are made.


                    If the computed final dimensions exceed 5000×5000 px in
                    total area, the input image is automatically resized so the
                    area stays within limits.
                canvas_size:
                  type: array
                  items:
                    type: integer
                  default:
                    - 1000
                    - 1000
                  description: >
                    Desired output canvas dimensions (width, height). Defaults
                    to [1000, 1000] if not provided.

                    Ignored when `aspect_ratio` is used.

                    Maximum allowed area is 25M pixels (i.e., width × height ≤
                    5,000 × 5,000). Exceeding this returns a 400 error.
                original_image_size:
                  type: array
                  items:
                    type: integer
                  description: >
                    The desired size of the original image inside the final
                    canvas, as `[width, height]` in pixels.

                    Ensure that the visible part of the input image (foreground
                    or main subject) occupies more than 15% of the total canvas
                    area for optimal results.

                    This field is required when `aspect_ratio` is not provided.

                    Must be used together with `original_image_location`.
                original_image_location:
                  type: array
                  items:
                    type: integer
                  description: >
                    The position of the top-left corner of the original image
                    within the final canvas, provided as `[x, y]` in pixels.

                    This defines where the input image will be placed before
                    expansion occurs.

                    The values can be outside the canvas bounds—if so, the image
                    will be cropped accordingly.

                    Required when `aspect_ratio` is not provided.

                    Must be used together with `original_image_size`.
                prompt:
                  type: string
                  description: >
                    Optional text prompt to guide the image expansion.

                    If not provided or left empty, a prompt will be
                    automatically generated as part of the service based on the
                    input image.

                    Currently, Bria supports prompts in English only and does
                    not support special characters.
                prompt_content_moderation:
                  type: boolean
                  default: true
                  description: >
                    When enabled (default: `true`), the input prompt is
                    moderated before processing.


                    **Expected Behavior**

                    - The prompt is scanned for NSFW content and terms that
                    violate Bria’s ethical guidelines.  

                    - If the prompt fails moderation, the request is blocked and
                    the API responds with a 422 error.
                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. Currently, Bria supports prompts
                    in English only and does not support special characters.
                preserve_alpha:
                  type: boolean
                  default: true
                  description: >
                    Controls whether the alpha channel values from the input
                    image are retained in the output, if the input includes an
                    alpha channel.

                    - When true: The output image maintains the original
                    transparency of fully and partially transparent pixels.

                    - When false: The output image is fully opaque.

                    - Has no effect if the input image does not include an alpha
                    channel.
                sync:
                  type: boolean
                  default: false
                  description: |
                    Specifies the response mode.
                      - When `false` (default), the request is processed asynchronously: the API immediately returns a status URL to track progress.
                      - When `true`, the request is processed synchronously: the API hold the connection open until the proccess is complete and then returns the final image URL in the response.
                visual_input_content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to input visual.


                    Expected behavior:

                    - Processing stops if the image fails moderation.

                    - Returns a 422 error with details about which parameter
                    failed.
                visual_output_content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to result visual.


                    Expected behavior:

                    - If the modified image fails moderation, returns a 422
                    error.
            examples:
              Aspect Ratio:
                value:
                  image: example
                  aspect_ratio: '2:3'
              Precise location, Canvas size in pixels:
                value:
                  image: example
                  canvas_size:
                    - 1200
                    - 674
                  original_image_size:
                    - 610
                    - 855
                  original_image_location:
                    - 301
                    - -66
      responses:
        '200':
          description: Successful operation (sync) with seed and prompt inside result.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SyncSuccessWithSeedAndPrompt'
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncInitialResponse'
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found. Image could not be found at the provided URL.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '415':
          description: Unsupported media type.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Request limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '460':
          description: Failed to download image.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        5XX:
          description: >
            **Internal Server Error** – A critical failure occurred in Bria's
            infrastructure, preventing the Status Service from responding.  

            - This response indicates a service outage or unexpected runtime
            failure.  

            - Check [Bria's Status Page](https://status.bria.ai) for real-time
            updates.  

            - Contact [Support](mailto:support@bria.ai).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /enhance:
    post:
      summary: Enhance Image
      tags:
        - v2 endpoints
      servers:
        - url: https://engine.prod.bria-api.com/v2/image/edit
      description: >-
        **Description**


        The `/enhance_image` endpoint improves the visual quality of an input
        image by generating richer details, sharper textures, and enhanced
        clarity. 

        It also supports upscaling to higher resolutions and returns a refined
        version of the original visual. 



        **Content Moderation**


        This endpoint includes granular content moderation controls to ensure
        safe usage across all stages of processing:


        - **Input Image Moderation** – Scans the uploaded image and stops
        processing if inappropriate or restricted content is detected.

        - **Output Image Moderation** – Evaluates the generated image and blocks
        the response if it violates safety guidelines.



        Unlike the [Increase
        Resolution](https://docs.bria.ai/image-editing-v2/v2-endpoints/increase-resolution)
        route, this endpoint regenerates the image to enhance visual richness
        while preserving essential details.
      operationId: enhance
      parameters:
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - image
              properties:
                image:
                  type: string
                  description: >
                    The source image to be handled by the API.  

                    Supported input types:  

                    - **Base64-encoded string**  

                    - **URL** pointing to an image file that is publicly
                    accessible and available at the time of processing.  


                    Accepted formats: **JPEG**, **JPG**, **PNG**, **WEBP**.
                sync:
                  type: boolean
                  default: false
                  description: |
                    Specifies the response mode.
                      - When `false` (default), the request is processed asynchronously: the API immediately returns a status URL to track progress.
                      - When `true`, the request is processed synchronously: the API hold the connection open until the proccess is complete and then returns the final image URL in the response.
                visual_input_content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to input visual.


                    Expected behavior:

                    - Processing stops if the image fails moderation.

                    - Returns a 422 error with details about which parameter
                    failed.
                visual_output_content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to result visual.


                    Expected behavior:

                    - If the modified image fails moderation, returns a 422
                    error.
                seed:
                  type: integer
                  description: >
                    Optional seed for controlling generation randomness. You can
                    recreate the same result in the future by using the same
                    seed with the same input parameters.
                steps_num:
                  type: integer
                  default: 20
                  minimum: 10
                  maximum: 50
                  description: >-
                    Number of enhancement steps. Higher values improve quality
                    but increase processing time. Most quality gains occur
                    within the first 20 steps.
                resolution:
                  type: string
                  enum:
                    - 1MP
                    - 2MP
                    - 4MP
                  default: 1MP
                  description: Target output resolution of the enhanced image.
                preserve_alpha:
                  type: boolean
                  default: true
                  description: >
                    Controls whether the alpha channel values from the input
                    image are retained in the output, if the input includes an
                    alpha channel.

                    - When true: The output image maintains the original
                    transparency of fully and partially transparent pixels.

                    - When false: The output image is fully opaque.

                    - Has no effect if the input image does not include an alpha
                    channel.
            examples:
              valid request:
                value:
                  image: example
                  resolution: 2MP
      responses:
        '200':
          description: Successful operation with seed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SyncSuccessWithSeed'
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncInitialResponse'
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found. Image could not be found at the provided URL.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '415':
          description: Unsupported media type.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Request limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '460':
          description: Failed to download image.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        5XX:
          description: >
            **Internal Server Error** – A critical failure occurred in Bria's
            infrastructure, preventing the Status Service from responding.  

            - This response indicates a service outage or unexpected runtime
            failure.  

            - Check [Bria's Status Page](https://status.bria.ai) for real-time
            updates.  

            - Contact [Support](mailto:support@bria.ai).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /increase_resolution:
    post:
      summary: Increase Resolution
      tags:
        - v2 endpoints
      servers:
        - url: https://engine.prod.bria-api.com/v2/image/edit
      description: "\n\n**Description**\n\n\n\nThe\_*Increase Resolution Route*\_is used to upscale the resolution of any image.\n\n\n**Content Moderation**\n\nThis endpoint includes granular content moderation controls to ensure safe usage across all stages of processing:\n\n- **Input Image Moderation** – Scans the uploaded image and stops processing if inappropriate or restricted content is detected.\n- **Output Image Moderation** – Evaluates the generated image and blocks the response if it violates safety guidelines.\n\n**Constraints**\n\n\nThe 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. \n\n\nIt's possible to increase the resolution of an image up to a total area of 8192x8192 pixels.\n\n\nUnlike the [Enhance Image](https://docs.bria.ai/image-editing/endpoints/enhance-image) route, this endpoint does not add new details — it increases resolution using a dedicated upscaling method that preserves the original image content without regeneration."
      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/json:
            schema:
              type: object
              required:
                - image
              properties:
                image:
                  type: string
                  description: >
                    The source image to be handled by the API.  

                    Supported input types:  

                    - **Base64-encoded string**  

                    - **URL** pointing to an image file that is publicly
                    accessible and available at the time of processing.  


                    Accepted formats: **JPEG**, **JPG**, **PNG**, **WEBP**.
                preserve_alpha:
                  type: boolean
                  default: true
                  description: >
                    Controls whether the alpha channel values from the input
                    image are retained in the output, if the input includes an
                    alpha channel.

                    - When true: The output image maintains the original
                    transparency of fully and partially transparent pixels.

                    - When false: The output image is fully opaque.

                    - Has no effect if the input image does not include an alpha
                    channel.
                desired_increase:
                  type: integer
                  default: 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.
                sync:
                  type: boolean
                  default: false
                  description: >
                    Specifies the response mode.
                      - When `false` (default), the request is processed asynchronously: the API immediately returns a status URL to track progress.
                      - When `true`, the request is processed synchronously: the API hold the connection open until the proccess is complete and then returns the final image URL in the response.

                    **Note**: When sync=true, the input image must not exceed 2
                    megapixels. Requests exceeding this limit will return a 422
                    error.
                visual_input_content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to input visual.


                    Expected behavior:

                    - Processing stops if the image fails moderation.

                    - Returns a 422 error with details about which parameter
                    failed.
                visual_output_content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to result visual.


                    Expected behavior:

                    - If the modified image fails moderation, returns a 422
                    error.
            example:
              image: example
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SyncSuccessResponse'
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncInitialResponse'
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found. Image could not be found at the provided URL.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '415':
          description: Unsupported media type.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Request limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '460':
          description: Failed to download image.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        5XX:
          description: >
            **Internal Server Error** – A critical failure occurred in Bria's
            infrastructure, preventing the Status Service from responding.  

            - This response indicates a service outage or unexpected runtime
            failure.  

            - Check [Bria's Status Page](https://status.bria.ai) for real-time
            updates.  

            - Contact [Support](mailto:support@bria.ai).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /crop_foreground:
    post:
      summary: Crop out foreground
      tags:
        - v2 endpoints
      servers:
        - url: https://engine.prod.bria-api.com/v2/image/edit
      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.


        **Content Moderation**


        This endpoint includes granular content moderation controls to ensure
        safe usage across all stages of processing:


        - **Input Image Moderation** – Scans the uploaded image and stops
        processing if inappropriate or restricted content is detected.

        - **Output Image Moderation** – Evaluates the generated image and blocks
        the response if it violates safety guidelines.
      operationId: crop
      parameters:
        - in: header
          name: api_token
          schema:
            type: string
          required: true
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              required:
                - image
              properties:
                image:
                  type: string
                  description: >
                    The source image to be handled by the API.  

                    Supported input types:  

                    - **Base64-encoded string**  

                    - **URL** pointing to an image file that is publicly
                    accessible and available at the time of processing.  


                    Accepted formats: **JPEG**, **JPG**, **PNG**, **WEBP**.
                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_background_detection:
                  type: boolean
                  default: false
                  description: >-
                    When `true`, forces background detection and removal, even
                    if the original image already contains an alpha channel.
                    Useful for refining existing foreground/background
                    separation or ignoring unnecessary alpha channels.
                preserve_alpha:
                  type: boolean
                  default: true
                  description: >
                    Controls whether the alpha channel values from the input
                    image are retained in the output, if the input includes an
                    alpha channel.

                    - When true: The output image maintains the original
                    transparency of fully and partially transparent pixels.

                    - When false: The transparency values from the input are not
                    preserved, but the output may still include an alpha channel
                    (e.g., around the cropped area).

                    - Has no effect if the input image does not include an alpha
                    channel.
                sync:
                  type: boolean
                  default: false
                  description: |
                    Specifies the response mode.
                      - When `false` (default), the request is processed asynchronously: the API immediately returns a status URL to track progress.
                      - When `true`, the request is processed synchronously: the API hold the connection open until the proccess is complete and then returns the final image URL in the response.
                visual_input_content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to input visual.


                    Expected behavior:

                    - Processing stops if the image fails moderation.

                    - Returns a 422 error with details about which parameter
                    failed.
                visual_output_content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to result visual.


                    Expected behavior:

                    - If the modified image fails moderation, returns a 422
                    error.
            example:
              image: example
      responses:
        '200':
          description: Successful operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SyncSuccessResponse'
        '202':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncInitialResponse'
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not found. Image could not be found at the provided URL.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '415':
          description: Unsupported media type.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Request limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '460':
          description: Failed to download image.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        5XX:
          description: >
            **Internal Server Error** – A critical failure occurred in Bria's
            infrastructure, preventing the Status Service from responding.  

            - This response indicates a service outage or unexpected runtime
            failure.  

            - Check [Bria's Status Page](https://status.bria.ai) for real-time
            updates.  

            - Contact [Support](mailto:support@bria.ai).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /{visual_id}/image_to_psd:
    post:
      summary: Delayer Image
      tags:
        - v1 endpoints
      servers:
        - url: https://engine.prod.bria-api.com/v1
      description: "\n\n**Description**\n\n***Note: This API route requires the image to be registered via the `/register` route.***\n**It will be replaced soon with isolated version, that doesn't require image registration.**\n\n\nThe\_*Image to PSD Route*\_is used to create a layered PSD file from any image.\n\nThe 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. \n\nYou 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.
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: string
              examples:
                quota_exceeded:
                  value: >-
                    Quota exceeded: Free users can make up to 1000 requests in
                    total. Please upgrade your plan to continue using the
                    service.
                access_denied:
                  value: >-
                    Access denied: Your subscription does not include access to
                    this feature/product.
        '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.
  /objects/mask_generator:
    post:
      summary: Get Masks
      tags:
        - v1 endpoints
      servers:
        - url: https://engine.prod.bria-api.com/v1
      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 <a
        href="https://github.com/Bria-AI/js-api-sdk/blob/50a062867092788aaa9612f2cc69f7692567115a/mask_hover_ui"
        target="_blank">link</a>.

        This API endpoint supports content moderation via an optional parameter
        that can prevent processing if input images contain inappropriate
        content - the first blocked input image will fail the entire request.
      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.
                sync:
                  type: boolean
                  default: true
                  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.
                content_moderation:
                  type: boolean
                  default: false
                  description: >
                    When enabled, applies content moderation to input visuals.


                    For input images:

                    - Processing stops at the first image that fails moderation

                    - Returns a 422 error with details about which parameter
                    failed
            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.
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: string
              examples:
                quota_exceeded:
                  value: >-
                    Quota exceeded: Free users can make up to 1000 requests in
                    total. Please upgrade your plan to continue using the
                    service.
                access_denied:
                  value: >-
                    Access denied: Your subscription does not include access to
                    this feature/product.
        '405':
          description: Method not allowed.
        '422':
          description: Unprocessable Entity.
          content:
            application/json:
              schema:
                type: string
              examples:
                input_violation:
                  value: >-
                    The request could not be completed because the visual in the
                    '{parameter_name}' parameter did not pass content
                    moderation.
                invalid_image:
                  value: 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.
        '506':
          description: Insufficient data. The given input is not supported by the Bria API.
  /{visual_id}/person/info:
    get:
      summary: Get Presenter info
      tags:
        - v1 endpoints
      servers:
        - url: https://engine.prod.bria-api.com/v1
      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": null
                      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": null
                    - 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": null
                      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": null
        '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.
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: string
              examples:
                quota_exceeded:
                  value: >-
                    Quota exceeded: Free users can make up to 1000 requests in
                    total. Please upgrade your plan to continue using the
                    service.
                access_denied:
                  value: >-
                    Access denied: Your subscription does not include access to
                    this feature/product.
        '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:
      summary: Modify Presenter
      tags:
        - v1 endpoints
      servers:
        - url: https://engine.prod.bria-api.com/v1
      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.
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: string
              examples:
                quota_exceeded:
                  value: >-
                    Quota exceeded: Free users can make up to 1000 requests in
                    total. Please upgrade your plan to continue using the
                    service.
                access_denied:
                  value: >-
                    Access denied: Your subscription does not include access to
                    this feature/product.
        '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.
components:
  schemas:
    ErrorObject:
      type: object
      properties:
        code:
          type: integer
          example: 123
        message:
          type: string
        details:
          type: string
      required:
        - code
        - message
        - details
    ErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ErrorObject'
        request_id:
          type: string
      required:
        - error
        - request_id
    SyncSuccessResponse:
      type: object
      properties:
        result:
          type: object
          properties:
            image_url:
              type: string
          required:
            - image_url
        request_id:
          type: string
      required:
        - result
        - request_id
    AsyncInitialResponse:
      type: object
      properties:
        request_id:
          type: string
        status_url:
          type: string
      required:
        - request_id
        - status_url
    SyncSuccessWithSeed:
      allOf:
        - $ref: '#/components/schemas/SyncSuccessResponse'
        - type: object
          properties:
            result:
              allOf:
                - $ref: '#/components/schemas/SyncSuccessResponse/properties/result'
                - type: object
                  properties:
                    seed:
                      type: string
    SyncSuccessWithSeedAndRefinedPrompt:
      allOf:
        - $ref: '#/components/schemas/SyncSuccessResponse'
        - type: object
          properties:
            result:
              allOf:
                - $ref: '#/components/schemas/SyncSuccessResponse/properties/result'
                - type: object
                  properties:
                    seed:
                      type: integer
                    refined_prompt:
                      type: string
                      description: |
                        Refined version of the input prompt.
                        **Returned only when:**
                        - The request included a `prompt` parameter.
                        - The request did NOT include a `reference_image`.
    SyncSuccessWithSeedAndPrompt:
      allOf:
        - $ref: '#/components/schemas/SyncSuccessResponse'
        - type: object
          properties:
            result:
              allOf:
                - $ref: '#/components/schemas/SyncSuccessResponse/properties/result'
                - type: object
                  properties:
                    seed:
                      type: integer
                    prompt:
                      type: string
                      description: Original prompt sent by the user.
    StatusSuccessResponse:
      type: object
      properties:
        result:
          type: object
          properties:
            image_url:
              type: string
          required:
            - image_url
        status:
          type: string
          enum:
            - COMPLETED
        request_id:
          type: string
      required:
        - result
        - status
        - request_id
    StatusErrorResponse:
      allOf:
        - $ref: '#/components/schemas/ErrorResponse'
        - type: object
          properties:
            status:
              type: string
              enum:
                - FAILED
          required:
            - status
