API Reference (OpenAPI)

Image Editing v2 (Plus plan)

get

This endpoint processes an image and applies one or more edits: background removal, AI-generated backgrounds (background.prompt), realistic shadows (shadow.mode), relighting (lighting.mode), text removal (textRemoval.mode), background blur (background.blur.), subject outline (outline.), AI beautification (beautify.mode), Flat Lay (flatLay.), Ghost Mannequin (ghostMannequin.), Virtual Model (virtualModel.*), AI expand (expand.mode), AI uncrop (uncrop.mode), AI upscale (upscale.mode), and positioning/resizing (padding, margin, outputSize).

Parameters are grouped by feature using dot notation: background.* for backgrounds, shadow.* for shadows, lighting.* for relighting, outline.* for subject outlines, beautify.* for AI beautification, flatLay.* for flat lay generation, ghostMannequin.* for ghost mannequin generation, virtualModel.* for virtual model generation, expand.* for AI expand, uncrop.* for AI uncrop, upscale.* for AI upscale, export.* for output format, and segmentation.* for text-guided segmentation.

Edits can be combined in a single call.

It accepts a URL input for the image. If you want to directly upload an image file, please use the POST endpoint. For more details on the difference between the GET and POST endpoints, please have a look at our documentation: https://docs.photoroom.com/image-editing-api/which-endpoints-are-available.

For the simplest integration (recommended for no-code tools like Lovable), use this GET endpoint with imageUrl β€” no file upload handling required.

Example of a request: GET https://image-api.photoroom.com/v2/edit?imageUrl=https://example.com/photo.jpg&removeBackground=true&background.color=FFFFFF&outputSize=1000x1000&padding=0.1 with header x-api-key: YOUR_API_KEY

The response is the edited image as binary data (image/png by default). To change format, set export.format to jpeg or webp.

Full documentation: https://docs.photoroom.com/image-editing-api-plus-plan/quickstart-guide

Feature documentation:

Authorizations
x-api-keystringRequired

Get you API Key here

Query parameters
background.blur.modestring Β· enumOptional

Type of blur to apply to the background.

  • gaussian: Applies a gaussian blur to the background.
  • bokeh: Applies a bokeh blur to the background.
Example: gaussianPossible values:
background.blur.radiusnumber Β· max: 0.05Optional

Radius of the blur effect. Higher values mean the result will be blurrier.

Minimum: 0, Maximum: 0.05

Default: 0.01Example: 0.01
background.colorstringOptional

Color of the background. If omitted, background will be transparent unless background.imageUrl or background.imageFile is provided. Can be a hex color without the hash sign (example: FF0000, FF0000EE) or color name (examples: red, blue)

When removeBackground is set to false, the color will be used to fill padding areas created by outputSize and any transparent areas in the original image.

Default: transparentExample: #FF0000
background.expandPromptany ofOptional

If ai.auto, a pre-processing step is applied to expand the prompt into a longer form.

auto and never are legacy values that will be removed in the next major version.

const: autoOptional
or
const: neverOptional
or
background.guidance.imageFilestring Β· binaryOptional

Bytes of the image to use as a background image guidance. Only available in the POST request

Can't be provided if removeBackground is set to false

The maximum size of the image is 30MB.

background.guidance.imageUrlstringOptional

URL of the image to use as a background image guidance.

Can't be provided if removeBackground is set to false

The maximum size of the image is 30MB.

Example: https://example.com/image.jpg
background.guidance.scalenumber Β· max: 1Optional

How closely the generated background will be matching the guiding image, between 0 and 1.

A value of 1 means it will match the guiding image as much as possible, a value of 0 means the guiding image will be ignored.

(Only working when using the new model)

Default: 0.6Example: 0.6
background.imageUrlstringOptional

URL of the image to use as a background.

Can't be provided if removeBackground is set to false

The maximum size of the image is 30MB.

If background.imageUrl is provided, neither background.imageFile nor background.prompt can be provided, and vice versa.

Example: https://example.com/image.jpg
background.negativePromptstringOptional

(LEGACY) This parameter will only have an effect when using the previous AI Backgrounds model, which is used when setting the header: pr-ai-background-model-version: 2

A negative prompt to use for guiding the background generation process; If provided, the generation algorithm will try to avoid properties listed in the negativePrompt.

Example: a red background
background.promptstringOptional

Prompt to use for guiding the background generation process.

Tips for writing high-quality prompts are available in our documentation.

If background.prompt is provided, neither background.imageUrl nor background.imageFile can be provided, and vice versa.

