$0.04 / $0.08
per image, raster / vector
Image + prompt → image
up to 10 MB, 16 MP
POST /v1/images/replaceBackground
endpoint, mask variant below
Try it
Get an API token on your profile page (it needs a positive API units balance) and set it once per terminal session:Response
Both operations return the same result.datahas one entry per image (n). Download each image from itsurl. Withrecraftv3_vector, eachurlpoints to an SVG file.- Image URLs are temporary: files are kept for about 24 hours, so download them. See Limits and sizes.
creditsis the number of API units charged for the request.
Parameters
Parameters ofPOST /v1/images/replaceBackground:
More parameters
More parameters
Generate background
POST /v1/images/generateBackground works like replace background, but you mark the background with a mask instead of letting the model find it. Use it when you want to control exactly which area is regenerated.
The request below uses the sample image and a sample mask that is white over the background and black over the motorcycle and rider, so only the background is generated.
Request parameters
The mask is a grayscale image (PNG, JPG, or WEBP) of exactly the same size as the image. Pure white pixels (
255) are regenerated and pure black pixels (0) stay unchanged. Every pixel must be one of the two.
model, n, style, style_id, style_match, negative_prompt, text_layout, controls, response_format, and image_format work as in the table above. The image limits are the same.
Examples
Upload a local file
Upload a local file
Upload a local image and mask
Upload a local image and mask
For generate background, upload the mask next to the image.
Get an SVG result
Get an SVG result
recraftv3_vector returns SVG instead of a raster image. It costs $0.08 per image, for both operations.Related
Inpainting
Regenerate any masked area, not only the background.
Outpainting
Extend an image beyond its borders.
Recraft V3
The model line behind background operations.
Pricing
Prices of every model and tool.