{"openapi":"3.1.0","info":{"title":"BatchVision Image Editor API","description":"Advanced batch image editor with background removal, stroke, filters, and multi-format export. Compatible with GPT Actions and Claude Tools.","version":"1.0.0"},"paths":{"/presets":{"get":{"tags":["info"],"summary":"List Presets","description":"List all available size presets.","operationId":"list_presets_presets_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/remove-background":{"post":{"tags":["background"],"summary":"Api Remove Background","description":"Remove background from one or more images.\n- **color mode** (default): instant flood-fill, perfect for icons/logos with solid backgrounds.\n- **ai mode**: neural network (rembg), best for complex photos. Downloads ~170 MB model on first use.","operationId":"api_remove_background_api_remove_background_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_api_remove_background_api_remove_background_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/remove-background-guided":{"post":{"tags":["background"],"summary":"Api Remove Background Guided","description":"Guided background removal using GrabCut with user-drawn foreground/background hints.\nPaint green over what to KEEP, red over what to REMOVE, then call this endpoint.","operationId":"api_remove_background_guided_api_remove_background_guided_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_api_remove_background_guided_api_remove_background_guided_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/add-stroke":{"post":{"tags":["stroke"],"summary":"Api Add Stroke","description":"Add a stroke/outline around image subjects.","operationId":"api_add_stroke_api_add_stroke_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_api_add_stroke_api_add_stroke_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/filters":{"post":{"tags":["filters"],"summary":"Api Filters","description":"Apply filters and adjustments to images.","operationId":"api_filters_api_filters_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_api_filters_api_filters_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/resize":{"post":{"tags":["transform"],"summary":"Api Resize","description":"Resize images using presets or custom dimensions.","operationId":"api_resize_api_resize_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_api_resize_api_resize_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/watermark":{"post":{"tags":["watermark"],"summary":"Api Watermark","description":"Add text watermark to images.","operationId":"api_watermark_api_watermark_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_api_watermark_api_watermark_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/transform":{"post":{"tags":["transform"],"summary":"Api Transform","description":"Rotate, flip, crop, and pad images.","operationId":"api_transform_api_transform_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_api_transform_api_transform_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/export":{"post":{"tags":["export"],"summary":"Api Export","description":"Export images in multiple formats and sizes, returned as a ZIP.","operationId":"api_export_api_export_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_api_export_api_export_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/batch":{"post":{"tags":["batch"],"summary":"Api Batch","description":"Run a full pipeline of operations on each image.\n\nPipeline is a JSON array of operation objects, e.g.:\n```json\n[\n  {\"op\": \"remove_background\", \"model\": \"u2net\"},\n  {\"op\": \"add_stroke\", \"width\": 8, \"color\": \"#ff0000\"},\n  {\"op\": \"resize\", \"preset\": \"instagram_square\"},\n  {\"op\": \"watermark\", \"text\": \"© Me\", \"position\": \"bottom-right\"},\n  {\"op\": \"filters\", \"brightness\": 1.1, \"contrast\": 1.2}\n]\n```\nReturns a ZIP file with all processed images.","operationId":"api_batch_api_batch_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_api_batch_api_batch_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/download/{filename}":{"get":{"tags":["download"],"summary":"Download File","operationId":"download_file_download__filename__get","parameters":[{"name":"filename","in":"path","required":true,"schema":{"type":"string","title":"Filename"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Body_api_add_stroke_api_add_stroke_post":{"properties":{"files":{"items":{"type":"string","contentMediaType":"application/octet-stream"},"type":"array","title":"Files"},"width":{"type":"integer","title":"Width","description":"Stroke width in pixels","default":10},"color":{"type":"string","title":"Color","description":"Stroke color as hex","default":"#ffffff"},"outside":{"type":"boolean","title":"Outside","default":true},"return_base64":{"type":"boolean","title":"Return Base64","default":false}},"type":"object","required":["files"],"title":"Body_api_add_stroke_api_add_stroke_post"},"Body_api_batch_api_batch_post":{"properties":{"files":{"items":{"type":"string","contentMediaType":"application/octet-stream"},"type":"array","title":"Files"},"pipeline":{"type":"string","title":"Pipeline","description":"JSON array of operations to apply in order"},"output_format":{"type":"string","title":"Output Format","default":"PNG"},"quality":{"type":"integer","title":"Quality","default":95}},"type":"object","required":["files","pipeline"],"title":"Body_api_batch_api_batch_post"},"Body_api_export_api_export_post":{"properties":{"files":{"items":{"type":"string","contentMediaType":"application/octet-stream"},"type":"array","title":"Files"},"formats":{"type":"string","title":"Formats","description":"Comma-separated formats","default":"PNG,WEBP,JPEG"},"quality":{"type":"integer","title":"Quality","default":95},"preset":{"type":"string","title":"Preset","default":"original"},"custom_width":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Custom Width"},"custom_height":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Custom Height"}},"type":"object","required":["files"],"title":"Body_api_export_api_export_post"},"Body_api_filters_api_filters_post":{"properties":{"files":{"items":{"type":"string","contentMediaType":"application/octet-stream"},"type":"array","title":"Files"},"brightness":{"type":"number","title":"Brightness","default":1.0},"contrast":{"type":"number","title":"Contrast","default":1.0},"saturation":{"type":"number","title":"Saturation","default":1.0},"sharpness":{"type":"number","title":"Sharpness","default":1.0},"blur":{"type":"number","title":"Blur","default":0.0},"grayscale":{"type":"boolean","title":"Grayscale","default":false},"invert":{"type":"boolean","title":"Invert","default":false},"sepia":{"type":"boolean","title":"Sepia","default":false},"output_format":{"type":"string","title":"Output Format","default":"PNG"},"quality":{"type":"integer","title":"Quality","default":95},"return_base64":{"type":"boolean","title":"Return Base64","default":false}},"type":"object","required":["files"],"title":"Body_api_filters_api_filters_post"},"Body_api_remove_background_api_remove_background_post":{"properties":{"files":{"items":{"type":"string","contentMediaType":"application/octet-stream"},"type":"array","title":"Files"},"mode":{"type":"string","title":"Mode","description":"'color' = instant flood-fill (icons/logos), 'ai' = neural net (complex photos)","default":"color"},"tolerance":{"type":"integer","title":"Tolerance","description":"Color similarity threshold 0-255 (color mode)","default":30},"bg_hex":{"type":"string","title":"Bg Hex","description":"Background color to remove, e.g. #ffffff. 'auto' samples corners.","default":"auto"},"erode":{"type":"integer","title":"Erode","description":"Shrink edge inward by N pixels (0-10)","default":2},"defringe":{"type":"integer","title":"Defringe","description":"Extra fringe cleanup tolerance (0-60)","default":0},"feather":{"type":"integer","title":"Feather","description":"Edge softness in pixels (0 = hard edge)","default":0},"smart_edges":{"type":"boolean","title":"Smart Edges","description":"Compute proper fractional alpha in transition zone for clean AA edges","default":true},"decontaminate":{"type":"boolean","title":"Decontaminate","description":"Remove background color bleed from edge pixel RGB values","default":true},"replace_color":{"type":"string","title":"Replace Color","description":"Fill removed area with this color, or 'transparent'","default":"transparent"},"model":{"type":"string","title":"Model","description":"AI model (ai mode only): u2net | u2netp | u2net_human_seg | isnet-general-use | silueta","default":"u2net"},"alpha_matting":{"type":"boolean","title":"Alpha Matting","default":false},"alpha_matting_fg":{"type":"integer","title":"Alpha Matting Fg","default":240},"alpha_matting_bg":{"type":"integer","title":"Alpha Matting Bg","default":10},"alpha_matting_erode":{"type":"integer","title":"Alpha Matting Erode","default":10},"only_mask":{"type":"boolean","title":"Only Mask","default":false},"return_base64":{"type":"boolean","title":"Return Base64","default":false}},"type":"object","required":["files"],"title":"Body_api_remove_background_api_remove_background_post"},"Body_api_remove_background_guided_api_remove_background_guided_post":{"properties":{"files":{"items":{"type":"string","contentMediaType":"application/octet-stream"},"type":"array","title":"Files"},"annotations":{"type":"string","title":"Annotations","description":"Base64 PNG annotation overlay — green=keep, red=remove"},"iterations":{"type":"integer","title":"Iterations","description":"GrabCut iterations (1-10, more = slower but better)","default":5},"smart_edges":{"type":"boolean","title":"Smart Edges","default":true},"decontaminate":{"type":"boolean","title":"Decontaminate","default":true},"return_base64":{"type":"boolean","title":"Return Base64","default":true}},"type":"object","required":["files","annotations"],"title":"Body_api_remove_background_guided_api_remove_background_guided_post"},"Body_api_resize_api_resize_post":{"properties":{"files":{"items":{"type":"string","contentMediaType":"application/octet-stream"},"type":"array","title":"Files"},"preset":{"type":"string","title":"Preset","default":"original"},"custom_width":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Custom Width"},"custom_height":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Custom Height"},"output_format":{"type":"string","title":"Output Format","default":"PNG"},"quality":{"type":"integer","title":"Quality","default":95},"return_base64":{"type":"boolean","title":"Return Base64","default":false}},"type":"object","required":["files"],"title":"Body_api_resize_api_resize_post"},"Body_api_transform_api_transform_post":{"properties":{"files":{"items":{"type":"string","contentMediaType":"application/octet-stream"},"type":"array","title":"Files"},"rotate":{"type":"number","title":"Rotate","default":0.0},"rotate_expand":{"type":"boolean","title":"Rotate Expand","default":true},"flip_horizontal":{"type":"boolean","title":"Flip Horizontal","default":false},"flip_vertical":{"type":"boolean","title":"Flip Vertical","default":false},"crop_left":{"type":"integer","title":"Crop Left","default":0},"crop_top":{"type":"integer","title":"Crop Top","default":0},"crop_right":{"type":"integer","title":"Crop Right","default":0},"crop_bottom":{"type":"integer","title":"Crop Bottom","default":0},"pad_top":{"type":"integer","title":"Pad Top","default":0},"pad_right":{"type":"integer","title":"Pad Right","default":0},"pad_bottom":{"type":"integer","title":"Pad Bottom","default":0},"pad_left":{"type":"integer","title":"Pad Left","default":0},"pad_color":{"type":"string","title":"Pad Color","default":"#000000"},"output_format":{"type":"string","title":"Output Format","default":"PNG"},"quality":{"type":"integer","title":"Quality","default":95},"return_base64":{"type":"boolean","title":"Return Base64","default":false}},"type":"object","required":["files"],"title":"Body_api_transform_api_transform_post"},"Body_api_watermark_api_watermark_post":{"properties":{"files":{"items":{"type":"string","contentMediaType":"application/octet-stream"},"type":"array","title":"Files"},"text":{"type":"string","title":"Text","default":"© BatchVision"},"opacity":{"type":"integer","title":"Opacity","default":128},"position":{"type":"string","title":"Position","default":"bottom-right"},"font_size":{"type":"integer","title":"Font Size","default":36},"color":{"type":"string","title":"Color","default":"#ffffff"},"output_format":{"type":"string","title":"Output Format","default":"PNG"},"quality":{"type":"integer","title":"Quality","default":95},"return_base64":{"type":"boolean","title":"Return Base64","default":false}},"type":"object","required":["files"],"title":"Body_api_watermark_api_watermark_post"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}