Example: a blue sky
background.scalingstring Β· enumOptional

Whether the background should fit or fill (default) the output image If set to fit, the empty pixels will be transparent

Can only be provided if background.imageUrl or background.imageFile is provided

Default: fillExample: fitPossible values:
background.seednumberOptional

Seed used to generate the background. Can be used to get similar looking results for the same prompt.

Example: 123456
beautify.modestring Β· enumOptional

If enabled, the input image will be beautified (imageFile or imageUrl).

This is intended to enhance product images by automatically improving the aesthetics of the image, such as the lighting, background, and overall appearance.

If set to ai.auto, the input image will be beautified to match the aesthetic of a packshot product image.

If set to ai.food, the input image will be beautified in a way that's specific to food images, such as placing the subject on a plate.

If set to ai.car, the input image will be beautified in a way that's specific to car images, such as removing reflections.

Important:

  • the beautifier will not preserve the original background: we recommend using this option along with removeBackground set to true
  • the beautifier is meant for images of products, food, or cars; we do not recommend using it with subjects such as humans, pets, etc.
Example: ai.autoPossible values:
beautify.seednumberOptional

Seed used to run the subject beautifier. Can be used to get similar looking results for the same subject.

Example: 123456
describeAnyChange.modeconst: ai.autoOptional

(DEPRECATED) Use editWithAI.mode instead.

Describe any change mode to use on the main image used by the API.

Currently, only ai.auto is supported.

Example: ai.auto
describeAnyChange.promptstring Β· min: 1Optional

(DEPRECATED) Use editWithAI.prompt instead.

The natural language prompt describing the change to apply to the image.

Example: Remove the coffee cup on the table
describeAnyChange.seednumberOptional

(DEPRECATED) Use editWithAI.seed instead.

Seed used for the generation. Can be used to get similar looking results for the same prompt.

Example: 123456
editWithAI.modeconst: ai.autoOptional

Edit with AI mode to use on the main image used by the API.

Currently, only ai.auto is supported.

Example: ai.auto
editWithAI.promptstring Β· min: 1Optional

The natural language prompt describing the change to apply to the image.

Example: Remove the coffee cup on the table
editWithAI.seednumberOptional

Seed used for the generation. Can be used to get similar looking results for the same prompt.

Example: 123456
expand.modeconst: ai.autoOptional

Expand mode to use on the main image used by the API.

If set to ai.auto, all transparent pixels will automatically be filled based on the content of the current background (either the original background, if removeBackground has been set to false, or a static background, if background.imageUrl has been provided)

Expand will rely on output size, subject position, and fitting mode.

Example: ai.auto
expand.seednumberOptional

Seed used to generate the background. Can be used to get similar looking results for the same prompt.

Example: 123456
export.dpinumber Β· min: 72 Β· max: 1200Optional

The pixel density of the result image.

Pixel density can be set to any value between 72 and 1200 dpi.

Example: 72
export.formatstring Β· enumOptional

The format of the result image.

Default value is "png".

Jpeg exports with a quality of 80 and WebP exports with a quality of 90.

Default: pngExample: pngPossible values:
flatLay.modeconst: ai.autoOptional

Must be set to ai.auto to enable flat lay generation.

Example: ai.auto
flatLay.promptstringOptional

Optional text prompt to guide the generation style.

Example: a clean studio flat lay
flatLay.sizestring Β· enumOptional

The output size of the generated image.

Default: SQUARE_HDExample: SQUARE_HDPossible values:
ghostMannequin.modeconst: ai.autoOptional

Must be set to ai.auto to enable ghost mannequin generation.

Example: ai.auto
ghostMannequin.promptstringOptional

Optional text prompt to guide the generation style.

Example: ghost mannequin
ghostMannequin.sizestring Β· enumOptional

The output size of the generated image.

Default: SQUARE_HDExample: SQUARE_HDPossible values:
horizontalAlignmentstring Β· enumOptional

[Advanced] Defines the horizontal alignment of the cutout subject within its bounding box.

Specifying a custom horizontal alignment will implicitly set ignorePaddingAndSnapOnCroppedSides to false for the horizontal direction.

Example: leftPossible values:
ignorePaddingAndSnapOnCroppedSidesbooleanOptional

If set to true (default), cropped sides of the subject will snap to the edges For instance, for a portrait image cropped below the elbows, the subject will be aligned at the bottom even if a bottom padding is provided (but it will still respect bottom margin)

Can't be provided if removeBackground is set to false

(See positioning section of the documentation for more information)

Default: trueExample: true
imageFromPrompt.promptstring Β· min: 1Optional

