{
  "openapi": "3.1.0",
  "info": {
    "title": "BackGone Background Removal API",
    "version": "1.0.0",
    "summary": "One image in, a transparent PNG or WebP out. Prepaid API credits.",
    "description": "Public background-removal API. One image per call; one API credit is charged per successful image and failed calls are not charged. The same engine also powers the website and the MCP server at /mcp. Prices below are the prepaid API top-up packs; website subscriptions are a separate purse. BackGone is an AI-powered image background removal platform with a web application, REST API, and MCP server. Hosted commercial service: free daily use, paid subscriptions and never-expiring credit packs, and prepaid API credits. The engine is a commercially licensed hosted model; BackGone does not use non-commercial-licensed models such as RMBG-1.4. Official facts: https://backgone.com/about.",
    "termsOfService": "https://backgone.com/terms-of-service",
    "contact": {
      "name": "BackGone support",
      "email": "support@backgone.com",
      "url": "https://backgone.com/developers"
    },
    "license": {
      "name": "Proprietary — service use only"
    }
  },
  "servers": [
    {
      "url": "https://backgone.com"
    }
  ],
  "tags": [
    {
      "name": "Background removal",
      "description": "Image in, transparent PNG/WebP out."
    },
    {
      "name": "Configuration",
      "description": "Public, read-only site configuration."
    },
    {
      "name": "Agents",
      "description": "MCP endpoint for AI agents."
    }
  ],
  "paths": {
    "/api/v1/remove": {
      "post": {
        "tags": [
          "Background removal"
        ],
        "operationId": "removeBackground",
        "summary": "Remove the background from one image",
        "description": "Send exactly one of `image_file` (multipart file) or `image_url` (public https URL fetched server-side).\nUpload ceiling: 10 MB per image, plus a megapixel gate.\nCosts 1 API credit on success; a failed call is not charged.\nPNG is the default output; `format=webp` returns a transparent WebP (lower megapixel ceiling). JPG output is deliberately not offered — a filled background is a website feature.\nOptional `Idempotency-Key` header: a replay of the same image is answered without a second charge.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional replay protection. Reusing a key with a different image returns 409; replaying the same image is not charged twice.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "image_file": {
                    "type": "string",
                    "format": "binary",
                    "description": "PNG, JPEG or WebP image bytes."
                  },
                  "image_url": {
                    "type": "string",
                    "format": "uri",
                    "description": "Public https:// URL. Fetched server-side with SSRF protection."
                  },
                  "format": {
                    "type": "string",
                    "enum": [
                      "png",
                      "webp"
                    ],
                    "default": "png"
                  }
                },
                "oneOf": [
                  {
                    "required": [
                      "image_file"
                    ]
                  },
                  {
                    "required": [
                      "image_url"
                    ]
                  }
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Transparent image.",
            "headers": {
              "x-backgone-credits-charged": {
                "description": "API credits charged for this call (0 on replays).",
                "schema": {
                  "type": "integer"
                }
              },
              "x-backgone-credits-remaining": {
                "description": "API credit balance after this call.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/webp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input (bad body, unsupported type, invalid format).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient API credits — top up first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Idempotency conflict or key reuse with a different image.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "413": {
            "description": "Image too large (bytes or megapixels).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "The engine ran but found no subject in the image.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited (minimum 200ms between calls; per-key daily ceiling).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "502": {
            "description": "Upstream provider error. Retry; not charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "API paused, daily budget exhausted, or temporarily unavailable.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/config/public": {
      "get": {
        "tags": [
          "Configuration"
        ],
        "operationId": "getPublicConfig",
        "summary": "Public site configuration",
        "description": "Read-only, cacheable configuration: enabled auth providers, enabled payment providers and whether analytics is configured. Contains no secrets.",
        "responses": {
          "200": {
            "description": "Public configuration.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "tags": [
          "Agents"
        ],
        "operationId": "mcpEndpoint",
        "summary": "MCP (Model Context Protocol) endpoint",
        "description": "Streamable HTTP MCP endpoint used by AI agents. Single POST endpoint; JSON-RPC 2.0; no sessions, no GET stream.\nSupported protocol versions: 2026-07-28, 2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05. Legacy initialize handshake accepted.\nFree tools: check_photo_requirements, get_pricing. Paid tool: remove_background (Authorization: Bearer sk_... ; 1 API credit per successful image).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              },
              "examples": {
                "toolsList": {
                  "summary": "List tools",
                  "value": {
                    "jsonrpc": "2.0",
                    "id": 1,
                    "method": "tools/list",
                    "params": {
                      "_meta": {
                        "io.modelcontextprotocol/protocolVersion": "2026-07-28",
                        "io.modelcontextprotocol/clientInfo": {
                          "name": "example",
                          "version": "1.0.0"
                        },
                        "io.modelcontextprotocol/clientCapabilities": {}
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC response (single object or batch array)."
          },
          "202": {
            "description": "Notification accepted (no response body)."
          },
          "405": {
            "description": "GET is not offered; use POST."
          }
        },
        "x-mcp": {
          "transport": "streamable-http",
          "protocolVersions": [
            "2026-07-28",
            "2025-11-25",
            "2025-06-18",
            "2025-03-26",
            "2024-11-05"
          ],
          "serverInfo": {
            "name": "backgone",
            "title": "BackGone Background Removal",
            "version": "1.0.0"
          },
          "auth": {
            "scheme": "bearer",
            "description": "Only remove_background requires an API key. The free data tools work without one."
          },
          "tools": [
            {
              "name": "check_photo_requirements",
              "title": "Passport / ID photo requirements",
              "description": "Free. Returns the official passport or ID photo requirements for a country (printed size, head height, background, digital file rules, whether editing is allowed, the official source URL and the date we verified it). Call without a country to list the countries covered. No API key needed.",
              "inputSchema": {
                "type": "object",
                "properties": {
                  "country": {
                    "type": "string",
                    "description": "Country slug, e.g. \"us\", \"uk\", \"cn\", \"ca\", \"fr\", \"au\", \"nz\", \"in\", \"sg\", \"jp\", \"kr\", \"schengen\". Omit to list all supported countries."
                  },
                  "locale": {
                    "type": "string",
                    "enum": [
                      "en",
                      "zh"
                    ],
                    "default": "en",
                    "description": "Language for the answer text."
                  }
                },
                "additionalProperties": false
              }
            },
            {
              "name": "get_pricing",
              "title": "BackGone pricing",
              "description": "Free. Returns the current BackGone prices: API credit top-up packs (one image = one API credit, credits never expire) and the website subscription/credit-pack tiers. No API key needed.",
              "inputSchema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "all",
                      "api",
                      "site"
                    ],
                    "default": "all",
                    "description": "Which prices to return: api = API top-ups, site = subscriptions and credit packs, all = both."
                  }
                },
                "additionalProperties": false
              }
            },
            {
              "name": "remove_background",
              "title": "Remove an image background",
              "description": "Removes the background from one image with BackGone’s production engine and returns a transparent PNG (or WebP) inline. Costs 1 API credit on success; failed calls are not charged. Requires an API key sent as \"Authorization: Bearer sk_...\" — create one at https://backgone.com/settings/apikeys and top up API credits at https://backgone.com/pricing. Provide exactly one of image_url or image_base64.",
              "inputSchema": {
                "type": "object",
                "properties": {
                  "image_url": {
                    "type": "string",
                    "description": "Public HTTPS URL of a PNG, JPEG or WebP image. Fetched server-side with SSRF protection."
                  },
                  "image_base64": {
                    "type": "string",
                    "description": "Base64-encoded image bytes (PNG, JPEG or WebP; up to 10 MB). A data: URL prefix is also accepted. Use this when the image is local to the agent."
                  },
                  "format": {
                    "type": "string",
                    "enum": [
                      "png",
                      "webp"
                    ],
                    "default": "png",
                    "description": "Output format. PNG is the default; WebP is smaller and capped at a lower megapixel limit."
                  }
                },
                "additionalProperties": false
              }
            }
          ],
          "x-mcp-pricing": [
            {
              "productId": "api_10",
              "priceUsd": 10,
              "credits": 300,
              "usdPerImage": 0.0333,
              "expires": false
            },
            {
              "productId": "api_29",
              "priceUsd": 29,
              "credits": 1000,
              "usdPerImage": 0.029,
              "expires": false
            },
            {
              "productId": "api_99",
              "priceUsd": 99,
              "credits": 4000,
              "usdPerImage": 0.0248,
              "expires": false
            },
            {
              "productId": "api_299",
              "priceUsd": 299,
              "credits": 15000,
              "usdPerImage": 0.0199,
              "expires": false
            }
          ]
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key from /settings/apikeys. Site credits cannot be used; top up API credits at /pricing."
      }
    },
    "schemas": {
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "description": "-1 on error"
          },
          "message": {
            "type": "string",
            "description": "Machine-prefixed human message, e.g. \"invalid_api_key\", \"insufficient_credits: ...\""
          }
        },
        "required": [
          "code",
          "message"
        ]
      }
    }
  },
  "x-backgone": {
    "freeTier": {
      "anonymousImagesPerDay": 2,
      "accountImagesPerDay": 5,
      "freeOutputMaxDimension": 1024
    },
    "apiPricing": [
      {
        "productId": "api_10",
        "priceUsd": 10,
        "credits": 300,
        "usdPerImage": 0.0333,
        "expires": false
      },
      {
        "productId": "api_29",
        "priceUsd": 29,
        "credits": 1000,
        "usdPerImage": 0.029,
        "expires": false
      },
      {
        "productId": "api_99",
        "priceUsd": 99,
        "credits": 4000,
        "usdPerImage": 0.0248,
        "expires": false
      },
      {
        "productId": "api_299",
        "priceUsd": 299,
        "credits": 15000,
        "usdPerImage": 0.0199,
        "expires": false
      }
    ],
    "docs": "https://backgone.com/developers",
    "mcp": "https://backgone.com/mcp",
    "llms": "https://backgone.com/llms.txt"
  }
}