CaptchaSolvCaptchaSolv
Captcha Types

Castle

Generate Castle (castle.io) request tokens for Rockstar Games and x.com / twitter.com.

Castle (castle.io) protects sensitive actions such as login and signup by scoring the session and issuing a signed request token that the site attaches to the request. The solver produces a valid token you submit with your own request.

Type stringWhen to use
CastleAny Castle-protected login or signup on a supported site

Supported sites

The target is selected automatically from site_url.

SiteHosts
Rockstar Gamesrockstargames.com, signin.rockstargames.com
x.com / Twitterx.com, twitter.com

Data fields

FieldRequiredDescription
site_urlYesThe target URL. Determines which site the token is minted for.
site_keyYesThe Castle publishable key of the target application, e.g. pk_ followed by 20+ alphanumeric characters. Castle binds every token to this key, so a token minted under the wrong key can only be rejected. See Finding the publishable key.
countNoNumber of tokens to mint in one request, 1–50. Each token is single-use. Defaults to 1. See Multiple tokens.
cuidNoAn existing Castle __cuid to bind the token to. See About __cuid.

Always send site_key. The request is accepted without it — validation does not reject it — and then fails at solve time with errorId: 12 (Failed to solve captcha), because the solver has no key to configure the Castle SDK with and cannot mint a token.

Solution fields

FieldDescription
solution.tokenThe Castle request token. Submit it with the protected request.
solution.userAgentThe user-agent used during solving. Reuse it on the request that carries the token.

Example

Request
{
  "api_key":  "YOUR_API_KEY",
  "type":     "Castle",
  "site_url": "https://signin.rockstargames.com/",
  "proxy":    "user:pass@host:port",
  "data": {
    "site_key": "pk_1Tt6Yzr1WFzxrJCh7WzMZzY1rHpaPudN"
  }
}
Response
{
  "errorId":  0,
  "status":   "ready",
  "solvtime": 4.1,
  "data": {
    "useragent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 ...",
    "language":  "en-US,en;q=0.9",
    "solution": {
      "token": "eyJ0IjoicmVxdWVzdCI..."
    }
  }
}

Using the token

Attach the token to the login or signup request the same way the site's own client does — usually in the x-castle-request-token header:

POST /login
x-castle-request-token: <solution.token>

Reuse the userAgent from the solution on that request. Castle binds the token to the client that produced it, so a mismatched user-agent is rejected.

Finding the publishable key

The key is public by design — it is delivered with the page so the Castle SDK can be configured. Read it off the target's own assets and requests:

  • A pk_ literal in the page scripts, matching pk_[A-Za-z0-9]{20,}.
  • A Castle.configure({ pk: "pk_..." }) call, or castle.js?pk_... as the script query.
  • The key sent with requests to *.castle.io.

Keys rotate. Re-read it when previously working tokens start being refused, rather than keeping a copy in your code indefinitely.

Per-site behaviour

How the solver copes when site_key is absent differs by target, which is why the field is documented as required rather than optional:

SiteWithout site_key
Rockstar GamesBest-effort recovery: the solver scans the loaded bundle and the document for a pk_ literal. It fails outright when the host ships no such literal, and it cannot warn you when it finds a stale one.
x.com / TwitterFails immediately. x.com serves its key from the responsive_web_castle_public_key feature switch rather than from JS, so there is no literal anywhere in the assets to recover.

Do not rely on the Rockstar fallback. A key recovered from the page can be the wrong or an outdated one, and that produces a well-formed token the backend silently refuses — much harder to diagnose than a missing-key error.

About __cuid

__cuid is Castle's device identifier cookie. If your flow sends it alongside the token, pass the value you already hold in data.cuid so the token is bound to it, then set the same __cuid cookie on your request.

Multiple tokens

Castle tokens are single-use. Request a batch in one call with count (up to 50):

Request
{
  "api_key":  "YOUR_API_KEY",
  "type":     "Castle",
  "site_url": "https://signin.rockstargames.com/",
  "data": {
    "site_key": "pk_1Tt6Yzr1WFzxrJCh7WzMZzY1rHpaPudN",
    "count":    10
  }
}

The first token is returned under solution.token; the remaining tokens are delivered as additional task results. Use each token once.

How to identify Castle

  • Requests to *.castle.io, for example m.castle.io/v1/....
  • A pk_ publishable key or createRequestToken in the page scripts. That key is what you pass as site_key.
  • A __cuid cookie on the target.
  • A token submitted on login/signup, commonly in the x-castle-request-token header.

Tips

  • Send site_key. Omitting it is accepted and then fails as errorId: 12.
  • Match the proxy. Mint and replay through the same exit IP.
  • Reuse the returned userAgent. The token is bound to the client that earned it.
  • Spend each token once. Request a count batch instead of resending a used token.

On this page