Turnstile Token & Session Clearance API
Two dedicated POST endpoints: /v1/token for standalone Turnstile verification tokens (with or without proxy), and /v1/clearance for full-page cf_clearance session cookies over your own proxy.
- Turnstile Token ·
POST /v1/token - $4.50 / 1k (9 cr Your proxy) · $5.00 / 1k (10 cr Default egress)
- Session Clearance ·
POST /v1/clearance - $5.00 / 1k (10 cr · Custom proxy required)
Standard verification (Turnstile Token)
POST /v1/token
Post a sitekey and url to /v1/token (alias /v1/turnstile). Works with default system egress ($5.00 / 1k) or your own custom proxy ($4.50 / 1k).
curl -X POST https://api.astify.dev/v1/token \
-H "Authorization: Bearer $ASTIFY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"sitekey": "0x4AAAAAAABS7vwvV6VFfMcD",
"url": "https://example.com/login"
}'import os
import requests
API_KEY = os.environ["ASTIFY_API_KEY"]
resp = requests.post(
"https://api.astify.dev/v1/token",
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"sitekey": "0x4AAAAAAABS7vwvV6VFfMcD",
"url": "https://example.com/login",
},
timeout=180,
)
resp.raise_for_status()
data = resp.json()
print("credits used:", resp.headers.get("X-Astify-Cost"))
print("token:", data["token"][:32] + "...")const apiKey = process.env.ASTIFY_API_KEY;
const res = await fetch("https://api.astify.dev/v1/token", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
sitekey: "0x4AAAAAAABS7vwvV6VFfMcD",
url: "https://example.com/login",
}),
});
const data = await res.json();
console.log("credits used:", res.headers.get("x-astify-cost"));
console.log("token:", data.token);package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"time"
)
func main() {
payload, _ := json.Marshal(map[string]any{
"sitekey": "0x4AAAAAAABS7vwvV6VFfMcD",
"url": "https://example.com/login",
})
req, _ := http.NewRequest("POST", "https://api.astify.dev/v1/token", bytes.NewReader(payload))
req.Header.Set("Authorization", "Bearer "+os.Getenv("ASTIFY_API_KEY"))
req.Header.Set("Content-Type", "application/json")
client := &http.Client{Timeout: 180 * time.Second}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println("credits:", resp.Header.Get("X-Astify-Cost"))
fmt.Println(string(body))
}Request parameters
| Parameter | Description |
|---|---|
sitekeystring, required | Turnstile widget sitekey (e.g. 0x4AAAAAAABS7vwvV6VFfMcD). |
urlstring, required | Full URL of the page hosting the verification widget. |
proxystring, optional | Optional custom proxy (http://user:pass@host:port, socks5://...). Passing a proxy lowers the cost to 9 credits ($4.50/1k). |
actionstring, optional | Optional widget action parameter if configured by the target site. |
cDatastring, optional | Optional widget cData string if configured by the target site. |
Example response
{
"success": true,
"ok": true,
"token": "0.aB3dEf9gHiJkLmNoPqRsTuVwXyZ…(1024 chars)",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
"proxyMode": "managed",
"requiresIpConsistency": false,
"tookMs": 3420
}Session credential (Clearance)
POST /v1/clearance
Post a protected url together with your custom proxy to /v1/clearance. Returns cf_clearance and the exact userAgent bound to your proxy IP ($5.00 / 1k).
requiresIpConsistency: true
curl -X POST https://api.astify.dev/v1/clearance \
-H "Authorization: Bearer $ASTIFY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/",
"proxy": "http://user:[email protected]:8080"
}'import os
import requests
API_KEY = os.environ["ASTIFY_API_KEY"]
resp = requests.post(
"https://api.astify.dev/v1/clearance",
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"url": "https://example.com/",
"proxy": "http://user:[email protected]:8080",
},
timeout=180,
)
resp.raise_for_status()
data = resp.json()
print("credits used:", resp.headers.get("X-Astify-Cost"))
# Reuse the EXACT same proxy and returned userAgent with cf_clearance:
proxy = "http://user:[email protected]:8080"
session = requests.Session()
session.proxies = {"http": proxy, "https": proxy}
session.headers["User-Agent"] = data["userAgent"]
session.cookies.set("cf_clearance", data["cf_clearance"], domain="example.com")
page = session.get("https://example.com/")const apiKey = process.env.ASTIFY_API_KEY;
const res = await fetch("https://api.astify.dev/v1/clearance", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
url: "https://example.com/",
proxy: "http://user:[email protected]:8080",
}),
});
const data = await res.json();
console.log("credits used:", res.headers.get("x-astify-cost"));
// Reuse the exact same proxy and data.userAgent on every request carrying data.cf_clearance.
console.log("cf_clearance:", data.cf_clearance);package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"time"
)
func main() {
payload, _ := json.Marshal(map[string]any{
"url": "https://example.com/",
"proxy": "http://user:[email protected]:8080",
})
req, _ := http.NewRequest("POST", "https://api.astify.dev/v1/clearance", bytes.NewReader(payload))
req.Header.Set("Authorization", "Bearer "+os.Getenv("ASTIFY_API_KEY"))
req.Header.Set("Content-Type", "application/json")
client := &http.Client{Timeout: 180 * time.Second}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println("credits:", resp.Header.Get("X-Astify-Cost"))
fmt.Println(string(body))
}Request parameters
| Parameter | Description |
|---|---|
urlstring, required | Protected target page URL that issues a cf_clearance cookie. |
proxystring, required | Required custom proxy (http://user:pass@host:port, socks5://...). Must be non-empty to keep IP, User-Agent, and fingerprint consistent. |
IP & UA consistency
Session clearance cookies are bound to the exact exit IP, User-Agent, and TLS fingerprint that solved the challenge.
- The
proxyparameter is strictly mandatory on/v1/clearance— requests withoutproxyare rejected with HTTP400(proxy_required) at 0 cost. - Send every follow-up request through the exact same static/sticky proxy and include the returned
userAgentheader. - Avoid rotating proxies between the
/v1/clearancecall and your subsequent requests.
Response fields
| Field | Description |
|---|---|
successboolean | true when a clearance cookie was obtained. A false response costs 0 credits. |
cf_clearancestring | The cf_clearance cookie value to attach to your target domain. |
cookiesobject | Key-value map of returned session cookies (including cf_clearance). |
userAgentstring | The exact User-Agent bound to cf_clearance. Send it on every follow-up request. |
proxyMode"own" | Always own for /v1/clearance. |
requiresIpConsistencyboolean | Always true — follow-up requests must reuse the exact same proxy IP and userAgent. |
tookMsnumber | End-to-end solve duration in milliseconds. |
Example response
{
"success": true,
"ok": true,
"cf_clearance": "q7Yw0mJ1c2V…xNzMxNTg1NjAw-1.2.1.1",
"cookies": {
"cf_clearance": "q7Yw0mJ1c2V…xNzMxNTg1NjAw-1.2.1.1"
},
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
"proxyMode": "own",
"requiresIpConsistency": true,
"tookMs": 5180
}Billing and errors
- A call that fails costs 0 credits.
X-Astify-Costreports the cost either way. X-Astify-CostandX-Astify-Balancecome back on every response, so you never need a second call to check your balance.- Over your concurrency limit the API returns
429with aRetry-Afterheader. - Out of credits returns
402. Nothing is charged.
X-Astify-Cost X-Astify-BalanceFull error reference
Questions
What is the difference between /v1/token and /v1/clearance?
/v1/token solves Turnstile widgets and returns a single-use verification token (token), supporting both system default egress ($5.00/1k) and custom proxy ($4.50/1k). /v1/clearance solves full-page managed challenges and returns cf_clearance + userAgent ($5.00/1k), strictly requiring your custom proxy.
Why does /v1/clearance require a custom proxy?
Because cf_clearance is bound to the exact exit IP, User-Agent, and fingerprint that solved the challenge. Requiring your own proxy ensures your subsequent requests exit from the exact same IP.
What proxy formats are supported?
http://user:pass@host:port, https://..., socks5://..., or host:port / user:pass@host:port.
What happens if a solve fails?
The response has success: false and an error code, X-Astify-Cost is 0, and your balance does not change.
Start with 100 free credits
Verify your email and the trial credits are in your balance.
Not for buying tickets, creating accounts in bulk, testing credentials or logging in to financial accounts. Read the acceptable-use rules