BRIA-Eraser-API-azalh / image-editing.json
ALIMHGFY's picture
Upload image-editing.json
21466fa verified
{
"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.\n\nThe 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. \n\n**Advanced Customization and Access:** \nAs 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). \nThis 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.\n"
},
"externalDocs": {
"description": "Register and get API Access",
"url": "https://platform.bria.ai/console/account/api-keys"
},
"servers": [
{
"url": "https://engine.prod.bria-api.com/v1"
}
],
"paths": {
"/eraser": {
"post": {
"summary": "Eraser",
"tags": [
"Endpoints"
],
"description": "\n**Description**\n\nThe *Eraser Route* enables the removal of elements or specific areas from a given image.\n\nYou 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:\n1. 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>.\n2. By using the `/objects/mask_generator` route, which will generate all the possible masks for an image.\n\nThis API endpoint supports content moderation via an optional parameter that can prevent processing if input images contain inappropriate content or if the modified output would contain inappropriate content.",
"operationId": "eraser",
"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."
},
"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."
},
"mask_url": {
"type": "string",
"description": "The URL of the binary mask image that represents the area that will be cleaned. If both mask_url and mask_file are provided, mask_url will be used. Accepted formats - jpeg, jpg, png, webp. The area to be removed should have the value 255 (white), while the rest of the image should have the value 0 (black). **Note:** The input image and mask must have the same aspect ratio."
},
"mask_file": {
"type": "string",
"description": "The file of the binary mask image that represents the area that will be cleaned, in base64 format. This parameter is used if mask_url is not provided. Accepted formats - jpeg, jpg, png, webp. The area to be removed should have the value 255 (white), while the rest of the image should have the value 0 (black). **Note:** The input image and mask must have the same aspect ratio."
},
"mask_type": {
"type": "string",
"default": "manual",
"description": "You can use this parameter to specify the type of the input mask from the list. 'manual' opttion should be used in cases in which the mask had been generated by a user (e.g. with a brush tool), and 'automatic' mask type should be used when mask had been generated by an algorithm like 'SAM'.",
"enum": [
"manual",
"automatic"
]
},
"content_moderation": {
"type": "boolean",
"default": false,
"description": "When enabled, applies content moderation to both input visuals and modified outputs.\n\nFor input images:\n- Processing stops if the image fails moderation\n- Returns a 422 error with details about which parameter failed\n\nFor output images:\n- If the modified image fails moderation, returns a 422 error\n"
}
}
},
"examples": {
"send using url": {
"value": {
"image_url": "URL",
"mask_url": "URL"
}
},
"send using base64 string": {
"value": {
"file": "base64_encoded_string_for_image",
"mask_file": "base64_encoded_string_for_image"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Successful operation.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"result_url": {
"type": "string",
"description": "URL that represents the updated visual created in the request. It is a temporary URL that will expire",
"example": "URL"
}
}
}
}
}
},
"400": {
"description": "Bad request. Missing or invalid parameters."
},
"401": {
"description": "Unauthorized. Invalid API key or authentication token."
},
"404": {
"description": "Not found. Image could not be found at the provided URL."
},
"413": {
"description": "Payload too large. Image file size exceeds the 12MB limit."
},
"415": {
"description": "Unsupported media type. Invalid file type. Supported file types are jpeg, jpg, png, webp."
},
"422": {
"description": "Unprocessable Content",
"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."
},
"output_violation": {
"value": "The request could not be completed because the modified visual did not pass content moderation."
}
}
}
}
},
"429": {
"description": "Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later."
},
"460": {
"description": "Failed to download image."
},
"500": {
"description": "Internal server error. An error occurred on the server."
}
}
}
},
"/gen_fill": {
"post": {
"summary": "Generative Fill",
"tags": [
"Endpoints"
],
"description": "\n**Description**\n\nThe *GenFill Route* enables the generation of objects by prompt in a specific region of an image.\n\nYou 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.\n\nMasks 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>.\n\nThis API endpoint supports content moderation via an optional parameter that can prevent processing if input images contain inappropriate content and filters out unsafe generated images - the first blocked input image will fail the entire request.",
"operationId": "gen-fill",
"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."
},
"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."
},
"mask_url": {
"type": "string",
"description": "The URL of the binary mask image that represents the area in which the object will be generated. If both mask_url and mask_file are provided, mask_url will be used. Accepted formats are jpeg, jpg, png, webp. The area in which the object will be generated should have the value 255 (white), while the rest of the image should have the value 0 (black). **Note:** The input image and mask must have the same aspect ratio."
},
"mask_file": {
"type": "string",
"description": "The file of the binary mask image that represents the area in which the object will be generated, in base64 format. This parameter is used if mask_url is not provided. Accepted formats are jpeg, jpg, png, webp. The area in which the object will be generated should have the value 255 (white), while the rest of the image should have the value 0 (black). **Note:** The input image and mask must have the same aspect ratio."
},
"mask_type": {
"type": "string",
"default": "manual",
"description": "You can use this parameter to specify the type of the input mask from the list. 'manual' opttion should be used in cases in which the mask had been generated by a user (e.g. with a brush tool), and 'automatic' mask type should be used when mask had been generated by an algorithm like 'SAM'.",
"enum": [
"manual",
"automatic"
]
},
"prompt": {
"type": "string",
"description": "The prompt you would like to use to generate the object within the masked region."
},
"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."
},
"num_results": {
"type": "integer",
"description": "The number of images you would like to generate.",
"minimum": 1,
"default": 4,
"maximum": 4
},
"sync": {
"type": "boolean",
"default": false,
"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. It is recommended to use sync=false for optimal performance. When generating more than 1 result, you should use the value false."
},
"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."
},
"content_moderation": {
"type": "boolean",
"default": false,
"description": "When enabled, applies content moderation to both input visuals and generated outputs.\n\nFor input images:\n- Processing stops if the image fails moderation\n- Returns a 422 error with details about which parameter failed\n\nFor synchronous requests (sync=true):\n- If some images pass and others fail, returns a 200 response with URLs array containing successful generations and \"422_image_blocked_due_to_content_moderation\" for failed ones\n examples:\n send using url:\n value:\n image_url: 'URL'\n mask_url: 'URL'\n prompt: 'object description'\n send using base64 string:\n value:\n file: 'base64_encoded_string_for_image'\n mask_file: 'base64_encoded_string_for_image'\n prompt: 'object description'\n"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Successful operation.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"urls": {
"type": "array",
"items": {
"type": "string"
},
"description": "An array of URLs representing the updated visuals generated by the request. \nThese URLs are temporary and will eventually expire.\n\nWhen content_moderation is true:\n- For synchronous requests (sync=true): Array will contain URLs for successful generations and \"422_image_blocked_due_to_content_moderation\" for images that failed moderation\n- For asynchronous requests (sync=false): Failed images will be replaced with zero-byte files at their placeholder URLs\n"
},
"seed": {
"type": "array",
"items": {
"type": [
"integer",
"null"
]
},
"description": "An array of integers representing the seeds used to generate each result. \nThese seeds ensure reproducibility and are compatible with the results URL structure.\nWhen content moderation blocks an image, its corresponding seed will be null.\n"
}
}
},
"examples": {
"success": {
"value": {
"urls": [
"https://server.com/result1.jpg",
"https://server.com/result2.jpg"
],
"seed": [
12345,
98765
]
}
},
"partial_success": {
"value": {
"urls": [
"https://server.com/result_pass1.jpg",
"422_image_blocked_due_to_content_moderation"
],
"seed": [
12345,
null
]
}
}
}
}
}
},
"400": {
"description": "Bad request. Missing or invalid parameters."
},
"401": {
"description": "Unauthorized. Invalid API key or authentication token."
},
"404": {
"description": "Not found. Image could not be found at the provided URL."
},
"413": {
"description": "Payload too large. Image file size exceeds the 12MB limit."
},
"415": {
"description": "Unsupported media type. Invalid file type. Supported file types are jpeg, jpg, png, webp."
},
"422": {
"description": "Unprocessable Content",
"content": {
"application/json": {
"schema": {
"type": "string"
},
"examples": {
"input_violation": {
"value": "The request could not be completed because the visual in the '{parameter_name}' parameter failed content moderation."
},
"all_outputs_blocked": {
"value": "The request could not be completed because all modified visuals failed content moderation."
}
}
}
}
},
"429": {
"description": "Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later."
},
"460": {
"description": "Failed to download image."
},
"500": {
"description": "Internal server error. An error occurred on the server."
}
}
}
},
"/background/remove": {
"post": {
"summary": "Remove Background",
"tags": [
"Endpoints"
],
"description": "\n**Description**\n\nThe *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).\n\nThis API endpoint supports content moderation via an optional parameter that can prevent processing if input images contain inappropriate content or if the modified output would contain inappropriate content.\n\n\n**Constraints**\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**Remove the background from an image using the image file**\n\n\n In our documentation request example, we demonstrate how to remove the background from an image using the image URL.\n \n \n If you want to use an image from a file, follow the example below:\n\n ```python\n import requests\n\n url = \"https://engine.prod.bria-api.com/v1/background/remove\"\n\n payload = {}\n files=[\n ('file',('image_name.jpeg',open('/path_to_local_file/image_name.jpeg','rb'),'image/jpeg'))\n ]\n headers = {\n 'api_token': 'xxxx'\n }\n\n response = requests.request(\"POST\", url, headers=headers, data=payload, files=files)\n\n print(response.text)\n ```",
"operationId": "background-remove",
"parameters": [
{
"in": "header",
"name": "api_token",
"schema": {
"type": "string"
},
"required": true
}
],
"requestBody": {
"required": true,
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"file": {
"description": "The image file you would like to remove the background from.",
"type": "string",
"format": "binary"
},
"image_url": {
"description": "The URL of the image file you would like to remove the background from. The URL should lead to an image publicly available online. Either a file or an image_url should be provided. If both are provided, then the route will use image_url.",
"type": "string"
},
"content_moderation": {
"type": "boolean",
"default": false,
"description": "When enabled, applies content moderation to both input visuals and modified outputs.\n\nFor input images:\n- Processing stops if the image fails moderation\n- Returns a 422 error with details about which parameter failed\n\nFor output images:\n- If the modified image fails moderation, returns a 422 error\n"
}
}
},
"example": {
"image_url": "https://i.natgeofe.com/n/548467d8-c5f1-4551-9f58-6817a8d2c45e/NationalGeographic_2572187_square.jpg"
}
}
}
},
"responses": {
"200": {
"description": "Successful operation.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"result_url": {
"type": "string",
"description": "URL that represents the updated visual created in the request. It is a temporary URL that will expire."
}
}
}
}
}
},
"206": {
"description": "File value was not provided."
},
"400": {
"description": "Request doesn't contain file part."
},
"405": {
"description": "Method not allowed."
},
"415": {
"description": "Unsupported media type."
},
"422": {
"description": "Unprocessable Content",
"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."
},
"output_violation": {
"value": "The request could not be completed because the modified visual did not pass content moderation."
}
}
}
}
},
"429": {
"description": "Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later."
},
"460": {
"description": "Failed to download image."
},
"500": {
"description": "Internal server error."
},
"506": {
"description": "Insufficient data. The given input is not supported by the Bria API."
}
}
}
},
"/background/replace": {
"post": {
"summary": "Generate Background",
"tags": [
"Endpoints"
],
"description": "\n\n**Description**\n\n\nThe *Replace BG Route* is used to replace the background of any image.\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\nThis endpoint 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. This feature is only available when generating a single result (num_results=1).\n\nHere are some examples:\n\n**original image**: \n\n<img src=\"https://i.ibb.co/n6JtktM/unnamed-13.jpg\" width=\"200\"/>\n\n**bg_prompt**: in a parking lot\n \n\n**num_results**: 3\n\n**results**:\n\n<img src=\"https://i.ibb.co/1zvT5h4/unnamed-14.jpg\" width=\"200\"/> <img src=\"https://i.ibb.co/MkVDxc8/unnamed-15.jpg\" width=\"200\"/> <img src=\"https://i.ibb.co/pfgQ34p/unnamed-16.jpg\" width=\"200\"/> \n\n\nThis API endpoint supports content moderation via an optional parameter that can prevent processing if input images contain inappropriate content, and filters out unsafe modified images - the first blocked input image will fail the entire request.",
"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",
"properties": {
"sync": {
"type": "boolean",
"default": false,
"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. It is recommended to use sync=false for optimal performance. When generating more than 1 result, you should use the value false."
},
"fast": {
"type": "boolean",
"default": true,
"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."
},
"image_url": {
"type": "string",
"description": "The URL of the image to which a new background should be generated. 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 product of the image to which a new background should be generated, in base64 format. Used if image_url is not provided. Accepted formats are jpeg, jpg, png, webp. Maximum file size 12MB."
},
"ref_image_url": {
"type": "string",
"description": "The URL of the reference image to be used for generating the new background. Either ref_image_url or bg_prompt has to be provided but not both. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp."
},
"ref_image_file": {
"type": "string",
"description": "The reference image file to be used for generating the new background. If both ref_image_url and ref_image_file are provided, ref_image_url will be used. Accepted formats are jpeg, jpg, png, webp."
},
"bg_prompt": {
"type": "string",
"description": "Text description of the new scene or background for the provided image. Either ref_image_url or bg_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 bg_prompt that was included and adjusts it to achieve optimal results. Built with Meta Llama 3."
},
"enhance_ref_image": {
"type": "boolean",
"default": true,
"description": "When set to true, additional logic processes the included reference image to make adjustments for optimal results."
},
"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."
},
"num_results": {
"type": "integer",
"default": 4,
"description": "The number of results you would like to generate."
},
"force_rmbg": {
"type": "boolean",
"default": false,
"description": "Forces background removal, even if the original image already contains an alpha channel. Useful for refining existing foreground/background separation or ignoring unnecessary alpha channels."
},
"content_moderation": {
"type": "boolean",
"default": false,
"description": "When enabled, applies content moderation to both input visuals and modified outputs.\n\nFor input images:\n- Processing stops at the first image that fails moderation\n- Returns a 422 error with details about which parameter failed\n\nFor synchronous requests (sync=true):\n- If all modified images fail moderation, returns a 422 error\n- If some images pass and others fail, returns a 200 response with successful outputs and \"blocked\" objects for failed ones\n\nFor asynchronous requests (sync=false):\n- Failed images are replaced with zero-byte files at their placeholder URLs\n- Successful images are stored at their original placeholder URLs \n"
},
"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."
},
"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": {
"bg_prompt": "in a living room interior, on a kitchen counter",
"num_results": 2,
"sync": true,
"image_url": "URL"
}
}
}
},
"responses": {
"200": {
"description": "Successful operation",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"result": {
"type": "array",
"description": "The array contains the results created in the request. In each result, the first value represents the URL of the result, the second value represents the seed, and the third value represents the session id of the result. It will take a few seconds for the image to become available via the URL if sync=false. You can recreate the same result in the future by using the seed as part of the request.\n\nWhen content_moderation is true:\n- For synchronous requests (sync=true): Results array will contain both successful generations and \"blocked\" objects for images that failed moderation\n- For asynchronous requests (sync=false): Failed images will be replaced with zero-byte files at their placeholder URLs\n",
"items": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
},
"examples": {
"success": {
"value": {
"result": [
[
"https://storage.server/outputs/valid_output_1.jpeg",
"123111",
"valid_output_1.jpeg"
],
[
"https://storage.server/outputs/valid_output_2.jpeg",
"123222",
"valid_output_2.jpeg"
]
]
}
},
"partial_success": {
"value": {
"result": [
[
"https://storage.server/outputs/valid_output_1.jpeg",
"123111",
"valid_output_1.jpeg"
],
[
"blocked:true",
"error_code:422",
"description:The request could not be completed because the modified visual did not pass content moderation."
]
]
}
}
}
}
}
},
"400": {
"description": "Bad request. Missing or invalid parameters."
},
"401": {
"description": "Unauthorized. Invalid API key or authentication token."
},
"404": {
"description": "Not found. Image could not be found at the provided URL."
},
"413": {
"description": "Payload too large. Image file size exceeds the 12MB limit."
},
"415": {
"description": "Unsupported media type. Invalid file type. Supported file types are jpeg, jpg, png, webp."
},
"422": {
"description": "Unprocessable Content",
"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."
},
"all_outputs_blocked": {
"value": "The request could not be completed because all modified visuals failed content moderation."
}
}
}
}
},
"429": {
"description": "Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later."
},
"460": {
"description": "Failed to download image."
},
"500": {
"description": "Internal server error. An error occurred on the server."
}
}
}
},
"/erase_foreground": {
"post": {
"summary": "Erase Foreground",
"tags": [
"Endpoints"
],
"description": "\n\n**Description**\n\n\nThis route is used to erase the foreground from a provided image, while generating the area behind it. \nThis API endpoint supports content moderation via an optional parameter that can prevent processing if input images contain inappropriate content or if the modified output would contain inappropriate content.",
"operationId": "erase-foreground",
"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."
},
"content_moderation": {
"type": "boolean",
"default": false,
"description": "When enabled, applies content moderation to both input visuals and modified outputs.\n\nFor input images:\n- Processing stops if the image fails moderation\n- Returns a 422 error with details about which parameter failed\n\nFor output images:\n- If the modified image fails moderation, returns a 422 error\n"
}
},
"example": {
"image_url": "URL"
}
}
}
}
},
"responses": {
"200": {
"description": "Successful operation.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"result_url": {
"type": "string",
"description": "URL that represents the updated visual created in the request. It is a temporary URL that will expire",
"example": "URL"
}
}
}
}
}
},
"400": {
"description": "Bad request. Missing or invalid parameters."
},
"401": {
"description": "Unauthorized. Invalid API key or authentication token."
},
"404": {
"description": "Not found. Image could not be found at the provided URL."
},
"413": {
"description": "Payload too large. Image file size exceeds the 12MB limit."
},
"415": {
"description": "Unsupported media type. Invalid file type. Supported file types are jpeg, jpg, png, webp."
},
"422": {
"description": "Unprocessable Content",
"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."
},
"output_violation": {
"value": "The request could not be completed because the modified visual did not pass content moderation."
}
}
}
}
},
"429": {
"description": "Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later."
},
"460": {
"description": "Failed to download image."
},
"500": {
"description": "Internal server error. An error occurred on the server."
}
}
}
},
"/background/blur": {
"post": {
"summary": "Blur Background",
"tags": [
"Endpoints"
],
"description": "\n\n**Description**\n\n\nThe *background/blur Route* is used to create a blur effect on the background of an image. \nThis API endpoint supports content moderation via an optional parameter that can prevent processing if input images contain inappropriate content or if the modified output would contain inappropriate content.",
"operationId": "blur-bg",
"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."
},
"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."
},
"force_rmbg": {
"type": "boolean",
"default": false,
"description": "Forces background removal, even if the original image already contains an alpha channel. Useful for refining existing foreground/background separation or ignoring unnecessary alpha channels."
},
"content_moderation": {
"type": "boolean",
"default": false,
"description": "When enabled, applies content moderation to both input visuals and modified outputs.\n\nFor input images:\n- Processing stops if the image fails moderation\n- Returns a 422 error with details about which parameter failed\n\nFor output images:\n- If the modified image fails moderation, returns a 422 error\n"
}
},
"example": {
"image_url": "URL"
}
}
}
}
},
"responses": {
"200": {
"description": "Successful operation.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"result_url": {
"type": "string",
"description": "URL that represents the updated visual created in the request. It is a temporary URL that will expire",
"example": "URL"
}
}
}
}
}
},
"400": {
"description": "Bad request. Missing or invalid parameters."
},
"401": {
"description": "Unauthorized. Invalid API key or authentication token."
},
"404": {
"description": "Not found. Image could not be found at the provided URL."
},
"413": {
"description": "Payload too large. Image file size exceeds the 12MB limit."
},
"415": {
"description": "Unsupported media type. Invalid file type. Supported file types are jpeg, jpg, png, webp."
},
"422": {
"description": "Unprocessable Content",
"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."
},
"output_violation": {
"value": "The request could not be completed because the modified visual did not pass content moderation."
}
}
}
}
},
"429": {
"description": "Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later."
},
"460": {
"description": "Failed to download image."
},
"500": {
"description": "Internal server error. An error occurred on the server."
}
}
}
},
"/image_expansion": {
"post": {
"summary": "Expand Image",
"tags": [
"Endpoints"
],
"description": "\n\n**Description**\n\n\nThe *Image Expension Route* can be used to expand an image, by utilizing generative AI.\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\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**Optimal input range**\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***Canvas Size:*** The canvas size should be up to an area of 5000x5000 pixels.\nHere are some examples:\n\n**original image (Generated by Bria)**: \n\n<img src=\"https://bria-image-repository.s3.amazonaws.com/images/caeaa19524d69ad6.jpg\" width=\"200\"/>\n\n**results**:\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\"/> <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**results**:\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\"/> <img src=\"https://bria-image-repository.s3.amazonaws.com/images/904f62b0dce4fb8c.jpg\" width=\"600\"/> \n\nThis API endpoint supports content moderation via an optional parameter that can prevent processing if input images contain inappropriate content or if the expanded output would contain inappropriate content.",
"operationId": "image-expansion",
"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."
},
"canvas_size": {
"type": "array",
"items": {
"type": "integer"
},
"default": [
1000,
1000
],
"description": "The desired size of the final image, after the expansion. should have an area of less than 5000x5000 pixels."
},
"original_image_size": {
"type": "array",
"items": {
"type": "integer"
},
"description": "The desired size of the original image, inside the full canvas. Ensure that the ratio of input image foreground or main subject to the canvas area is greater than 15% to achieve optimal results."
},
"original_image_location": {
"type": "array",
"items": {
"type": "integer"
},
"description": "The desired location of the original image, inside the full canvas. Provide the location of the upper left corner of the original image. The location can also be outside the canvas (the original image will be cropped)."
},
"prompt": {
"type": "string",
"description": "Text on which you wish to base the image expansion. This parameter is optional. Bria currently supports prompts in English only, excluding special characters."
},
"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. Bria currently supports prompts in English only."
},
"content_moderation": {
"type": "boolean",
"default": false,
"description": "When enabled, applies content moderation to both input visuals and expanded output.\n\nFor input images:\n- Processing stops if the image fails moderation\n- Returns a 422 error with details about which parameter failed\n\nFor output image:\n- If the expanded image fails moderation, returns a 422 error\n"
}
},
"example": {
"image_url": "URL",
"canvas_size": [
1200,
674
],
"original_image_size": [
610,
855
],
"original_image_location": [
301,
-66
]
}
}
}
}
},
"responses": {
"200": {
"description": "Successful operation.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"example": 200
},
"description": {
"type": "string",
"example": "SUCCESS"
},
"message": {
"type": "string",
"example": "Finished sucessfully",
"description": "A message that describes the request status. The options are Finished sucessfully, Content might not be safe for work."
},
"prompt": {
"type": "string",
"example": "a man in a shirt sitting down in front of a brick wall looking off to the side",
"description": "The prompt used to generate the expansion. If you want to recreate the result again, you should use in the request the prompt and the seed of the response."
},
"result_url": {
"type": "string",
"description": "URL that represents the updated visual created in the request. It is a temporary URL that will expire",
"example": "URL"
},
"seed": {
"type": "integer",
"example": 1525972691,
"description": "If you want to recreate the result again, you should use in the request the prompt and the seed of the response."
},
"status": {
"type": "string",
"example": "SUCCESS",
"description": "The request status. The options are SUCCESS, NSFW."
}
}
}
}
}
},
"400": {
"description": "Bad request. Missing or invalid parameters."
},
"401": {
"description": "Unauthorized. Invalid API key or authentication token."
},
"404": {
"description": "Not found. Image could not be found at the provided URL."
},
"413": {
"description": "Payload too large. Image file size exceeds the 12MB limit."
},
"415": {
"description": "Unsupported media type. Invalid file type. Supported file types are jpeg, jpg, png, webp."
},
"422": {
"description": "Unprocessable Content",
"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."
},
"output_violation": {
"value": "The request could not be completed because the modified visual did not pass content moderation."
}
}
}
}
},
"429": {
"description": "Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later."
},
"460": {
"description": "Failed to download image."
},
"500": {
"description": "Internal server error. An error occurred on the server."
}
}
}
},
"/image/increase_resolution": {
"post": {
"summary": "Increase Resolution",
"tags": [
"Endpoints"
],
"description": "\n\n**Description**\n\n\nThe *Increase Resolution Route* is used to upscale the resolution of any image.\n\nThis API endpoint supports content moderation via an optional parameter that can prevent processing if input images contain inappropriate content or if the modified output would contain inappropriate content.\n\n**Constraints**\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\nIt's possible to increase the resolution of an image up to a total area of 8192x8192 pixels.\n\n**Increase the Resolution of an image using the image file**\n\n\n In our documentation request example, we demonstrate how to Increase the Resolution of an image using the image URL.\n \n \n If you want to use an image from a file, follow the example below:\n\n\n import requests\n\n url = \"https://engine.prod.bria-api.com/v1/image/increase_resolution?desired_increase=2\"\n\n payload = {}\n files=[\n ('file',('image_name.jpeg',open('/path_to_local_file/image_name.jpeg','rb'),'image/jpeg'))\n ]\n headers = {\n 'api_token': 'xxxx'\n }\n\n response = requests.request(\"POST\", url, headers=headers, data=payload, files=files)\n\n print(response.text)\n ",
"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": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"file": {
"description": "The image file you would like to increase the resolution for. Minimum resolution supported for width and/or height is 216 pixels.",
"type": "string",
"format": "binary"
},
"image_url": {
"description": "The URL of the image file you would like to increase the resolution for. The URL should lead to an image publicly available online. Either a file or an image_url should be provided. If both are provided, then the route will use image_url. Minimum resolution supported for width and/or height is 216 pixels.",
"type": "string"
},
"content_moderation": {
"type": "boolean",
"default": false,
"description": "When enabled, applies content moderation to both input visuals and modified outputs.\n\nFor input images:\n- Processing stops if the image fails moderation\n- Returns a 422 error with details about which parameter failed\n\nFor output images:\n- If the modified image fails moderation, returns a 422 error\n"
}
}
},
"example": {
"image_url": "https://i.natgeofe.com/n/548467d8-c5f1-4551-9f58-6817a8d2c45e/NationalGeographic_2572187_square.jpg"
}
}
}
},
"responses": {
"200": {
"description": "Successful operation.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"result_url": {
"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.jpeg?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"
},
"405": {
"description": "Method not allowed."
},
"406": {
"description": "Increased image resolution will exceed maximum size 8K UHD (67108864 pixels)."
},
"413": {
"description": "Payload too large. Image file size exceeds the 12MB limit."
},
"415": {
"description": "Unsupported media type. Invalid file type. Supported file types are jpeg, jpg, png, webp."
},
"422": {
"description": "Unprocessable Content",
"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."
},
"output_violation": {
"value": "The request could not be completed because the modified visual did not pass content moderation."
}
}
}
}
},
"429": {
"description": "Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later."
},
"460": {
"description": "Failed to download image."
},
"500": {
"description": "Internal server error."
},
"506": {
"description": "Insufficient data. The given input is not supported by the Bria API."
}
}
}
},
"/{visual_id}/image_to_psd": {
"post": {
"summary": "Delayer Image",
"tags": [
"Endpoints"
],
"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."
},
"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."
}
}
}
},
"/crop": {
"post": {
"summary": "Crop out foreground",
"tags": [
"Endpoints"
],
"description": "\n\n**Description**\n\n\nThe 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.\nThis API endpoint supports content moderation via an optional parameter that can prevent processing if input images contain inappropriate content or if the modified output would contain inappropriate content.",
"operationId": "crop",
"parameters": [
{
"in": "header",
"name": "api_token",
"schema": {
"type": "string"
},
"required": true
}
],
"requestBody": {
"required": false,
"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."
},
"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_rmbg": {
"type": "boolean",
"default": false,
"description": "Forces background removal, even if the original image already contains an alpha channel. Useful for refining existing foreground/background separation or ignoring unnecessary alpha channels."
},
"content_moderation": {
"type": "boolean",
"default": false,
"description": "When enabled, applies content moderation to both input visuals and modified outputs.\n\nFor input images:\n- Processing stops if the image fails moderation\n- Returns a 422 error with details about which parameter failed\n\nFor output images:\n- If the modified image fails moderation, returns a 422 error\n"
}
}
},
"example": {
"image_url": "URL"
}
}
}
},
"responses": {
"200": {
"description": "Successful operation.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"result_url": {
"type": "string",
"description": "URL that represents the updated visual created in the request. It is a temporary URL that will expire",
"example": "URL"
}
}
}
}
}
},
"400": {
"description": "Bad request. Missing or invalid parameters."
},
"401": {
"description": "Unauthorized. Invalid API key or authentication token."
},
"404": {
"description": "Not found. Image could not be found at the provided URL."
},
"413": {
"description": "Payload too large. Image file size exceeds the 12MB limit."
},
"415": {
"description": "Unsupported media type. Invalid file type. Supported file types are jpeg, jpg, png, webp."
},
"429": {
"description": "Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later."
},
"460": {
"description": "Failed to download image."
},
"500": {
"description": "Internal server error. An error occurred on the server."
}
}
}
},
"/objects/mask_generator": {
"post": {
"summary": "Get Masks",
"tags": [
"Endpoints"
],
"description": "\n\n\n**Description**\n\n***Note: This API route requires the image to be registered via the `/register` route.***\n\nThe *Objects/Mask Generator Route* is used to generate all possible masks for an image, creating a full segmentation of the image.\n\nThe response contains a zip file named as the visual_id of the provided image.\n\nThere are k mask files in the zip, each named with the visual_id and mask_id.\n\nThe 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.\n\nEach 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. \n\nYou can display those masks to the user, let them pick one or more masks, and use objects/remove route to remove the masked area.\n\nIn 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.\n\nYou can see below an example of the content of the zip:\n\n\n 92bf8ce17584de82_panoptic.png\n\n \n 92bf8ce17584de82_1.png\n\n \n 92bf8ce17584de82_2.png\n\n \n 92bf8ce17584de82_3.png\n\n \n ...\n\n \n 92bf8ce17584de82_86.png\n\n\nYou 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>.\nThis 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."
},
"content_moderation": {
"type": "boolean",
"default": false,
"description": "When enabled, applies content moderation to input visuals.\n\nFor input images:\n- Processing stops at the first image that fails moderation\n- Returns a 422 error with details about which parameter failed\n"
}
}
},
"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."
},
"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": [
"Endpoints"
],
"description": "\n\n\n**Description**\n\n***Note: This API route requires the image to be registered via the `/register` route.***\n\nThe *Person/Info Route* is used to retrieve useful information on the people in a specific visual that was previously uploaded to the database.\n\nAdditionally, it provides a description of each person within the scene along with its available changes, which are supported by the Bria API. \n\nThis 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."
},
"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": [
"Endpoints"
],
"description": "\n\n**Description**\n\n***Note: This API route requires the image to be registered via the `/register` route.***\n\nThe *Create Route* is used to create a new visual, based on the changes requested by the user for a previously uploaded visual.\n\nYou can also use this route on a modified image by providing the sid from the response of the previously used route.\n\nThis route returns both the URL and the sid associated with the updated image.\n\nBefore 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.\n\nYou 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.\n\nWhen 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."
},
"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": {}
}