PhotoRoom API

Photography / API Key Intermediate HTTPS
Varies by plan (check documentation)

Overview

PhotoRoom API uses AI to remove backgrounds from product and portrait photos, producing clean PNG images with transparent backgrounds suitable for e-commerce and marketing. It is designed for high-volume batch processing and delivers professional-quality results without manual editing. Simply upload an image with your API key and receive a cutout in seconds.

💡

Beginner Tip

Upload images as multipart/form-data using the image_file field, and you will get back a PNG with the background removed. Use the background_color parameter to replace transparency with a solid color if your target platform does not support PNG transparency.

Available Data

image URLs in multiple sizes
photographer credit
image dimensions
download link
color data
Use case: Integrate remove background from images data into web and mobile applications

Example Response

JSON Response
{
  "id": "Dwu85P9SOIk",
  "urls": {
    "full": "https://images.unsplash.com/photo-...",
    "regular": "https://images.unsplash.com/photo-...?w=1080",
    "thumb": "https://images.unsplash.com/photo-...?w=200"
  },
  "width": 4000,
  "height": 3000,
  "user": {
    "name": "John Doe",
    "username": "johndoe"
  }
}

Field Reference

result_b64 Base64-encoded PNG of the processed image with the background removed; decode this to get the image bytes.
foreground_top Y-coordinate of the top of the detected subject bounding box within the original image.
foreground_left X-coordinate of the left edge of the detected subject bounding box.
foreground_width Width in pixels of the bounding box around the detected subject.
foreground_height Height in pixels of the bounding box around the detected subject.

Implementation Example

// ⚠️ Note: This URL may be a documentation page. Check official docs for actual API endpoint.
const url = "https://www.photoroom.com/api/";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

401 Unauthorized The x-api-key header is missing or the key has no remaining credits.
Obtain your API key from your PhotoRoom dashboard at https://www.photoroom.com/api/ and ensure your account has available credits.
400 Bad Request - missing image The image_file field was not included in the multipart form data.
Always include the image as a multipart field named image_file; sending a URL or JSON body will not work for this API.
Transparent edges or halos The background color is very similar to the subject, causing the AI to over-remove parts of the image.
Use images with clear contrast between subject and background; slightly adjusting lighting or backdrop color before uploading often fixes this.

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 20/20
🔒 Security 15/15
🛠 Developer XP 12/20
✓ Reliability 10/15

Partially tested on Apr 5, 2026

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS UNKNOWN
Category Photography
Difficulty Intermediate
Verified: 2026-04-04

Similar APIs

View All →