API reference

NullFlare API

One endpoint for Turnstile tokens. Every solve is synchronous: the result comes back on the request that asked for it.

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

FieldWhenDescription
keyAlwaysYour API key.
hostAlwaysFull http(s):// URL, at most 8,192 bytes. The page with the widget.
typeOptionalTurnstile, the default and the only type, in any case. Any other value is refused.
sitekeyAlwaysThe widget's sitekey.
proxyOptionalThe proxy every request of this solve goes through. See Proxies.
actionIf the widget has oneThe widget's action string.
cDataIf the widget has oneThe widget's custom data, value and casing exactly as rendered.
chlPageDataIf the widget has oneThe 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.

FieldMeaning
statusok on success; busy with 503; error otherwise.
tokenThe Turnstile token.
elapsedMsTime the solve took, in milliseconds.
remainingCredits left on the key after this request; null for an unlimited key.
errorOn failures: a readable reason.
errorCodeOn failures: a stable code to branch on (table below).

04Errors and retries

HTTPerrorCodeChargedWhat to do
400bad_requestnoMalformed JSON, a missing or invalid field, an unsupported type, an unusable proxy. Fix it; do not retry unchanged.
401missing_key, invalid_keynoSend a valid key.
402insufficient_creditsnoThe key has fewer credits than this solve needs.
403key_suspendednoThe key is suspended. Contact us.
404not_foundnoNo such endpoint: solves go to POST /.
413body_too_largenoThe body is over 256 KiB.
422solve_failednoThe solve ran but produced no token, or did not finish in time. A retry is a new solve.
429concurrency_limitnoThis key has its limit of solves in progress. The body adds concurrencyLimit and inFlight. Retry after Retry-After (1 s).
503node_unavailablenoNo 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.