00Quick start
POST https://api.nullflare.com/ Content-Type: application/json { "key": "YOUR_KEY", "sitekey": "0x4AAAAAAAExampleSitekey", "host": "https://example.com/login" }
Authentication is the key field in the JSON body; no header is read. Keep keys on your server, never in browser JavaScript or a public repository.
01Turnstile
For a Turnstile widget embedded in a page. The sitekey and the page in host must belong together.
Request
{
"key": "YOUR_KEY",
"sitekey": "0x4AAAAAAAExampleSitekey",
"host": "https://example.com/login"
}
Success
{
"status": "ok",
"token": "1.p5ESTZJ-kUZ46gYsJBAdzcVuf8Rysl…",
"elapsedMs": 412,
"remaining": 9814
}
Submit token to the site in the field its widget fills, normally cf-turnstile-response. Tokens are short-lived and single-use. A Turnstile solve uses 1 credit.
If the widget is rendered with action, cData or chlPageData, send the same values, exactly. When Turnstile escalates to an interactive checkbox the solve handles it; the request and response do not change.
02Request fields
| Field | When | Description |
|---|---|---|
key | Always | Your API key. |
host | Always | Full http(s):// URL, at most 8,192 bytes. The page with the widget. |
type | Optional | Turnstile, the default and the only type, in any case. Any other value is refused. |
sitekey | Always | The widget's sitekey. |
proxy | Optional | The proxy every request of this solve goes through. See Proxies. |
action | If the widget has one | The widget's action string. |
cData | If the widget has one | The widget's custom data, value and casing exactly as rendered. |
chlPageData | If the widget has one | The widget's page data, exactly as rendered. |
The body must be a JSON object of at most 256 KiB. Every field is a string; a missing field and null are the same. Values are trimmed. Unknown fields are ignored, but that is not part of the contract.
03Responses
Every response is JSON. Check the HTTP status before reading the body.
| Field | Meaning |
|---|---|
status | ok on success; busy with 503; error otherwise. |
token | The Turnstile token. |
elapsedMs | Time the solve took, in milliseconds. |
remaining | Credits left on the key after this request; null for an unlimited key. |
error | On failures: a readable reason. |
errorCode | On failures: a stable code to branch on (table below). |
04Errors and retries
| HTTP | errorCode | Charged | What to do |
|---|---|---|---|
400 | bad_request | no | Malformed JSON, a missing or invalid field, an unsupported type, an unusable proxy. Fix it; do not retry unchanged. |
401 | missing_key, invalid_key | no | Send a valid key. |
402 | insufficient_credits | no | The key has fewer credits than this solve needs. |
403 | key_suspended | no | The key is suspended. Contact us. |
404 | not_found | no | No such endpoint: solves go to POST /. |
413 | body_too_large | no | The body is over 256 KiB. |
422 | solve_failed | no | The solve ran but produced no token, or did not finish in time. A retry is a new solve. |
429 | concurrency_limit | no | This key has its limit of solves in progress. The body adds concurrencyLimit and inFlight. Retry after Retry-After (1 s). |
503 | node_unavailable | no | No capacity right now. Retry after Retry-After (2 s). |
Only a token is charged. Credits are reserved when a request is accepted and returned on every other outcome, including 422 and a client that hangs up mid-solve.
Solve requests are not idempotent: retrying after a lost connection starts another solve, and both are charged if both succeed. HTTP 502, 504 and Cloudflare 52x pages come from the path between you and the API, not from the API.
05Proxies
http://host:port socks4://host:port socks5://host:port http://username:password@host:port socks5://host:port:username:password
Both credential forms work; in the second, everything after the username is the password, so passwords may contain colons. SOCKS names are resolved at the proxy. SOCKS4 takes a user ID only, no password.
The proxy has to tunnel the connection (HTTP CONNECT or SOCKS). A proxy that terminates TLS itself changes the browser fingerprint the challenge scores, and solves through it fail.
A proxy is optional: a rotating proxy works, and so does none at all.
06Credits, threads and concurrency
Credits cost $0.40 per 1,000: 1 per Turnstile token. They do not expire. To buy credits or get a key, email [email protected] or ask on Discord.
- Credits are spent only by solves that return a token.
- Concurrency is how many of a key's solves may run at once (50 unless agreed otherwise). Past it, requests get 429 straight away, at no cost, and no other key is affected.
- Unlimited keys spend no credits, return
remaining: null, and still have a concurrency limit.
Threaded plans
For steady high volume, a key can run on threads instead of credits: a fixed number of simultaneous solves with unlimited use. Such a key is an unlimited key with that concurrency limit, so the API behaves exactly as above. Threads cost $99 per thread per month, from 5 threads; ask on Discord or by email.
07Timeouts
A request waits up to 20 seconds for free capacity before it gets 503. Once its solve starts, the solve has 90 seconds; past that the API answers 422 solve_failed and returns the credits. Most solves finish far sooner; give your client a timeout of about 120 seconds so it never gives up before the API does.
08Client examples
curl
curl https://api.nullflare.com/ \ --header 'Content-Type: application/json' \ --data '{"key":"YOUR_KEY","sitekey":"0x4AAAAAAAExampleSitekey","host":"https://example.com/login"}'
Python
import os, requests r = requests.post( "https://api.nullflare.com/", json={ "key": os.environ["NULLFLARE_KEY"], "sitekey": "0x4AAAAAAAExampleSitekey", "host": "https://example.com/login", }, timeout=120, ) result = r.json() if r.status_code != 200: raise RuntimeError(f"{r.status_code} {result.get('errorCode')}: {result.get('error')}") token = result["token"]
09Health check
GET https://api.nullflare.com/health {"status":"ok"}
Unauthenticated liveness only: it does not check a key, report capacity, or use credits.