The prompt to use for generating the image.

Example: a red car in the desert
imageFromPrompt.seednumberOptional

Seed used to run the AI image generator. Can be used to get similar looking results for the same prompt.

Example: 123456
imageFromPrompt.sizestring Β· enumOptional

Supported sizes for AI image generation

Example: SQUARE_HDPossible values:
imageUrlstringOptional

URL of the main image used by the API. The GET endpoint accepts imageUrl only.

The maximum size of the image is 30MB.

If you want to directly upload an image file, please instead use the POST endpoint with the argument imageFile.

Example: https://example.com/image.jpg
keepExistingAlphaChannelstring Β· enumOptional

If set to auto and if the image has transparency, the existing transparency will be used to cutout the subject.

Default: neverExample: autoPossible values:
lighting.modestring Β· enumOptional

Lighting mode to use on the main image used by the API.

If set to ai.auto, the lighting will be automatically adjusted

If set to ai.preserve-hue-and-saturation, the lighting will be adjusted while keeping color hues and saturations as close as possible to the original image

Example: ai.autoPossible values:
marginnumber | stringOptional

General margin around the subject. Can be expressed as a number between 0 and 0.49, a percentage string between 0% and 49% (e.g., "30%"), or a pixel value string (e.g., "100px"). Unlike padding, margin is never ignored even on cropped sides of the subject. Expressed in a ratio of the output image size. See positioning section of the documentation for more information.

Tips to assist with positioning are available in our documentation.

Default: 0Example: 0.3
marginBottomnumber | stringOptional

Bottom Margin, overrides general margin on the bottom side. Accepts the same formats as margin.

Example: 0.3
marginLeftnumber | stringOptional

Left Margin, overrides general margin on the left side. Accepts the same formats as margin.

Example: 0.3
marginRightnumber | stringOptional

Right Margin, overrides general margin on the right side. Accepts the same formats as margin.

Example: 0.3
marginTopnumber | stringOptional

Top Margin, overrides general margin on the top side. Accepts the same formats as margin.

Example: 0.3
maxHeightnumberOptional

Maximum output height. Can only be provided if outputSize is originalImage or croppedSubject. Useful for: redimensioning while keeping the aspect ratio

Example: 200
maxWidthnumberOptional

Maximum output width. Can only be provided if outputSize is originalImage or croppedSubject. Useful for: resizing an image while keeping the aspect ratio

Example: 200
outline.blurRadiusnumber Β· max: 0.025Optional

Blur radius for the outline, creating a glow or soft edge effect. Higher values mean the outline will be more blurred, 0 means no blur.

Minimum: 0, Maximum: 0.025

Default: 0Example: 0.01
outline.colorstringOptional

Apply a colored outline around the subject to highlight it. Can be a hex color without the hash sign (example: FF0000, FF0000EE) or color name (examples: red, blue)

Example: FF0000
outline.widthnumber Β· max: 0.1Optional

Width of the outline relative to the image size. Suggested values:

  • 0.01-0.02: Subtle/thin outline
  • 0.03-0.05: Standard/medium outline (default: 0.03)
  • 0.06-0.1: Bold/thick outline The value represents a ratio where 0.1 (10%) is the maximum thickness.

Minimum: 0, Maximum: 0.1

Default: 0.03Example: 0.01
outputSizestringOptional

Output size of the image. In the form of either:

  • auto to keep the template dimensions when templateId is defined, or behave like originalImage when templateId isn't defined (default)
  • widthxheight for a custom size (example: 200x400)
  • originalImage to keep the original image dimensions
  • croppedSubject to use the size of the foreground dimensions after cropping around it
Default: autoExample: 200x400Pattern: ^(auto|\d+x\d+|originalImage|croppedSubject)$
paddingnumber | stringOptional

General padding around the subject. Can be expressed as a number between 0 and 0.49, a percentage string between 0% and 49% (e.g., "30%"), or a pixel value string (e.g., "100px"). Unlike margin, padding will be ignored on cropped sides of the subject if that option is enabled. Expressed in a ratio of the size of the document, minus margins (similar to CSS). See positioning section of the documentation for more information.

Tips to assist with positioning are available in our documentation.

Default: 0Example: 0.3
paddingBottomnumber | stringOptional

Bottom padding, overrides general padding on the bottom side. Accepts the same formats as padding.

Example: 0.3
paddingLeftnumber | stringOptional

Left padding, overrides general padding on the left side. Accepts the same formats as padding.

Example: 0.3
paddingRightnumber | stringOptional

