{
  "openapi": "3.1.0",
  "info": {
    "title": "RemoveHandwriting Developer API",
    "version": "1.0.0",
    "description": "Remove handwriting from an image using the dedicated API domain and Bearer token sent after purchasing an API package.",
    "contact": { "email": "service@removehandwriting.com" }
  },
  "servers": [
    {
      "url": "https://{apiDomain}",
      "variables": {
        "apiDomain": {
          "default": "your-api-domain.example",
          "description": "Replace this placeholder with the dedicated API domain sent after purchase."
        }
      }
    }
  ],
  "security": [{ "bearerAuth": [] }],
  "paths": {
    "/cleanup": {
      "post": {
        "operationId": "cleanupImage",
        "summary": "Remove handwriting from an image",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["media_id"],
                "properties": {
                  "media_id": {
                    "type": "string",
                    "contentEncoding": "base64",
                    "description": "Base64-encoded image bytes with no data URL prefix."
                  },
                  "keep_distortion": {
                    "type": "boolean",
                    "description": "Use false to correct distortion automatically or true to keep the original distortion."
                  },
                  "keep_ori": {
                    "type": "boolean",
                    "description": "Use false to correct the orientation automatically or true to keep the uploaded orientation."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Image processed successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["code", "data"],
                  "properties": {
                    "code": { "const": 0 },
                    "data": {
                      "type": "object",
                      "required": ["data"],
                      "properties": {
                        "data": {
                          "type": "object",
                          "required": ["mediaId"],
                          "properties": {
                            "mediaId": { "type": "string", "contentEncoding": "base64" }
                          }
                        }
                      }
                    },
                    "message": { "type": "string" }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Example status for a business error. See the API documentation for business codes.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["error", "code", "message"],
                  "properties": {
                    "error": { "const": "API_ERROR" },
                    "code": { "type": "integer", "not": { "const": 0 }, "example": 1004 },
                    "message": { "type": "string" }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": { "type": "http", "scheme": "bearer" }
    }
  }
}
