{
  "openapi": "3.1.0",
  "info": {
    "title": "AMAM Captcha Recognition API",
    "description": "AI-powered captcha recognition service supporting 70+ captcha types including text, slider, rotation, click-selection, calculation, trajectory, OCR, Google reCAPTCHA, and hCaptcha.",
    "version": "1.0.0",
    "contact": {
      "name": "AMAM Support",
      "url": "https://amam.easysu.cn"
    }
  },
  "servers": [
    {
      "url": "http://verifycode.easysu.cn/consumer",
      "description": "Production API Server"
    }
  ],
  "paths": {
    "/api/commonIdentify": {
      "post": {
        "operationId": "commonIdentify",
        "summary": "General Captcha Recognition",
        "description": "Primary endpoint for most captcha types. Supports text, slider, rotation, click-selection, calculation, trajectory, and OCR types.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CommonIdentifyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Recognition result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecognitionResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/slider/doubleImage": {
      "post": {
        "operationId": "sliderDoubleImage",
        "summary": "Dual-Image Slider Recognition",
        "description": "For slider captchas with separate background and slide images. Returns pixel distance from left edge to correct gap position.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SliderDoubleImageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Slider recognition result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecognitionResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/rotate/doubleImage": {
      "post": {
        "operationId": "rotateDoubleImage",
        "summary": "Dual-Circle Rotation Recognition",
        "description": "For rotation captchas with separate outer ring and inner circle images. Returns clockwise degrees (0-360) for inner circle alignment.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RotateDoubleImageRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Rotation recognition result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecognitionResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/google/funnel": {
      "post": {
        "operationId": "googleFunnel",
        "summary": "Google reCAPTCHA / hCaptcha Token Acquisition",
        "description": "Async endpoint for obtaining tokens. Use /api/google/funnelResult to poll for results.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GoogleFunnelRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Token acquisition initiated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecognitionResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/google/funnelResult": {
      "post": {
        "operationId": "googleFunnelResult",
        "summary": "Get Token Result (Google reCAPTCHA)",
        "description": "Poll for the result of a Google reCAPTCHA token request. For hCaptcha (type 50013), use the separate endpoint: http://api.jfbym.com/api/YmServer/funnelApiResult with the same parameters.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FunnelResultRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Token result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecognitionResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/slider900010": {
      "post": {
        "operationId": "slider900010",
        "summary": "Protocol Slider (slide_traffic)",
        "description": "For protocol-based slider captchas requiring data, href, and seed parameters.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Slider900010Request"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Protocol slider result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecognitionResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/ai-recognition": {
      "post": {
        "operationId": "aiRecognition",
        "summary": "AI Recognition",
        "description": "AI-powered recognition for invoice processing and image information extraction.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AiRecognitionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "AI recognition result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecognitionResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/getBalance": {
      "post": {
        "operationId": "getBalance",
        "summary": "Check Account Balance",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["appKey"],
                "properties": {
                  "appKey": {
                    "type": "string",
                    "description": "System-issued appKey"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Balance info",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecognitionResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/applyRefund": {
      "post": {
        "operationId": "applyRefund",
        "summary": "Error Refund Request",
        "description": "Request refund for incorrect recognition. Only supported types allow refund within 3 hours. Do not abuse — accounts may be frozen.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["appKey", "uniqueCode"],
                "properties": {
                  "appKey": {
                    "type": "string",
                    "description": "System-issued appKey"
                  },
                  "uniqueCode": {
                    "type": "string",
                    "description": "uniqueCode from recognition response"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Refund result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecognitionResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CommonIdentifyRequest": {
        "type": "object",
        "required": ["appKey", "type"],
        "properties": {
          "appKey": { "type": "string", "description": "System-issued appKey" },
          "type": {
            "type": "string",
            "description": "Captcha type code",
            "enum": [
              "10110", "10111", "10112", "10113", "10103", "15294", "10211", "10201",
              "10114", "10115", "10116", "10117", "10118", "10107",
              "20110", "20225", "22222", "20226",
              "90007", "900011",
              "30100", "300010", "30103", "30112", "30116", "6246", "30111",
              "30104", "30105", "30332", "30340",
              "30106", "30107", "30114",
              "30109", "30110", "50009", "30101", "30108",
              "30008", "30115", "30221", "30330",
              "88888", "30009", "31001", "51001",
              "50100", "50101", "50106", "50103",
              "100015", "100016",
              "ocr_001", "ocr_002", "ocr_003", "ocr_004", "ocr_005",
              "ocr_006", "ocr_007", "ocr_008", "ocr_009", "ocr_010", "ocr_011"
            ]
          },
          "image": { "type": "string", "description": "Captcha image in base64 (without data:image prefix)" },
          "extra": { "type": "string", "description": "Additional info, required by some types (e.g. click order, color, description)" },
          "direction": { "type": "string", "enum": ["top", "bottom"], "description": "Hint position for type 30332/30009" },
          "click_num": { "type": "string", "description": "Number of coordinates to return (type 30332)" },
          "label_image": { "type": "string", "description": "Small reference image base64 (type 30008)" },
          "image2": { "type": "string", "description": "Second image base64 (type 30330)" },
          "benefitRecommendCode": { "type": "string", "description": "Referral code for cashback tracking" }
        }
      },
      "SliderDoubleImageRequest": {
        "type": "object",
        "required": ["appKey", "type", "backgroundImage", "slideImage"],
        "properties": {
          "appKey": { "type": "string", "description": "System-issued appKey" },
          "type": { "type": "string", "enum": ["20111"], "description": "Must be 20111" },
          "backgroundImage": { "type": "string", "description": "Background image base64" },
          "slideImage": { "type": "string", "description": "Slide piece image base64" },
          "benefitRecommendCode": { "type": "string", "description": "Referral code" }
        }
      },
      "RotateDoubleImageRequest": {
        "type": "object",
        "required": ["appKey", "type", "outRingImage", "innerCircleImage"],
        "properties": {
          "appKey": { "type": "string", "description": "System-issued appKey" },
          "type": { "type": "string", "enum": ["90004", "411115"], "description": "90004 (custom) or 411115 (general)" },
          "outRingImage": { "type": "string", "description": "Outer ring image base64" },
          "innerCircleImage": { "type": "string", "description": "Inner circle image base64" },
          "benefitRecommendCode": { "type": "string", "description": "Referral code" }
        }
      },
      "GoogleFunnelRequest": {
        "type": "object",
        "required": ["appKey", "type", "googleKey", "pageUrl"],
        "properties": {
          "appKey": { "type": "string", "description": "System-issued appKey" },
          "type": { "type": "string", "enum": ["40010", "40011", "50013"], "description": "40010=reCAPTCHA v2, 40011=v3, 50013=hCaptcha" },
          "googleKey": { "type": "string", "description": "data-sitekey value from target page" },
          "pageUrl": { "type": "string", "description": "URL of the page with captcha" },
          "invisible": { "type": "string", "enum": ["0", "1"], "description": "Visibility type, default 1" },
          "proxy": { "type": "string", "description": "Proxy string" },
          "proxyType": { "type": "string", "enum": ["HTTP", "HTTPS", "SOCKS4", "SOCKS5"] },
          "enterprise": { "type": "string", "enum": ["0", "1"], "description": "Enterprise version, default 0" },
          "action": { "type": "string", "description": "reCaptcha v3 action value" },
          "dataS": { "type": "string", "description": "v2 enterprise required, empty string if not found" },
          "minScore": { "type": "string", "description": "v3 score 0.1-0.9" },
          "benefitRecommendCode": { "type": "string", "description": "Referral code" }
        }
      },
      "FunnelResultRequest": {
        "type": "object",
        "required": ["appKey", "captchaId", "recordId"],
        "properties": {
          "appKey": { "type": "string", "description": "System-issued appKey" },
          "captchaId": { "type": "string", "description": "captchaId from funnel response" },
          "recordId": { "type": "string", "description": "recordId from funnel response" }
        }
      },
      "Slider900010Request": {
        "type": "object",
        "required": ["appKey", "type", "data", "href", "seed"],
        "properties": {
          "appKey": { "type": "string", "description": "System-issued appKey" },
          "type": { "type": "string", "enum": ["900010"], "description": "Must be 900010" },
          "data": { "type": "string", "description": "data JSON string" },
          "href": { "type": "string", "description": "Current page URL" },
          "seed": { "type": "string", "description": "seed value" },
          "benefitRecommendCode": { "type": "string", "description": "Referral code" }
        }
      },
      "AiRecognitionRequest": {
        "type": "object",
        "required": ["appKey", "type"],
        "properties": {
          "appKey": { "type": "string", "description": "System-issued appKey" },
          "type": {
            "type": "string",
            "enum": ["image_info_extract", "invoice_01", "invoice_02", "invoice_03", "invoice_04"],
            "description": "AI recognition type"
          },
          "image": { "type": "string", "description": "Image base64 (required for image_info_extract)" },
          "extra": { "type": "string", "description": "Comma-separated field names to extract (required for image_info_extract)" },
          "content": {
            "type": "array",
            "description": "Content list (required for invoice types)",
            "items": { "$ref": "#/components/schemas/ContentItem" }
          },
          "benefitRecommendCode": { "type": "string", "description": "Referral code" }
        }
      },
      "ContentItem": {
        "type": "object",
        "properties": {
          "type": { "type": "integer", "enum": [0, 1], "description": "0=text, 1=file" },
          "fileName": { "type": "string", "description": "Original filename (required for type=1)" },
          "content": { "type": "string", "description": "Text content (type=0) or file URL (type=1)" },
          "mimeType": { "type": "string", "description": "MIME type (optional)" }
        }
      },
      "RecognitionResponse": {
        "type": "object",
        "properties": {
          "code": { "type": "integer", "description": "Response code (响应码), 200 for success" },
          "msg": { "type": "string", "description": "Response message" },
          "success": { "type": "boolean" },
          "data": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/IdentifyVO" }
          }
        }
      },
      "IdentifyVO": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "description": "Recognition status code: 10000=success, 10001=param error, 10002=insufficient balance, 10003=no permission, 10004=invalid type, 10005=network congestion, 10006=data overload, 10007=service busy, 10008=network error, 10009=result preparing, 10010=request ended"
          },
          "data": { "type": "string", "description": "Recognition result: text for chars, pixel distance for sliders, degrees for rotation, coordinates for click types" },
          "time": { "type": "string", "description": "Processing time in ms" },
          "uniqueCode": { "type": "string", "description": "Unique request identifier (use for refund requests)" }
        }
      }
    }
  }
}