Right padding, overrides general padding on the right side. Accepts the same formats as padding.

Example: 0.3
paddingTopnumber | stringOptional

Top padding, overrides general padding on the top side. Accepts the same formats as padding.

Example: 0.3
preserveMetadatastring Β· enumOptional

Controls which metadata from the original image will be preserved in the output image.

  • never: No metadata preservation (default)
  • xmp: Preserve XMP metadata including camera settings, copyright information, and other embedded metadata
  • exifSubset: Preserve EXIF Copyright (IFD0) and UserComment (ExifIFD) fields only. Deprecated β€” use exifSubsetWithXmpCompatibility instead. Will be removed in a future release.
  • exifSubsetWithXmpCompatibility: Same as exifSubset but also writes Copyright and UserComment as XMP fields (dc:rights / exif:UserComment) for applications that read XMP instead of EXIF (e.g. Adobe products, macOS Preview).
Default: neverExample: neverPossible values:
referenceBoxstring Β· enumOptional

[Advanced] subjectBox by default. When set to originalImage, the padding / margin will be around the original image and not the cropped subject.

It can lead to the subject disappearing when scaling is set to 'fill', for instance if the subject is on the left of a landscape image and outputSize is a square.

Most use cases don't require this option. It is useful if you'd like to maintain subject positioning in the original image.

Can't be provided if removeBackground is set to false

(See positioning section of the documentation for more information)

Default: subjectBoxExample: subjectBoxPossible values:
removeBackgroundbooleanOptional

If enabled (default), the background of the image will be removed using PhotoRoom's award-winning algorithm

Default: trueExample: true
scalingstring Β· enumOptional

Whether the subject should fit (default) or fill the output image If set to fit, the empty pixels will be transparent

Can only be provided if imageUrl or imageFile is provided

Default: fitExample: fitPossible values:
segmentation.modestring Β· enumOptional

Controls whether or not the salient object should be kept or ignored by the segmentation model.

Possible values:
segmentation.negativePromptstringOptional

A textual description of what the segmentation should remove.

Example: a red object
segmentation.promptstringOptional

A textual description of what the segmentation should keep.

Example: a red object
shadow.modestring Β· enumOptional

Shadow generation mode to use on the main image used by the API. If set to ai.soft, a soft shadow will be generated If set to ai.hard, a hard shadow will be generated If set to ai.floating, a floating shadow will be generated

Example: ai.softPossible values:
templateIdstring Β· uuidOptional

The ID of the template to render

textRemoval.modestring Β· enumOptional

Text removal mode to use on the main image used by the API.

If set to ai.artificial, artificial text will be automatically removed. Artificial text includes all text added on an image through post-precessing, such as company name, watermarks, discount, etc.

If set to ai.natural, natural text will be automatically removed. Natural text includes text that naturally occurs in an image such as writing on buildings or clothings, road signs, etc.

If set to ai.all, all text (natural and artificial) will be automatically removed.

Example: ai.artificialPossible values:
uncrop.modeconst: ai.autoOptional

Uncrop mode to use on the main image used by the API.

Currently, only ai.auto is supported. With ai.auto, the subject will be automatically detected and uncropped.

Example: ai.auto
uncrop.seednumberOptional

Seed used to generate the background. Can be used to get similar looking results for the same prompt.

Example: 123456
upscale.modestring Β· enumOptional

(ALPHA) Warning: might get deprecated with a 2 weeks warning

If enabled, the input image will be upscaled (imageFile or imageUrl)

The input image (imageFile or imageUrl) must not exceed 1000x1000 pixels in dimensions when using ai.fast mode. The input image (imageFile or imageUrl) must not exceed 512x512 pixels in dimensions when using ai.slow mode.

The upscaling process will enlarge the input image up to 4 times its original size. This will significantly increase the resolution and affect both the input processing and the final output dimensions.

ai.fast: This algorithm is optimized for speed and may not produce the highest quality results. ai.slow: This algorithm is optimized for quality and may take more time to process.

Example: ai.fastPossible values:
verticalAlignmentstring Β· enumOptional

[Advanced] Defines the vertical alignment of the cutout subject within its bounding box.

Specifying a custom vertical alignment will implicitly set ignorePaddingAndSnapOnCroppedSides to false for the vertical direction.

Example: topPossible values:
virtualModel.modeconst: ai.autoOptional

Must be set to ai.auto to enable virtual model generation.

Example: ai.auto
virtualModel.modelany ofOptional

The model (person) to use for the virtual try-on. Either a preset model name or a custom image.

