Skip to main content

Get Image Verification Code

POST 

/auth/v1/captcha/data

API Description

Get RFC 2397 standard inline image data URI for verification code image. The data field in the response parameters contains the image content.

Usage Steps

1. Get Verification Code Image
  • The frontend calls this API to get verification code data.
  • Render image_base64 directly as the <img src> value.
  • Save the returned token in local storage (localStorage recommended).
2. Submit Verification Code, refer to API, Verify Image Verification Code

POST /api/v1/captcha/verify

3. Business API Authorization

Attach the following header in business requests that require verification code protection:

x-captcha-token: d8f7e2a5c6

Request

Responses

Response Headers
    Schema
      data Image Data (string)required

      RFC 2397 standard inline image data URI, including the following parts: protocol header: data: MIME type: image/gif encoding method: base64 actual data: Base64 encoded binary data conforming to RFC 4648

      type Type (string)required

      Enumerated value of resource type: "image" for image resources. Other values are reserved for future expansion.

      token Token (string)required

      The token to be passed to the verification code verification API

      expires_in Expiration Time (integer)required

      Token expiration time, default 300 seconds

    Loading...