# Cloudflare Turnstile

Example of Cloudflare Turnstile
Example of Cloudflare Turnstile


# Submit the CAPTCHA to NopeCHA

POST https://api.nopecha.com/token/
Parameter Type Required Description
key String Required NopeCHA subscription key.
type String Required turnstile
sitekey String Required Turnstile data-sitekey.
url String Required URL where the Turnstile is found.
data Dict Optional Extra parameters used to solve the challenge. See data.* parameters below. Turnstile Documentation
data.action String Optional The value of the data-action attribute of the Turnstile element if it exists.
data.cdata String Optional The value of the data-cdata attribute of the Turnstile element if it exists.
proxy Dict Optional The proxy used to solve the challenge. See using proxies for formatting guide.
cookie Array of Dict Optional Cookies used to solve the challenge. See using cookies for formatting guide.
useragent String Optional The user-agent used to solve the challenge. A user-agent of a modern browser is required.
{
    'key': 'MY_NOPECHA_KEY',
    'type': 'turnstile',
    'sitekey': '0x4AAAAAAAA-1LUipBaoBpsG',
    'url': 'https://nopecha.com/demo/turnstile'
}
Retrieve solution with the data value
{
    'data': '0n8mly8iy4R0aD0'
}

# Get the token from NopeCHA

GET https://api.nopecha.com/token/
Parameter Type Required Value
key String NopeCHA subscription key.
id String The value of data from POST response.
{
    'key': 'MY_NOPECHA_KEY',
    'id': '0n8mly8iy4R0aD0'
}
AI has generated the token
AI has not yet generated the token
{
    'data': '0.Q3KEnCNLje1Te3Chlglb9yDlKhKgsPcS3oP8zbggWgrRkdJTHHS...'
}
{
    '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 Token API
token = nopecha.Token.solve(
    type='turnstile',
    sitekey='0x4AAAAAAAA-1LUipBaoBpsG',
    url='https://nopecha.com/demo/turnstile',
    data={
        'action': 'login',
        'cdata': '0000-1111-2222-3333-example-cdata',
    },
    proxy={
        'scheme': 'http',
        'host': '131.171.136.193',
        'port': '7234',
        'username': 'EhV1AVUbhK',
        'password': 'DJ96p39v9z',
    }
)

# Print the token
print(token)
// 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 Token API
    const token = await nopecha.solveToken({
        type: 'turnstile',
        sitekey: '0x4AAAAAAAA-1LUipBaoBpsG',
        url: 'https://nopecha.com/demo/turnstile',
        data: {
            action: 'login',
            cdata: '0000-1111-2222-3333-example-cdata',
        },
        proxy: {
            scheme: 'http',
            host: '131.171.136.193',
            port: '7234',
            username: 'EhV1AVUbhK',
            password: 'DJ96p39v9z',
        },
    });

    // Print the token
    console.log(token);
})();