Default: {"preset":{"name":"avery"}}
or
virtualModel.posestring Β· enumOptional

The pose of the model in the generated image.

Default: randomExample: standingPossible values:
virtualModel.promptstringOptional

Optional text prompt to guide the generation style.

Example: street style
virtualModel.qualitystring Β· enumOptional

The output quality of the generated image. Higher quality produces larger images. standard outputs ~1K, advanced ~2K, and premium ~4K resolution.

Default: standardExample: standardPossible values:
virtualModel.sceneany ofOptional

The scene (background/environment) to use. Either a preset scene name or a custom image.

Default: {"preset":{"name":"random"}}
or
virtualModel.sizestring Β· enumOptional

The output size of the generated image.

Default: PORTRAIT_HD_3_2Example: SQUARE_HDPossible values:
Responses
chevron-right
200

OK

image/png
Responsestring Β· binary

The resulting image after rendering

get
/v2/edit

Image Editing v2 (Plus plan)

post

This endpoint processes an image and applies one or more edits: background removal, AI-generated backgrounds (background.prompt), realistic shadows (shadow.mode), relighting (lighting.mode), text removal (textRemoval.mode), background blur (background.blur.), subject outline (outline.), AI beautification (beautify.mode), Flat Lay (flatLay.), Ghost Mannequin (ghostMannequin.), Virtual Model (virtualModel.*), AI expand (expand.mode), AI uncrop (uncrop.mode), AI upscale (upscale.mode), and positioning/resizing (padding, margin, outputSize).

Parameters are grouped by feature using dot notation: background.* for backgrounds, shadow.* for shadows, lighting.* for relighting, outline.* for subject outlines, beautify.* for AI beautification, flatLay.* for flat lay generation, ghostMannequin.* for ghost mannequin generation, virtualModel.* for virtual model generation, expand.* for AI expand, uncrop.* for AI uncrop, upscale.* for AI upscale, export.* for output format, and segmentation.* for text-guided segmentation.

Edits can be combined in a single call.

It accepts an image file for the image. If you want to send a URL, please use the GET endpoint. For more details on the difference between the GET and POST endpoints, please have a look at our documentation: https://docs.photoroom.com/image-editing-api/which-endpoints-are-available.

If you only have a URL for your image (not a local file), use the GET endpoint instead β€” it is simpler to integrate. Use this POST endpoint when you need to upload image files directly as multipart/form-data.

Full documentation: https://docs.photoroom.com/image-editing-api-plus-plan/quickstart-guide

Feature documentation:

Authorizations
x-api-keystringRequired

Get you API Key here

Body
background.blur.modestringOptional

Type of blur to apply to the background.

  • gaussian: Applies a gaussian blur to the background.
  • bokeh: Applies a bokeh blur to the background.
background.blur.radiusnumberOptional

Radius of the blur effect. Higher values mean the result will be blurrier.

Minimum: 0, Maximum: 0.05

background.colorstringOptional

Color of the background. If omitted, background will be transparent unless background.imageUrl or background.imageFile is provided. Can be a hex color without the hash sign (example: FF0000, FF0000EE) or color name (examples: red, blue)

When removeBackground is set to false, the color will be used to fill padding areas created by outputSize and any transparent areas in the original image.

background.expandPromptanyOptional

If ai.auto, a pre-processing step is applied to expand the prompt into a longer form.

auto and never are legacy values that will be removed in the next major version.

background.guidance.imageFilestring Β· binaryOptional

Bytes of the image to use as a background image guidance. Only available in the POST request

Can't be provided if removeBackground is set to false

The maximum size of the image is 30MB.

background.guidance.scalenumberOptional

How closely the generated background will be matching the guiding image, between 0 and 1.

A value of 1 means it will match the guiding image as much as possible, a value of 0 means the guiding image will be ignored.

(Only working when using the new model)

background.imageFilestring Β· binaryOptional

Bytes of the image to use as a background. Only available in the POST request

Can't be provided if removeBackground is set to false

The maximum size of the image is 30MB.

If background.imageFile is provided, neither background.imageUrl nor background.prompt can be provided, and vice versa.

background.negativePromptstringOptional

(LEGACY) This parameter will only have an effect when using the previous AI Backgrounds model, which is used when setting the header: pr-ai-background-model-version: 2

A negative prompt to use for guiding the background generation process; If provided, the generation algorithm will try to avoid properties listed in the negativePrompt.

background.promptstringOptional

Prompt to use for guiding the background generation process.

Tips for writing high-quality prompts are available in our documentation.

If background.prompt is provided, neither background.imageUrl nor background.imageFile can be provided, and vice versa.

