Castle Token Generation API

Pass Castle verification at scale.

A developer API that mints valid Castle tokens for Castle-protected sites and apps — X / Twitter (web) and apps like DailyPay (Android) are our worked examples. Send a request, get a token back in ~50ms. No browsers to babysit, no challenges to solve by hand.

$0.00055Per token
Web + Android (APP)Both live now
Pricing

Only pay for what you use

Metered per token, billed against a prepaid balance you control from the dashboard. No surprises.

Pay-As-You-Go · Live

Metered usage

$0.00055 / token

Only pay for what you use — metered per token against your prepaid balance.

  • Web & Android token generation, live now
  • Bearer-key auth · per-key usage stats
  • Real-time balance + usage dashboard
  • No minimums, no expiring credits
EST · 100,000 req ≈ $55.00 / month
Subscriptions

Volume tiers

Flat monthly plans with bundled request volume and higher rate limits for high-throughput teams.

  • Discounted per-request rate
  • Higher, custom rate limits
  • Usage alerts + per-key reporting
Temporarily unavailable

Closed to everyone right now — start on Pay-As-You-Go today and switch when tiers reopen.

Capabilities

Built for automation

A focused REST API with predictable behavior and clear limits. Here is what you are wiring into.

Both live

Android (APP) & Web support

Both endpoints are live. /generate/web mints browser Castle tokens; /generate/android mints native Android application tokens.

~50 ms

Low latency

Typical responses land in around 50 ms — consistent, low-latency token generation built for high-throughput automation.

$0.00055

Pay-as-you-go

$0.00055 per token generated. No minimums, no expiring credits — only pay for what you use.

Custom app support

Need tokens for another Castle-protected app? Get in touch and we'll add support.

Pipeline

How it works

Three steps. You send one request, Castle Solver computes a valid token, and you attach it to your request to the Castle-protected site or app (X / Twitter shown as the example). No browsers to run, no challenges to solve by hand.

  1. Send a request
    POST /generate/web with the target site (domain) and a browser User-Agent.
  2. We generate the token
    We compute a fresh, valid Castle token server-side — no browser farm to babysit.
  3. Use the token
    Attach the returned token and headers to your request to the Castle-protected site.

Bearer key required. Send Authorization: Bearer YOUR_API_KEY with every request. Get a key from the Pay-As-You-Go plan above.

POST https://castle.botwitter.com/generate/web
request · curl
curl -X POST https://castle.botwitter.com/generate/web \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "cuid": "550e8400e29b41d4a716446655440000",
    "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)...",
    "country": "US",
    "sec-ch-ua": "\"Chromium\";v=\"131\", \"Google Chrome\";v=\"131\"",
    "public_key": "pk_AvRa79bHyJSYSQHnRpcVtzyxetSvFerx",
    "domain": "x.com"
  }'

// Response:
{
  "success": true,
  "token": "eyJhbG...",
  "cuid": "550e8400e29b41d4a716446655440000",
  "cuidGenerated": false,
  "domain": "x.com",
  "headers": {
    "sec-ch-ua": "\"Chromium\";v=\"131\", \"Google Chrome\";v=\"131\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Windows\""
  }
}
Request body · /generate/web
user_agent requiredbrowser UA string
cuid optional32-char hex
country optional"US"
sec-ch-ua optionalclient-hint UA
public_key optional"pk_AvRa79bHyJSYSQHnRpcVtzyxetSvFerx"
domain optionaltarget site · defaults "x.com"

When you send your request to the target site, set the returned cuid as a __cuid cookie — e.g. Cookie: __cuid=<cuid>.

Reference

Frequently asked

Short answers to the questions developers ask most before wiring Castle Solver in.

Generates a valid Castle token for Castle-protected sites and apps so your automation can pass their Castle challenge. X / Twitter (web) and apps like DailyPay (Android) are the worked examples; for other sites or apps we haven't tuned yet, contact us.
Send your API key as Authorization: Bearer YOUR_API_KEY. A key is required.
/generate/web returns a browser Castle token; /generate/android returns a native Android app token as X-Castle-Request-Token + X-Castle-Client-Id. Both endpoints are live.
Android supports Castle-protected apps in general. A native Android application token is derived from the app identity (public_key, app_label, app_version, app_version_code) plus a signed session_id. Reuse the returned session_id to keep the same device, or omit it to mint a fresh one. DailyPay is our example app; for your specific app or any other, contact us to add or confirm support.
Pay-as-you-go at $0.00055 per token. Subscription tiers exist but are temporarily unavailable right now.
Pass the domain field to target a Castle-protected site; it defaults to twitter.com / x.com (our main example). Other Castle-protected sites are supported too — contact us for ones we haven't tuned yet, or for other apps and custom needs.
Around 50 ms typical per token.