Refresh a Captcha

Refresh an existing captcha and return a new captcha for user verification.

Request URL

POST {base_url}/uc-auth/api/v1/public/captcha/refresh

Request parameters

Parameter Required Type Description
type Yes String The type of captcha to retrieve.

Valid value:

  • TEXT: A text-based captcha.
  • SLIDER: A slider-based captcha.
oldCaptchaId No String The identifier of the existing captcha to refresh.
Note:
  • This parameter is typically used when you want to invalidate the old captcha immediately and generate a new one. You can obtain the old captcha ID using the Get a Captcha interface.
  • If this parameter is not provided, a new captcha is generated, and the old captcha expires automatically 5 minutes after it is created.

Response parameters

Parameter Type Description
requestId String The unique ID of the request, which can be used to quickly locate the request.
code String The HTTP status code of the request.
  • 200: Request succeeded.
  • Non-200 value: Request failed.
message String The status message of the request.
detailMessage String The detailed error information.

When the request is successful, this parameter returns empty.

result Object<Captcha_Info> The refreshed captcha information.
Captcha_Info
Parameter Type Description
captchaId String The unique identifier of the captcha.
captchaType String The type of captcha returned.
  • TEXT: A text-based captcha.
  • SLIDER: A slider-based captcha.
captchaImage String The Base64-encoded captcha image data.
Note: Returned when type is TEXT.
backgroundImage String The Base64-encoded background image of the slider puzzle.
Note: Returned when type is SLIDER.
sliderImage String The Base64-encoded slider piece image of the slider puzzle.
Note: Returned when type is SLIDER.
yposition Integer The vertical position of the slider piece on the background image.
Note: Returned when type is SLIDER.

Example

Request example

POST /uc-auth/api/v1/public/captcha/refresh?type=TEXT HTTP/1.1
Host: api.cn.novoone.com

Response example

HTTP/1.1 200 OK
{
  "requestId": "d6647eab47cebc4a2f715d7297b743aa",
  "code": "200",
  "message": "success",
  "result": {
    "captchaId": "5b2c8fc735da4f488fb33f9c035bf5a3",
    "captchaType": "TEXT",
    "captchaImage": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAAoCAIAAAC6iKly..."
  }
}
Note: The captchaImage field contains a complete Base64-encoded PNG image data (approximately 3,000 characters). The value shown above is abbreviated.