background.scalingstringOptional

Whether the background should fit or fill (default) the output image If set to fit, the empty pixels will be transparent

Can only be provided if background.imageUrl or background.imageFile is provided

background.seednumberOptional

Seed used to generate the background. Can be used to get similar looking results for the same prompt.

beautify.modestringOptional

If enabled, the input image will be beautified (imageFile or imageUrl).

This is intended to enhance product images by automatically improving the aesthetics of the image, such as the lighting, background, and overall appearance.

If set to ai.auto, the input image will be beautified to match the aesthetic of a packshot product image.

If set to ai.food, the input image will be beautified in a way that's specific to food images, such as placing the subject on a plate.

If set to ai.car, the input image will be beautified in a way that's specific to car images, such as removing reflections.

Important:

  • the beautifier will not preserve the original background: we recommend using this option along with removeBackground set to true
  • the beautifier is meant for images of products, food, or cars; we do not recommend using it with subjects such as humans, pets, etc.
beautify.seednumberOptional

Seed used to run the subject beautifier. Can be used to get similar looking results for the same subject.

describeAnyChange.modestringOptional

(DEPRECATED) Use editWithAI.mode instead.

Describe any change mode to use on the main image used by the API.

Currently, only ai.auto is supported.

describeAnyChange.promptstringOptional

(DEPRECATED) Use editWithAI.prompt instead.

The natural language prompt describing the change to apply to the image.

describeAnyChange.seednumberOptional

(DEPRECATED) Use editWithAI.seed instead.

Seed used for the generation. Can be used to get similar looking results for the same prompt.

editWithAI.modestringOptional

Edit with AI mode to use on the main image used by the API.

Currently, only ai.auto is supported.

editWithAI.promptstringOptional

The natural language prompt describing the change to apply to the image.

editWithAI.seednumberOptional

Seed used for the generation. Can be used to get similar looking results for the same prompt.

expand.modestringOptional

Expand mode to use on the main image used by the API.

If set to ai.auto, all transparent pixels will automatically be filled based on the content of the current background (either the original background, if removeBackground has been set to false, or a static background, if background.imageUrl has been provided)

Expand will rely on output size, subject position, and fitting mode.

expand.seednumberOptional

Seed used to generate the background. Can be used to get similar looking results for the same prompt.

export.dpinumberOptional

The pixel density of the result image.

Pixel density can be set to any value between 72 and 1200 dpi.

export.formatstringOptional

The format of the result image.

Default value is "png".

Jpeg exports with a quality of 80 and WebP exports with a quality of 90.

flatLay.modestringOptional

Must be set to ai.auto to enable flat lay generation.

flatLay.promptstringOptional

Optional text prompt to guide the generation style.

flatLay.sizestringOptional

The output size of the generated image.

ghostMannequin.modestringOptional

Must be set to ai.auto to enable ghost mannequin generation.

ghostMannequin.promptstringOptional

Optional text prompt to guide the generation style.

ghostMannequin.sizestringOptional

The output size of the generated image.

horizontalAlignmentstringOptional

[Advanced] Defines the horizontal alignment of the cutout subject within its bounding box.

Specifying a custom horizontal alignment will implicitly set ignorePaddingAndSnapOnCroppedSides to false for the horizontal direction.

ignorePaddingAndSnapOnCroppedSidesbooleanOptional

If set to true (default), cropped sides of the subject will snap to the edges For instance, for a portrait image cropped below the elbows, the subject will be aligned at the bottom even if a bottom padding is provided (but it will still respect bottom margin)

Can't be provided if removeBackground is set to false

(See positioning section of the documentation for more information)

imageFilestring Β· binaryOptional

Bytes of the main image used by the API. The POST endpoint accepts imageFile only.

The maximum size of the image is 30MB.

If you want to send the URL of an image, please instead use the GET endpoint with the argument imageUrl.

imageFromPrompt.promptstringOptional

The prompt to use for generating the image.

imageFromPrompt.seednumberOptional

Seed used to run the AI image generator. Can be used to get similar looking results for the same prompt.

imageFromPrompt.sizestringOptional

Supported sizes for AI image generation

keepExistingAlphaChannelstringOptional

If set to auto and if the image has transparency, the existing transparency will be used to cutout the subject.

layersobjectOptional
lighting.modestringOptional

Lighting mode to use on the main image used by the API.

If set to ai.auto, the lighting will be automatically adjusted

If set to ai.preserve-hue-and-saturation, the lighting will be adjusted while keeping color hues and saturations as close as possible to the original image

