# hCaptcha

Examples of hCaptcha
Examples of hCaptcha


# Submit the challenge to NopeCHA

POST https://api.nopecha.com/
Parameter Type Required Value
key String Required NopeCHA subscription key.
type String Required hcaptcha
task String Required Challenge instruction, in English.
image_data Array of String Conditional Required if image_urls is missing. Base64-encoded images. Array size must be 9.
image_urls Array of String Conditional Required if image_data is missing. Valid image URLs. Array size must be 9.
{
    'key': 'MY_NOPECHA_KEY',
    'type': 'hcaptcha',
    'task': 'Please click each image containing a cupcake',
    'image_urls': [
        'https://nopecha.com/image/demo/hcaptcha/0.png',
        'https://nopecha.com/image/demo/hcaptcha/1.png',
        'https://nopecha.com/image/demo/hcaptcha/2.png',
        'https://nopecha.com/image/demo/hcaptcha/3.png',
        'https://nopecha.com/image/demo/hcaptcha/4.png',
        'https://nopecha.com/image/demo/hcaptcha/5.png',
        'https://nopecha.com/image/demo/hcaptcha/6.png',
        'https://nopecha.com/image/demo/hcaptcha/7.png',
        'https://nopecha.com/image/demo/hcaptcha/8.png'
    ]
}
Retrieve solution with the data value
{
    'data': 'IiIHk9IjU1LjAyMiIgd'
}

# Get the solution from NopeCHA

GET https://api.nopecha.com/
Parameter Type Required Value
key String Required NopeCHA subscription key.
id String Required The value of data from POST response.
{
    'key': 'MY_NOPECHA_KEY',
    'id': 'IiIHk9IjU1LjAyMiIgd'
}
AI has solved the challenge
AI has not yet solved the challenge
{
    'data': [
        false, false, true,  // Click on the 3rd image
        false, true, false,  // Click on the 5th image
        true, false, false  // Click on the 7th image
    ]
}
{
    'error': 14,
    'message': 'Incomplete job'
}

# Example code using client libraries

# Install the client using the following command:
# pip install --upgrade nopecha

import nopecha
nopecha.api_key = 'YOUR_API_KEY'

# Call the Recognition API
clicks = nopecha.Recognition.solve(
    type='hcaptcha',
    task='Please click each image containing a cat-shaped cookie.',
    image_urls=[f"https://nopecha.com/image/demo/hcaptcha/{i}.png" for i in range(9)],
)

# Print the grids to click
print(clicks)
// Install the client using the following command:
// npm i nopecha

const { Configuration, NopeCHAApi } = require('nopecha');

const configuration = new Configuration({
    apiKey: 'YOUR_API_KEY',
});
const nopecha = new NopeCHAApi(configuration);

(async () => {
    // Call the Recognition API
    const clicks = await nopecha.solveRecognition({
        type: 'hcaptcha',
        task: 'Please click each image containing a cat-shaped cookie.',
        image_urls: Array.from({length: 9}, (_, i) => `https://nopecha.com/image/demo/hcaptcha/${i}.png`),
    });

    // Print the grids to click
    console.log(clicks);
})();