{"openapi":"3.0.3","info":{"title":"RMBG PRO Processing API","version":"1.0.0","description":"Gateway migration. Install the gateway database tables; use the existing dedicated server processing key or deploy the internal Python contract. Legacy clients remain supported by the legacy host during transition."},"servers":[{"url":"https://rmbg.pro/api"}],"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","in":"header","name":"X-API-KEY"}},"schemas":{"Error":{"type":"object","required":["success","error","code","request_id"],"properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"string"},"code":{"type":"string"},"request_id":{"type":"string"}}}}},"paths":{"/remove-background":{"post":{"summary":"Remove an image background","description":"Requires image or image_file. PNG/JPEG/WebP, 20 MB per file, 40 megapixels, non-animated. Maximum multipart body 65 MB. RemoveBackground service cost (default 1), reserved atomically and refunded on failure. Rate: 60 requests/minute/account, maximum 4 pending operations. No URL imports or return_type=link. Website UI routes have a separate free policy.","security":[{"ApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","schema":{"type":"string","maxLength":128},"description":"Reuse for identical retries. Retained until explicit operator cleanup; use a new key for a new operation."}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"image":{"type":"string","format":"binary"},"image_file":{"type":"string","format":"binary","description":"Legacy alias for image."},"return_type":{"type":"string","enum":["base64","binary"],"default":"base64"},"output_format":{"type":"string","enum":["png","jpeg","jpg","webp"],"default":"png"},"custom_bg_color":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$"},"custom_bg_image":{"type":"string","format":"binary"},"logo":{"type":"string","format":"binary"},"position_logo":{"type":"string","enum":["left-top","center-top","right-top","left-center","center-center","right-center","left-bottom","center-bottom","right-bottom"]},"logo_position":{"type":"string","description":"Alias of position_logo; top-left style values are also accepted."},"logo_size_percentage":{"type":"number","exclusiveMinimum":true,"minimum":0,"maximum":100}}}}}},"responses":{"200":{"description":"Success. Image: binary image or JSON image_base64. PDF: existing text/markdown JSON fields. JSON adds request_id and usage. Headers include X-Request-ID and Idempotency-Replayed.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}},"image/png":{"schema":{"type":"string","format":"binary"}},"image/jpeg":{"schema":{"type":"string","format":"binary"}},"image/webp":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"INVALID_REQUEST","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"INSUFFICIENT_CREDITS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"IDEMPOTENCY_CONFLICT / REQUEST_IN_PROGRESS / REQUEST_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"FILE_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"UNSUPPORTED_MEDIA_TYPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"PROCESSING_INPUT_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMIT_EXCEEDED (Retry-After: 60)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"PROCESSING_SERVICE_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"SERVICE_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"PROCESSING_TIMEOUT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/change-background":{"post":{"summary":"Remove and replace a background","description":"Requires image or image_file. PNG/JPEG/WebP, 20 MB per file, 40 megapixels, non-animated. Maximum multipart body 65 MB. RemoveBackground service cost (default 1), reserved atomically and refunded on failure. Rate: 60 requests/minute/account, maximum 4 pending operations. No URL imports or return_type=link. Website UI routes have a separate free policy. Requires custom_bg_color or custom_bg_image.","security":[{"ApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","schema":{"type":"string","maxLength":128},"description":"Reuse for identical retries. Retained until explicit operator cleanup; use a new key for a new operation."}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"image":{"type":"string","format":"binary"},"image_file":{"type":"string","format":"binary","description":"Legacy alias for image."},"return_type":{"type":"string","enum":["base64","binary"],"default":"base64"},"output_format":{"type":"string","enum":["png","jpeg","jpg","webp"],"default":"png"},"custom_bg_color":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$"},"custom_bg_image":{"type":"string","format":"binary"},"logo":{"type":"string","format":"binary"},"position_logo":{"type":"string","enum":["left-top","center-top","right-top","left-center","center-center","right-center","left-bottom","center-bottom","right-bottom"]},"logo_position":{"type":"string","description":"Alias of position_logo; top-left style values are also accepted."},"logo_size_percentage":{"type":"number","exclusiveMinimum":true,"minimum":0,"maximum":100}}}}}},"responses":{"200":{"description":"Success. Image: binary image or JSON image_base64. PDF: existing text/markdown JSON fields. JSON adds request_id and usage. Headers include X-Request-ID and Idempotency-Replayed.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}},"image/png":{"schema":{"type":"string","format":"binary"}},"image/jpeg":{"schema":{"type":"string","format":"binary"}},"image/webp":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"INVALID_REQUEST","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"INSUFFICIENT_CREDITS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"IDEMPOTENCY_CONFLICT / REQUEST_IN_PROGRESS / REQUEST_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"FILE_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"UNSUPPORTED_MEDIA_TYPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"PROCESSING_INPUT_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMIT_EXCEEDED (Retry-After: 60)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"PROCESSING_SERVICE_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"SERVICE_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"PROCESSING_TIMEOUT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/pdf/to-text":{"post":{"summary":"Convert PDF to-text","description":"PDF only, maximum 15 MB; selectable text required. Zero credit cost. Active API key required. Same account rate and concurrency limits as image processing. No OCR. JSON includes text or markdown, filename, counts, warnings, request_id and usage.","security":[{"ApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","schema":{"type":"string","maxLength":128},"description":"Reuse for identical retries. Retained until explicit operator cleanup; use a new key for a new operation."}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"}},"required":["file"]}}}},"responses":{"200":{"description":"Success. Image: binary image or JSON image_base64. PDF: existing text/markdown JSON fields. JSON adds request_id and usage. Headers include X-Request-ID and Idempotency-Replayed.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}},"image/png":{"schema":{"type":"string","format":"binary"}},"image/jpeg":{"schema":{"type":"string","format":"binary"}},"image/webp":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"INVALID_REQUEST","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"INSUFFICIENT_CREDITS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"IDEMPOTENCY_CONFLICT / REQUEST_IN_PROGRESS / REQUEST_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"FILE_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"UNSUPPORTED_MEDIA_TYPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"PROCESSING_INPUT_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMIT_EXCEEDED (Retry-After: 60)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"PROCESSING_SERVICE_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"SERVICE_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"PROCESSING_TIMEOUT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/pdf/to-markdown":{"post":{"summary":"Convert PDF to-markdown","description":"PDF only, maximum 15 MB; selectable text required. Zero credit cost. Active API key required. Same account rate and concurrency limits as image processing. No OCR. JSON includes text or markdown, filename, counts, warnings, request_id and usage.","security":[{"ApiKey":[]}],"parameters":[{"in":"header","name":"Idempotency-Key","schema":{"type":"string","maxLength":128},"description":"Reuse for identical retries. Retained until explicit operator cleanup; use a new key for a new operation."}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"}},"required":["file"]}}}},"responses":{"200":{"description":"Success. Image: binary image or JSON image_base64. PDF: existing text/markdown JSON fields. JSON adds request_id and usage. Headers include X-Request-ID and Idempotency-Replayed.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}},"image/png":{"schema":{"type":"string","format":"binary"}},"image/jpeg":{"schema":{"type":"string","format":"binary"}},"image/webp":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"INVALID_REQUEST","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"INVALID_API_KEY","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"INSUFFICIENT_CREDITS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"FORBIDDEN","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"NOT_FOUND","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"IDEMPOTENCY_CONFLICT / REQUEST_IN_PROGRESS / REQUEST_FAILED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"FILE_TOO_LARGE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"UNSUPPORTED_MEDIA_TYPE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"PROCESSING_INPUT_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"RATE_LIMIT_EXCEEDED (Retry-After: 60)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"502":{"description":"PROCESSING_SERVICE_ERROR","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"SERVICE_UNAVAILABLE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"PROCESSING_TIMEOUT","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}