marginnumber | stringOptional

General margin around the subject. Can be expressed as a number between 0 and 0.49, a percentage string between 0% and 49% (e.g., "30%"), or a pixel value string (e.g., "100px"). Unlike padding, margin is never ignored even on cropped sides of the subject. Expressed in a ratio of the output image size. See positioning section of the documentation for more information.

Tips to assist with positioning are available in our documentation.

marginBottomnumber | stringOptional

Bottom Margin, overrides general margin on the bottom side. Accepts the same formats as margin.

marginLeftnumber | stringOptional

Left Margin, overrides general margin on the left side. Accepts the same formats as margin.

marginRightnumber | stringOptional

Right Margin, overrides general margin on the right side. Accepts the same formats as margin.

marginTopnumber | stringOptional

Top Margin, overrides general margin on the top side. Accepts the same formats as margin.

maxHeightnumberOptional

Maximum output height. Can only be provided if outputSize is originalImage or croppedSubject. Useful for: redimensioning while keeping the aspect ratio

maxWidthnumberOptional

Maximum output width. Can only be provided if outputSize is originalImage or croppedSubject. Useful for: resizing an image while keeping the aspect ratio

outline.blurRadiusnumberOptional

Blur radius for the outline, creating a glow or soft edge effect. Higher values mean the outline will be more blurred, 0 means no blur.

Minimum: 0, Maximum: 0.025

outline.colorstringOptional

Apply a colored outline around the subject to highlight it. Can be a hex color without the hash sign (example: FF0000, FF0000EE) or color name (examples: red, blue)

outline.widthnumberOptional

Width of the outline relative to the image size. Suggested values:

  • 0.01-0.02: Subtle/thin outline
  • 0.03-0.05: Standard/medium outline (default: 0.03)
  • 0.06-0.1: Bold/thick outline The value represents a ratio where 0.1 (10%) is the maximum thickness.

Minimum: 0, Maximum: 0.1

outputSizestringOptional

Output size of the image. In the form of either:

  • auto to keep the template dimensions when templateId is defined, or behave like originalImage when templateId isn't defined (default)
  • widthxheight for a custom size (example: 200x400)
  • originalImage to keep the original image dimensions
  • croppedSubject to use the size of the foreground dimensions after cropping around it
paddingnumber | stringOptional

General padding around the subject. Can be expressed as a number between 0 and 0.49, a percentage string between 0% and 49% (e.g., "30%"), or a pixel value string (e.g., "100px"). Unlike margin, padding will be ignored on cropped sides of the subject if that option is enabled. Expressed in a ratio of the size of the document, minus margins (similar to CSS). See positioning section of the documentation for more information.

Tips to assist with positioning are available in our documentation.

paddingBottomnumber | stringOptional

Bottom padding, overrides general padding on the bottom side. Accepts the same formats as padding.

paddingLeftnumber | stringOptional

Left padding, overrides general padding on the left side. Accepts the same formats as padding.

paddingRightnumber | stringOptional

Right padding, overrides general padding on the right side. Accepts the same formats as padding.

paddingTopnumber | stringOptional

Top padding, overrides general padding on the top side. Accepts the same formats as padding.

preserveMetadatastringOptional

Controls which metadata from the original image will be preserved in the output image.

  • never: No metadata preservation (default)
  • xmp: Preserve XMP metadata including camera settings, copyright information, and other embedded metadata
  • exifSubset: Preserve EXIF Copyright (IFD0) and UserComment (ExifIFD) fields only. Deprecated β€” use exifSubsetWithXmpCompatibility instead. Will be removed in a future release.
  • exifSubsetWithXmpCompatibility: Same as exifSubset but also writes Copyright and UserComment as XMP fields (dc:rights / exif:UserComment) for applications that read XMP instead of EXIF (e.g. Adobe products, macOS Preview).
referenceBoxstringOptional

[Advanced] subjectBox by default. When set to originalImage, the padding / margin will be around the original image and not the cropped subject.

It can lead to the subject disappearing when scaling is set to 'fill', for instance if the subject is on the left of a landscape image and outputSize is a square.

Most use cases don't require this option. It is useful if you'd like to maintain subject positioning in the original image.

Can't be provided if removeBackground is set to false

(See positioning section of the documentation for more information)

removeBackgroundbooleanOptional

If enabled (default), the background of the image will be removed using PhotoRoom's award-winning algorithm

scalingstringOptional

Whether the subject should fit (default) or fill the output image If set to fit, the empty pixels will be transparent

Can only be provided if imageUrl or imageFile is provided

