The translation was generated automatically and may contain mistakes

Error with Captcha

If a user performs an action too often, such as sending messages, the API VKontakte can return an error with the code 14 and text "Captcha needed" .

JSON
{ "error_code": 14, "error_msg": "Captcha needed" }

This means that the user must confirm that he is not a bot — to pass the captcha. To do this, you need to process the error and display the captcha. If the user has successfully passed the verification, VK ID Captcha will return the data to you for confirmation. This data needs to be specified in the request from your application to the API VKontakte to perform the action that caused the error.

To handle an error, you must have a pre-connect VK ID Captcha SDK .

Error Handling

In the error of captcha, in addition to error_code and error_msg The parameter is returned. redirect_uri A link to initialize a captcha session that contains a session token.

Captcha processing without parameter redirect_uri Using the session ID captcha_sid and image references captcha_img It is no longer supported. Use the processing with redirect_uri described in this section.

After receiving the "Captcha needed" error, ask the user to pass the captcha, and then repeat the request to the VK ID Captcha SDK, adding to it success_token A captcha success token that returns the VK ID Captcha SDK. More specifically, in instructions for Connection .

If you are using a script server-to-server interaction , you need to send a parameter value along with the token remixstlid which you got in the captcha error.

More about the parameters — in the section Error Parameters .

Example of Error

JSON
{ "error": { "error_code": 14, "error_msg": "Captcha needed", "request_params": [ { "key": "method", "value": "users.get" }, { "key": "oauth", "value": "1" }, { "key": "v", "value": "5.131" } ], "redirect_uri": "https://id.vk.com/not_robot_captcha?domain=vk.com&session_token=eyJhbGcikIjozH.0PlWiuiqx3xDGkxfjX3Khg&variant=popup&blank=1", "remixstlid": 9069780796616521905     } }

Error Parameters

Parameters with asterisk (*) - outdated, can return if you previously used error handling without a parameter redirect_uri : using the session identifier captcha_sid and image references captcha_img . Now this method is not supported - connect VK ID Captcha SDK and handle the captcha error using redirect_uri .

Parameter
Description, example
error_code
It always matters 14 .
error_msg
It always matters Captcha needed .
request_params
The structure of the parameters you passed in the request. Format: "key": "value"
redirect_uri
A link to initialize a captcha session that contains the session token and all the necessary metadata: • domain The domain on which the captcha will be used. • session_token A captcha session token. Life time is 5 minutes. • variant Type of captcha display: block or popup . Format of reference: https://id.vk.ru/not_robot_captcha?variant=(popup/block)&domain=(parent_domain)&session_token=(token_value)
remixstlid
Temporary user ID. Used only in the script server-to-server interaction with VK ID Captcha. When the user has passed the captcha, send the value remixstlid in a repeated request to the VKontakte API, together with success_token .
captcha_sid *
Captcha session ID. Example: 575877115543
is_refresh_enabled *
The parameter shows whether a captcha refresh button is displayed in the interface. Values available: • true The button Update the picture displayed. • false The button Update the picture hidden.
captcha_img *
A link to an image that needs to be shown to the user to enter text from that image. Example: https://vk.ru/captcha.php?sid=575877115543&source=api_users_get&app_id=0&device_id=&s=1&resized=1
captcha_track *
The parameter contains a reference to the sound track. It comes back if is_sound_captcha_available = true .
captcha_ts *
Service Parameter.
captcha_attempt *
The number of captcha attempts. Example: 1
captcha_ratio *
The aspect ratio of the captcha picture. Example: 2.6
is_sound_captcha_available *
The parameter shows whether the interface has a button to switch from a captcha picture to a sound captcha. Values available: • true The button is displayed. • false The button is not displayed.

Example of Error

JSON
{ "error": { "error_code": 14, "error_msg": "Captcha needed", "request_params": [ { "key": "method", "value": "users.get" }, { "key": "oauth", "value": "1" }, { "key": "v", "value": "5.131" } ], "redirect_uri": "", "captcha_sid": "575877115543", "remixstlid": 9069780796616521905, "is_refresh_enabled": false, "captcha_img": "https://vk.ru/captcha.php?sid=575877115543&source=api_users_get&app_id=0&device_id=&s=1&resized=1", "captcha_ts": 1738590926.995, "captcha_attempt": 1, "captcha_ratio": 2.6, "is_sound_captcha_available": false     } }