API Reference (OpenAPI)

Image Editing v2 (Plus plan)

get
/v2/edit

This endpoint processes an image, removing the background if specified, and applies various transformations such as scaling, padding, and margin adjustments. 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. The output size, background color or image, and other parameters can be customized.

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)

Can't be provided if removeBackground is set to false

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

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

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.

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 or food; 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
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:
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.promptstringOptional

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

The size/format of the generated image.

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
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
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:
Responses
200

OK

image/png
Responsestring · binary

The resulting image after rendering

get
/v2/edit
GET /v2/edit HTTP/1.1
Host: image-api.photoroom.com
x-api-key: YOUR_API_KEY
Accept: */*
binary

Image Editing v2 (Plus plan)

post
/v2/edit

This endpoint processes an image, removing the background if specified, and applies various transformations such as scaling, padding, and margin adjustments. It accepts binary data for the image. If you want to send the URL of an image, 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. The output size, background color or image, and other parameters can be customized.

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)

Can't be provided if removeBackground is set to false

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

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

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.

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 or food; 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.

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.

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

The size/format of the generated image.

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

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
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.

Responses
200

OK

image/png
Responsestring · binary

The resulting image after rendering

post
/v2/edit
POST /v2/edit HTTP/1.1
Host: image-api.photoroom.com
x-api-key: YOUR_API_KEY
Content-Type: multipart/form-data
Accept: */*
Content-Length: 1257

{
  "background.blur.mode": "text",
  "background.blur.radius": 1,
  "background.color": "text",
  "background.expandPrompt": null,
  "background.guidance.imageFile": "binary",
  "background.guidance.scale": 1,
  "background.imageFile": "binary",
  "background.negativePrompt": "text",
  "background.prompt": "text",
  "background.scaling": "text",
  "background.seed": 1,
  "beautify.mode": "text",
  "beautify.seed": 1,
  "expand.mode": "text",
  "expand.seed": 1,
  "export.dpi": 1,
  "export.format": "text",
  "horizontalAlignment": "text",
  "ignorePaddingAndSnapOnCroppedSides": true,
  "imageFile": "binary",
  "imageFromPrompt.prompt": "text",
  "imageFromPrompt.seed": 1,
  "imageFromPrompt.size": "text",
  "keepExistingAlphaChannel": "text",
  "layers": {},
  "lighting.mode": "text",
  "margin": 1,
  "marginBottom": 1,
  "marginLeft": 1,
  "marginRight": 1,
  "marginTop": 1,
  "maxHeight": 1,
  "maxWidth": 1,
  "outputSize": "text",
  "padding": 1,
  "paddingBottom": 1,
  "paddingLeft": 1,
  "paddingRight": 1,
  "paddingTop": 1,
  "preserveMetadata": "text",
  "referenceBox": "text",
  "removeBackground": true,
  "scaling": "text",
  "segmentation.mode": "text",
  "segmentation.negativePrompt": "text",
  "segmentation.prompt": "text",
  "shadow.mode": "text",
  "templateId": "123e4567-e89b-12d3-a456-426614174000",
  "textRemoval.mode": "text",
  "uncrop.mode": "text",
  "uncrop.seed": 1,
  "upscale.mode": "text",
  "verticalAlignment": "text"
}
binary

Remove Background (Basic plan)

post
/v1/segment

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
200

OK

Responsestring · binary

The resulting image after rendering

post
/v1/segment
POST /v1/segment HTTP/1.1
Host: image-api.photoroom.com
x-api-key: YOUR_API_KEY
Content-Type: multipart/form-data
Accept: */*
Content-Length: 121

{
  "image_file": "binary",
  "format": "png",
  "channels": "rgba",
  "bg_color": "text",
  "size": "full",
  "crop": "false",
  "despill": "false"
}
binary

Account Details v2

get
/v2/account

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

Authorizations
x-api-keystringRequired

Get you API Key here

Responses
200

OK

application/json
get
/v2/account
GET /v2/account HTTP/1.1
Host: image-api.photoroom.com
x-api-key: YOUR_API_KEY
Accept: */*
{
  "images": {
    "available": 100,
    "subscription": 100
  },
  "plan": "basic"
}

Last updated

Was this helpful?