segmentation.modestringOptional

Controls whether or not the salient object should be kept or ignored by the segmentation model.

segmentation.negativePromptstringOptional

A textual description of what the segmentation should remove.

segmentation.promptstringOptional

A textual description of what the segmentation should keep.

shadow.modestringOptional

Shadow generation mode to use on the main image used by the API. If set to ai.soft, a soft shadow will be generated If set to ai.hard, a hard shadow will be generated If set to ai.floating, a floating shadow will be generated

templateIdstring Β· uuidOptional

The ID of the template to render

textRemoval.modestringOptional

Text removal mode to use on the main image used by the API.

If set to ai.artificial, artificial text will be automatically removed. Artificial text includes all text added on an image through post-precessing, such as company name, watermarks, discount, etc.

If set to ai.natural, natural text will be automatically removed. Natural text includes text that naturally occurs in an image such as writing on buildings or clothings, road signs, etc.

If set to ai.all, all text (natural and artificial) will be automatically removed.

uncrop.modestringOptional

Uncrop mode to use on the main image used by the API.

Currently, only ai.auto is supported. With ai.auto, the subject will be automatically detected and uncropped.

uncrop.seednumberOptional

Seed used to generate the background. Can be used to get similar looking results for the same prompt.

upscale.modestringOptional

(ALPHA) Warning: might get deprecated with a 2 weeks warning

If enabled, the input image will be upscaled (imageFile or imageUrl)

The input image (imageFile or imageUrl) must not exceed 1000x1000 pixels in dimensions when using ai.fast mode. The input image (imageFile or imageUrl) must not exceed 512x512 pixels in dimensions when using ai.slow mode.

The upscaling process will enlarge the input image up to 4 times its original size. This will significantly increase the resolution and affect both the input processing and the final output dimensions.

ai.fast: This algorithm is optimized for speed and may not produce the highest quality results. ai.slow: This algorithm is optimized for quality and may take more time to process.

verticalAlignmentstringOptional

[Advanced] Defines the vertical alignment of the cutout subject within its bounding box.

Specifying a custom vertical alignment will implicitly set ignorePaddingAndSnapOnCroppedSides to false for the vertical direction.

virtualModel.additionalProductImagesarrayOptional

Additional product images showing different angles or details of the same item. These help the model better understand the product and generate more accurate results.

virtualModel.modestringOptional

Must be set to ai.auto to enable virtual model generation.

virtualModel.modelanyOptional

The model (person) to use for the virtual try-on. Either a preset model name or a custom image.

virtualModel.posestringOptional

The pose of the model in the generated image.

virtualModel.promptstringOptional

Optional text prompt to guide the generation style.

virtualModel.qualitystringOptional

The output quality of the generated image. Higher quality produces larger images. standard outputs ~1K, advanced ~2K, and premium ~4K resolution.

virtualModel.sceneanyOptional

The scene (background/environment) to use. Either a preset scene name or a custom image.

virtualModel.sizestringOptional

The output size of the generated image.

Responses
chevron-right
200

OK

image/png
Responsestring Β· binary

The resulting image after rendering

post
/v2/edit

Remove Background (Basic plan)

post

Remove background from an image

Authorizations
x-api-keystringRequired

Get you API Key here

Body
image_filestring Β· binaryRequired

The image file to render

formatstring Β· enumOptional

The format of the resulting image

Default: pngPossible values:
channelsstring Β· enumOptional

The channels of the resulting image

Default: rgbaPossible values:
bg_colorstringOptional

The background color of the resulting image. Can be a hex code (#FF00FF) or a HTML color (red, green, etc.)

sizestring Β· enumOptional

Will resize the output to the specified size. Can be preview (0.25 Megapixels), medium (1.5 MP), hd (4 MP) or full (36 MP, can be slower for large images). Useful for mobile apps that need smaller images.

Default: fullPossible values:
cropstring Β· enumOptional

If true, the image returned is cropped to the cutout border. Transparent pixels are removed from the border

Default: falsePossible values:
despillstring Β· enumOptional

If true, automatically removes colored reflections that have been left on the main subject by a green background.

Default: falsePossible values:
Responses
chevron-right
200

OK

Responsestring Β· binary

The resulting image after rendering

post
/v1/segment

Account Details v2

get

Get current account details, including remaining image edits and monthly quota

Authorizations
x-api-keystringRequired

Get you API Key here

Responses
chevron-right
200

OK

application/json
planstringRequired

The name of the pricing plan

Example: basic
get
/v2/account

Last updated

Was this helpful?