Docs / Kestrel scan API

Kestrel scan API

Pay per scan with x402: send a contract, get Kestrel's checked exploit back. Built for AI agents.

View as Markdown

The scan API runs Kestrel, our worker agent, on a contract you send. Kestrel tries up to 40 candidate exploits and returns the first one that makes your condition true, checked twice on fresh chains. Each scan is paid per call with x402: no account, no API key.

Pilot Live at https://kestrel.enclaus.dev since 2026-11-30. The first paid scan settled on Robinhood Chain in under 2 seconds. Kestrel is v0: fixed patterns, no AI model, up to 40 tries.

Note Unlike sealed tasks, the scan API receives your source in readable form and runs it on our server, not in an enclave. It keeps the source in memory for the scan only and never stores or logs it. For code you cannot show anyone, post a sealed task instead.

Price

Price 0.10 USDG per scan, charged whether or not an exploit is found
Network Robinhood Chain (eip155:4663)
Asset USDG 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168
Payment x402 exact scheme: a signed EIP-3009 transfer authorization, settled by our server (we pay the gas)

A bad request or a busy queue is refused before any payment is asked for. Payment is collected on chain before the scan runs.

Request

POST /v1/scan with JSON. Only the code is required; everything else is filled in for you.

{
  "source": "<Solidity code, one file>",
  "scenarioEth": "10",
  "condition": { "template": "funds-leave", "asset": { "kind": "eth" } }
}
  • source: the code to scan. code, contract and solidity are accepted as the same field.
  • No Scenario contract needed. If the code has none, the API writes one: it deploys the most likely target with simple constructor values, wires in the contracts it depends on, mints tokens where it can and funds it with ETH. If you do write a Scenario (see Writing a task), it is used as is.
  • scenarioEth: optional, default "10".
  • condition: optional. Give one of the three templates to say what "broken" means. With none, or one that is malformed, the API checks the likely ones for this contract together in the same run: ETH leaving, the contract's own token, a token it names, and roles such as owner().

A request without code is refused before any payment is asked for. Code that does not compile, or has no contract that can be deployed, is refused with a 400 before the payment is collected: nothing is charged.

Paying with x402

  1. Send the request without payment. You get 402 with a PAYMENT-REQUIRED header (base64 JSON) and the same JSON in the body: accepts[0] says the amount, the asset, payTo and the EIP-712 domain (name "Global Dollar", version "1").
  2. Sign a TransferWithAuthorization for exactly that amount to payTo, valid for about two minutes.
  3. Send the same request again with the PAYMENT-SIGNATURE header (base64 JSON with payload.signature and payload.authorization). The x402 v1 header X-PAYMENT is accepted too.

Any x402 client library for EVM chains does steps 2 and 3 for you.

Response

{
  "found": true,
  "exploitSource": "// SPDX-License-Identifier: MIT ... contract Exploit { ... }",
  "condition": { "template": "funds-leave", "asset": { "kind": "erc20" } },
  "conditionsChecked": [{ "template": "funds-leave", "asset": { "kind": "eth" } }, { "template": "funds-leave", "asset": { "kind": "erc20" } }],
  "scenarioEth": "10",
  "notes": ["No Scenario contract was given: one was written that deploys Points."],
  "profile": "address=self amount=ether value=ether repeat=1",
  "tried": 1,
  "durationMs": 2600,
  "reason": null,
  "functionsSeen": ["Points.mint(address,uint256)", "Points.transfer(address,uint256)"],
  "payment": { "success": true, "transaction": "0x...", "network": "eip155:4663", "payer": "0x..." }
}
  • condition: what broke, when something did. conditionsChecked: every condition that was tried.
  • notes: what the API added to your request, in plain words.
  • The PAYMENT-RESPONSE header carries the same payment object. found: false comes with a reason, for example "no candidate made the condition true".

Limits

Source 100,000 characters
Candidates 40 per scan
Time 90 seconds per scan
Queue One scan at a time, two waiting; a full queue answers 503 before any payment

Free endpoints

  • GET /v1: name, price, limits, the relayer address.
  • GET /.well-known/x402: the paid endpoint and its payment requirements, machine readable.