Getting CAPTCHA details
- In the management console
, select the folder containing your CAPTCHA. - Navigate to SmartCaptcha.
- Select the CAPTCHA you need. You can check the CAPTCHA details on the Overview page.
If you do not have the Yandex Cloud CLI yet, install and initialize it.
The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also specify a different folder for any command using --folder-name or --folder-id. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.
-
See the description of the CLI command for viewing CAPTCHA details:
yc smartcaptcha captcha get --help -
Getting a list of available CAPTCHAs:
yc smartcaptcha captcha listResult:
+----------------------+---------+---------------------+------------+----------------+----------------+-------------+ | ID | NAME | CREATED | COMPLEXITY | PRE-CHECK TYPE | CHALLENGE TYPE | RULES COUNT | +----------------------+---------+---------------------+------------+----------------+----------------+-------------+ | bpne29ifsca8******** | test | 2025-02-24 17:16:13 | MEDIUM | CHECKBOX | IMAGE_TEXT | 0 | | bpnm7lhokq2t******** | prod | 2025-02-26 09:12:02 | MEDIUM | CHECKBOX | IMAGE_TEXT | 0 | | bpn43btuo4g9******** | website | 2025-02-26 09:12:42 | MEDIUM | CHECKBOX | IMAGE_TEXT | 0 | +----------------------+---------+---------------------+------------+----------------+----------------+-------------+ -
Get CAPTCHA details by running the CLI command with its name or ID specified:
yc smartcaptcha captcha get <captcha_ID>Result:
id: bpne29ifsca8******** folder_id: b1geoelk7fld******** cloud_id: b1gia87mbaom******** client_key: ysc1_MtyvvAUieCSUfHb6tugqFAbTyesgGzXWU50sZq0E******** created_at: "2025-02-24T17:16:13.034742Z" name: test allowed_sites: - example.com complexity: MEDIUM pre_check_type: CHECKBOX challenge_type: IMAGE_TEXT
With Terraform
Terraform is distributed under the Business Source License
For more information about the provider resources, see the relevant documentation on the Terraform
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
To get CAPTCHA details using Terraform:
-
Add the
dataandoutputsections to the Terraform configuration file:data "yandex_smartcaptcha_captcha" "my-captcha" { captcha_id = "<captcha_ID>" } output "my-client-key" { value = data.yandex_smartcaptcha_captcha.my-captcha.client_key }Where:
data "yandex_smartcaptcha_captcha": Description of the CAPTCHA as a data source:resource_id: Resource identifier.
output "ref_description": Output variable with the client key (client_key) details:value: Return value.
You can replace
client_keywith another variable to get the information you need. To learn more about theyandex_smartcaptcha_captchadata source properties, see this Terraform provider guide. -
Create the required resources:
-
In the terminal, navigate to the configuration file directory.
-
Make sure the configuration is correct using this command:
terraform validateIf the configuration is valid, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.
-
Apply the configuration changes:
terraform apply -
Type
yesand press Enter to confirm the changes.
Terraform will create all required resources and display their output variables. To check the results, run this command:
terraform outputResult:
my-client-key = ysc1_MtyvvAUieCSUfHb6tugqFAbTyesgGzXWU50sZq0E******** ... -
To get CAPTCHA details, use the get REST API method for the Captcha resource or the CaptchaService/Get gRPC API call.