Run CAPTCHA-solving actors on Apify with DeathByCaptcha
Apify actors are containers that fetch, parse and store data at scale. The moment an actor meets a CAPTCHA, the run stalls: the page returns a challenge, the parser receives an HTML wall instead of a document, and the dataset keeps growing with holes.
DeathByCaptcha solves the challenge from inside the actor. This guide ships a runnable actor that does exactly that, and shows how to use the same call inside your own.
The actor
It lives in the official Node.js client:
examples/apify/
Push it to your Apify account with the CLI:
cd examples/apify
npm install
apify-cli push
The actor takes one captcha task, solves it through the DeathByCaptcha API and stores one item in the run dataset.
Input
{
"type": 4,
"params": {
"googlekey": "6Le...",
"pageurl": "https://example.test/"
}
}
type: DeathByCaptcha type — 4 reCAPTCHA v2, 5 reCAPTCHA v3, 12 Turnstile, 16 Amazon WAF, 21 DataDome, 0 image (withimageas base64).params: the parameters for that type. The actor picks the right*_paramskey from the type, the same way the API clients do.timeout: optional seconds; the defaults are sixty for images and a hundred twenty for tokens.
Output
One dataset item per run:
{ "type": 4, "captcha": 1210686518, "text": "0cAFcWeA7..." }
The next step in your pipeline reads $item.text and injects it into the
page, or sends it to the API that gated your data.
Credentials
Actor secrets, never in the input and never in the repository:
DBC_USERNAMEandDBC_PASSWORD, orDBC_AUTHTOKEN.
In the Apify console: Settings → Secrets.
The exit IP matters
Turnstile, Amazon WAF and DataDome tokens are valid only from the IP that
solved them. The actor solves from the Apify exit IP, so the document you
fetch afterwards must come from that same IP. If your own crawler runs
elsewhere, put the same proxy in params for both:
{
"type": 16,
"params": {
"sitekey": "...",
"pageurl": "https://example.test/",
"proxy": "http://user:[email protected]:1234",
"proxytype": "HTTP"
}
}
Run it locally
No Apify token needed for a local run:
cd examples/apify
npm install
mkdir -p storage/key_value_stores/default
cat > storage/key_value_stores/default/INPUT.json <<'JSON'
{ "type": 4, "params": { "googlekey": "6Le...", "pageurl": "https://example.test/" } }
JSON
DBC_USERNAME=your_username DBC_PASSWORD=your_password npm start
The result lands in storage/datasets/default/000000001.json.
Using it from your own actor
The same logic is one function; the example keeps the client injected so
you can copy src/solve.js into your actor:
const { solveCaptcha } = require('./solve');
const solution = await solveCaptcha({ client, type: 4, params });
await Actor.pushData({ type: 4, captcha: solution.captcha, text: solution.text });
The client is the official deathbycaptcha-lib, with retries and the
polling defaults already in place.
Things to know
- The store listing waits for the Apify rules check; the code here is the same code that gets pushed.
- Image challenges need
imageas base64; the actor does not download images for you. - Failed solves are failures: the actor exits with an error instead of writing an empty token, so your run's monitoring sees them.
Next steps
- Actor source and guide: https://github.com/deathbycaptcha/deathbycaptcha-api-client-nodejs
- Agent metadata for code generators: https://github.com/deathbycaptcha/deathbycaptcha-agent-api-metadata
- API documentation: https://deathbycaptcha.com/api

Portuguese
English
Spanish
Russian
Chinese
French
Hindi
Arabic
Bengali
Indonesian
com, 