Skip to content

Replace Object by Text

Request

Swap an existing object in an image with a new one using a natural language command.

Example: Instruction: "Replace the red apple with a green pear"

Input ImageOutput Image
Security
api_token
Bodyapplication/json
imagestringrequired

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.

instructionstringrequired

Natural language command.

webhook_urlstring, (uri)

Optional URL for receiving the result via webhook when the async job completes. See webhooks.

POST
/replace_object_by_text
from bria_client import BriaSyncClient

client = BriaSyncClient()  # reads BRIA_API_TOKEN

job = client.submit(
    endpoint="image/edit/replace_object_by_text",
    payload={
        "image": "<image>",
        "instruction": "<instruction>",
    },
)
result = client.poll(job, interval=2, timeout=120)
print(result.result.image_url)

Responses

Successful operation (Synchronous Success)

Bodyapplication/json
resultobjectrequired
request_idstringrequired
warningstring

Returned only when ip_signal = true and the instruction field included IP content.

Response
{ "result": { "image_url": "string", "seed": 0, "structured_instruction": "string" }, "request_id": "string", "warning": "string" }