API reference · Editing

Remove background

POSThttps://api.imagemcpserver.com/playground/remove-background
💳 8 credits🛠️ MCP tool: remove_backgroundimagemcp.js remove_bg

Runs a dedicated cut-out model over your image and returns the subject on a transparent background. This is the endpoint to use for catalogue photography, avatars and any asset that has to composite onto another layout.

Overview

Strip the background from an image and return a transparent PNG.

Flat 8 credits per call, regardless of image size.

Request

Headers

FieldTypeDescription
AuthorizationrequiredstringBearer <IMAGEMCP_API_KEY>. The header x-api-key: <key> is accepted as an alternative.
Content-Typerequiredstringapplication/json

Body parameters

FieldTypeDescription
imagerequiredstringInput image as an https URL or a base64 data URI. imageBase64 is accepted as an alias for the same value.
promptstringOptional note recorded with the request. It does not steer the cutout.
responseFormat"url" | "b64_json"Defaults to "url". Pass "b64_json" to also receive result.b64_json and result.imageBase64 alongside the hosted URL.

Examples

The same call in five forms. The MCP tab is what an MCP client sends under the hood; the CLI tab is what an agent with the agent skill runs.

remove_background
curl -X POST "https://api.imagemcpserver.com/playground/remove-background" \
  -H "Authorization: Bearer $IMAGEMCP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "image": "https://example.com/product.jpg"
}'

Response

Response fields

FieldTypeDescription
result.imageUrlstringTransparent PNG cut-out.
result.actionstring"remove_bg".
deductedCreditsnumberAlways 8.
userCreditsnumberBalance remaining after the call.
200 OK
{
  "success": true,
  "message": "Background removed successfully",
  "deductedCredits": 8,
  "userCredits": 2439,
  "result": {
    "imageUrl": "https://cdn.imagemcpserver.com/bgrem/bgrem_6251423.png",
    "prompt": "Remove background",
    "action": "remove_bg",
    "hasInputImage": true,
    "model": "fal-ai/feynobg",
    "seed": 610233,
    "latency": "2.74s",
    "cost": "$0.0250",
    "deductedCredits": 8,
    "userCredits": 2439
  }
}

When it fails

Errors return success: false with a message. See errors & troubleshooting for the status codes and whether a retry is worth it.

FAQ

What does background removal cost?

A flat 8 credits per call — it does not vary with image size or the model you have selected elsewhere.

Can I send a local file?

Send it as a base64 data URI in the image field. Both https URLs and data URIs are accepted.