← Back to catalog

Imagen Background Swap

Live
imageedit

Replace the background of a subject image from a text prompt.

Endpoint

POSThttps://brahmand-api.bulletshorts.co/v1/image/imagen-bgswap

Authenticate with the X-API-Key request header.

Pricing

6 credits / image1 credit = ₹1. Billed on success: per image.

List price. Volume / bulk customers get a discounted rate — contact us for account pricing.

Parameters

NameTypeRequiredDescriptionDefault / options
image_urlstringrequiredSource image whose background to replace.
promptstringrequiredDescription of the new background.
mask_dilationnumberoptionalMask dilation 0-1 (grow the masked region).
sample_countnumberoptionalNumber of images to generate (1-4).
default: 1
negative_promptstringoptionalThings to avoid in the output.
guidance_scalenumberoptionalPrompt-adherence strength.
base_stepsnumberoptionalSampling steps for the base model (1-100).
seednumberoptionalRNG seed (0-4294967295) for deterministic output. Forces add_watermark off when set.
add_watermarkbooleanoptionalAdd SynthID watermark. Cannot be combined with seed.
default: true
person_generationstringoptionalAllow people in output: dont_allow | allow_adult | allow_all.
default: allow_adult
safety_settingstringoptionalSafety filter: block_low_and_above | block_medium_and_above | block_only_high | block_none.

Request

curl
curl -X POST https://brahmand-api.bulletshorts.co/v1/image/imagen-bgswap \
  -H "X-API-Key: $TRINETRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"image_url":"https://example.com/product.png","prompt":"a marble kitchen countertop"}'
request body (JSON)
{
  "image_url": "https://example.com/product.png",
  "prompt": "a marble kitchen countertop"
}

Response

Submitting a job returns 202 Accepted with a job id. Poll GET /v1/jobs/{id} until the job reaches a terminal state, or register a webhook to be notified.

202 Accepted
{
  "job_id": "job_imagenbgswap_a1b2c3",
  "status": "queued"
}
GET /v1/jobs/{id} → succeeded
{
  "id": "job_imagenbgswap_a1b2c3",
  "model": "imagen-bgswap",
  "status": "succeeded",
  "output": {
    "outputs": [
      {
        "url": "https://cdn.trinetra.ai/out/imagen-bgswap/a1b2c3.png",
        "type": "image"
      }
    ]
  },
  "credits_charged": 10
}

Webhook: set a webhook_url on your API key to receive a POST with the terminal job document instead of polling.