API documentation
Everything you need to call the Turnstile token, session clearance, and JavaScript deobfuscation APIs — or connect via MCP.
Plain-text version of this page
Overview
Astify is a REST API. Send JSON over HTTPS to https://api.astify.dev, authenticate with Authorization: Bearer <API_KEY> (or x-api-key), and read each call's cost from the response headers.
Endpoints are abstracted by capability: /v1/token for Turnstile verification tokens, /v1/clearance for proxy-bound session clearance cookies, and /v1/deobfuscate for JavaScript code restoration.
| POST /v1/token | Turnstile Token (/v1/token) |
| POST /v1/clearance | Session Clearance (/v1/clearance) |
| POST /v1/deobfuscate | Deobfuscation (/v1/deobfuscate) |
Authentication
Create an API key in your dashboard and send it via `Authorization: Bearer <key>` or `x-api-key: <key>` on every request. Keep it on your server: anyone holding the key can spend your credits.
Authorization: Bearer $ASTIFY_API_KEY
# or:
x-api-key: $ASTIFY_API_KEYTurnstile Token (/v1/token)
POST https://api.astify.dev/v1/token
Returns a single-use Turnstile verification token (POST /v1/token, alias POST /v1/turnstile). Supports both default system egress (10 credits / $5.00 per 1k) and custom proxy (9 credits / $4.50 per 1k).
Request
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))
}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. |
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
}Response fields
| Field | Description |
|---|---|
successboolean | true when a valid token was obtained. A false response costs 0 credits. |
tokenstring | Single-use verification token (valid for ~5 minutes). |
userAgentstring | User-Agent used during verification. |
proxyMode"own" | "managed" | own if you passed proxy, managed if system default egress was used. |
requiresIpConsistencyboolean | Always false for /v1/token. |
tookMsnumber | End-to-end solve duration in milliseconds. |
Session Clearance (/v1/clearance)
POST https://api.astify.dev/v1/clearance
Returns a cf_clearance cookie and bound userAgent (POST /v1/clearance). Strictly requires a custom proxy parameter so your follow-up requests preserve IP, User-Agent, and fingerprint consistency. Fixed cost: 10 credits ($5.00 per 1k).
Request
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))
}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. |
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
}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. |
Deobfuscation (/v1/deobfuscate)
POST https://api.astify.dev/v1/deobfuscate
Returns readable source for obfuscated JavaScript. Uses dynamic complexity-based pricing (lines of code, complexity multiplier, and detected obfuscator), starting from 2,000 credits ($1.00).
Request
curl -X POST https://api.astify.dev/v1/deobfuscate \
-H "Authorization: Bearer $ASTIFY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"code": "var _0x4a2b=[\"\\x6c\\x6f\\x67\"];console[_0x4a2b[0]](\"hi\");"
}'import os
import requests
API_KEY = os.environ["ASTIFY_API_KEY"]
resp = requests.post(
"https://api.astify.dev/v1/deobfuscate",
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"code": "var _0x4a2b=[\"\\x6c\\x6f\\x67\"];console[_0x4a2b[0]](\"hi\");",
},
timeout=180,
)
resp.raise_for_status()
data = resp.json()
print("credits used:", resp.headers.get("X-Astify-Cost"))
print(data["code"])const apiKey = process.env.ASTIFY_API_KEY;
const res = await fetch("https://api.astify.dev/v1/deobfuscate", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
code: "var _0x4a2b=[\"\\x6c\\x6f\\x67\"];console[_0x4a2b[0]](\"hi\");",
}),
});
const data = await res.json();
console.log("credits used:", res.headers.get("x-astify-cost"));
console.log(data.code);package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"time"
)
func main() {
payload, _ := json.Marshal(map[string]any{
"code": "var _0x4a2b=[\"\\x6c\\x6f\\x67\"];console[_0x4a2b[0]](\"hi\");",
})
req, _ := http.NewRequest("POST", "https://api.astify.dev/v1/deobfuscate", 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))
}Parameters
| Parameter | Description |
|---|---|
codestring, required | JavaScript source, up to 30 MB. |
Response
{
"success": true,
"code": "console.log(\"hi\");",
"bytesIn": 58,
"bytesOut": 19,
"credits": 2000
}Response fields
| Field | Description |
|---|---|
successboolean | true when readable source was produced. A false response costs 0 credits. |
codestring | The readable source. |
bytesInnumber | Size of the input in bytes. |
bytesOutnumber | Size of the output in bytes. |
creditsnumber | Dynamic complexity-based credits charged for this file (minimum 2,000 credits). |
MCP (Model Context Protocol)
Connect Astify to Claude Desktop, Cursor, or Claude Code via https://astify.dev/mcp. Authenticate with either a Dashboard API Key (Authorization: Bearer <API_KEY>) or OAuth 2.1.
Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"astify": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://astify.dev/mcp",
"--header",
"Authorization: Bearer <YOUR_ASTIFY_API_KEY>"
]
}
}
}Cursor / Claude Code (Streamable HTTP)
{
"mcpServers": {
"astify": {
"type": "http",
"url": "https://astify.dev/mcp",
"headers": {
"Authorization": "Bearer <YOUR_ASTIFY_API_KEY>"
}
}
}
}Exposed MCP tools: solve_turnstile, solve_clearance, analyze_javascript, submit_deobfuscation, get_job_status, get_deobfuscation_result, and get_account_info.
Billing headers
Every response carries two headers, whether the call succeeded or not.
| Header | Meaning |
|---|---|
X-Astify-Cost | Credits charged for this call. 0 when the call failed. |
X-Astify-Balance | Credits left in your balance after this call. |
Errors
Errors use standard HTTP status codes and a JSON body with success: false and an error object. A failed call is never charged.
| Status | Meaning |
|---|---|
400 | Invalid JSON, missing required field, or missing proxy on /v1/clearance (proxy_required). |
401 | The API key is missing or not valid. |
402 | Not enough credits. Top up with crypto in the dashboard, then retry. |
422 | Request schema validation failed. |
424 | The solve failed upstream. Not charged (0 credits), safe to retry. |
429 | Too many requests in flight for your concurrency limit. Wait the Retry-After seconds, then retry. |
Concurrency
Each account has a limit on requests in flight: 2 by default, more with a concurrency pack. A request over the limit gets 429 and a Retry-After header with the seconds to wait.
Deobfuscation engine
Astify can detect and handle a wide range of obfuscation techniques used by popular JavaScript obfuscators.
Patterns it detects
hex-identifiers | Hexadecimal variable and function names like _0x1a2b |
string-encryption | Encrypted or encoded strings with runtime decryption |
control-flow-flattening | Switch-based control flow with state machines |
dead-code | Unreachable code injected to confuse analysis |
opaque-predicates | Always-true/false conditions that obscure logic |
debug-protection | Code that detects and blocks debugging attempts |
self-defending | Self-modifying code that breaks when formatted |
domain-lock | Code that only runs on specific domains |
eval-usage | Dynamic code execution using eval() |
unicode-escape | Unicode escape sequences for strings |
Obfuscators it recognises
| Obfuscator.io | Most popular open-source JavaScript obfuscator |
| JScrambler | Enterprise-grade code protection service |
| JavaScript-Obfuscator | Node.js obfuscation library |
| Webpack / Bundlers | Bundled and minified code from build tools |
Limits
| Maximum file size | 30 MB |
| Supported file types | .js, .mjs, .cjs |
| File retention period | 7 days |