# API documentation Everything you need to call the Turnstile token, session clearance, and JavaScript deobfuscation APIs — or connect via MCP. https://astify.dev/docs ## Overview Astify is a REST API. Send JSON over HTTPS to `https://api.astify.dev`, authenticate with `Authorization: Bearer ` (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 ` or `x-api-key: ` on every request. Keep it on your server: anyone holding the key can spend your credits. ``` Authorization: Bearer $ASTIFY_API_KEY x-api-key: $ASTIFY_API_KEY ``` ## Turnstile 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). ### Parameters - sitekey (string, required): Turnstile widget sitekey (e.g. `0x4AAAAAAABS7vwvV6VFfMcD`). - url (string, required): Full URL of the page hosting the verification widget. - proxy (string, optional): Optional custom proxy (`http://user:pass@host:port`, `socks5://...`). Passing a proxy lowers the cost to 9 credits ($4.50/1k). - action (string, optional): Optional widget `action` parameter if configured by the target site. - cData (string, optional): Optional widget `cData` string if configured by the target site. ### Request cURL ``` 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" }' ``` Python ``` 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] + "...") ``` Node.js ``` 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); ``` Go ``` 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)) } ``` ### Response ```json { "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 - success (boolean): `true` when a valid token was obtained. A `false` response costs 0 credits. - token (string): Single-use verification token (valid for ~5 minutes). - userAgent (string): User-Agent used during verification. - proxyMode ("own" | "managed"): `own` if you passed `proxy`, `managed` if system default egress was used. - requiresIpConsistency (boolean): Always `false` for `/v1/token`. - tookMs (number): 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). ### Parameters - url (string, required): Protected target page URL that issues a `cf_clearance` cookie. - proxy (string, required): Required custom proxy (`http://user:pass@host:port`, `socks5://...`). Must be non-empty to keep IP, User-Agent, and fingerprint consistent. ### Request cURL ``` 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:pass@198.51.100.7:8080" }' ``` Python ``` 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:pass@198.51.100.7: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:pass@198.51.100.7: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/") ``` Node.js ``` 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:pass@198.51.100.7: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); ``` Go ``` 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:pass@198.51.100.7: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)) } ``` ### Response ```json { "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 - success (boolean): `true` when a clearance cookie was obtained. A `false` response costs 0 credits. - cf_clearance (string): The `cf_clearance` cookie value to attach to your target domain. - cookies (object): Key-value map of returned session cookies (including `cf_clearance`). - userAgent (string): The exact User-Agent bound to `cf_clearance`. Send it on every follow-up request. - proxyMode ("own"): Always `own` for `/v1/clearance`. - requiresIpConsistency (boolean): Always `true` — follow-up requests must reuse the exact same proxy IP and `userAgent`. - tookMs (number): End-to-end solve duration in milliseconds. ### IP & UA consistency requiresIpConsistency: true Session clearance cookies are bound to the exact exit IP, User-Agent, and TLS fingerprint that solved the challenge. - The `proxy` parameter is strictly mandatory on `/v1/clearance` — requests without `proxy` are rejected with HTTP `400` (`proxy_required`) at 0 cost. - Send every follow-up request through the exact same static/sticky proxy and include the returned `userAgent` header. - Avoid rotating proxies between the `/v1/clearance` call and your subsequent requests. ## 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). ### Parameters - code (string, required): JavaScript source, up to 30 MB. ### Request cURL ``` 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\");" }' ``` Python ``` 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"]) ``` Node.js ``` 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); ``` Go ``` 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)) } ``` ### Response ```json { "success": true, "code": "console.log(\"hi\");", "bytesIn": 58, "bytesOut": 19, "credits": 2000 } ``` ### Response fields - success (boolean): `true` when readable source was produced. A `false` response costs 0 credits. - code (string): The readable source. - bytesIn (number): Size of the input in bytes. - bytesOut (number): Size of the output in bytes. - credits (number): 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 `) or OAuth 2.1. Claude Desktop (claude_desktop_config.json): ```json { "mcpServers": { "astify": { "command": "npx", "args": [ "-y", "mcp-remote", "https://astify.dev/mcp", "--header", "Authorization: Bearer " ] } } } ``` Cursor / Claude Code (Streamable HTTP): ```json { "mcpServers": { "astify": { "type": "http", "url": "https://astify.dev/mcp", "headers": { "Authorization": "Bearer " } } } } ``` ## Billing headers Every response carries two headers, whether the call succeeded or not. - 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. - 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. - Every account: 2 - Concurrency 10: $29 a month - Concurrency 25: $99 a month ## Credits Buy credits once via crypto (NOWPayments) and spend them across every endpoint. No subscriptions, no expiry, and failed calls are free ($1 = 2,000 credits). - $10: 20,000 credits, $0.50 per 1,000 credits - $50: 140,000 credits, $0.36 per 1,000 credits - $200: 880,000 credits, $0.23 per 1,000 credits - JavaScript deobfuscation, 0–5,000 lines: 2,000 credits - JavaScript deobfuscation, 5,000–10,000 lines: 3,000 credits - JavaScript deobfuscation, 10,000+ lines: 6,000 credits https://astify.dev/pricing ## 4. Acceptable Use Not for buying tickets, creating accounts in bulk, testing credentials or logging in to financial accounts. https://astify.dev/terms