# Butterfly Delta Order Preflight

> Butterfly Delta Order Preflight is a paid API for AI agents from butterflydelta.com, paid per call via x402, $0.01/call, status unknown (last checked 2026-10-10).

Runs a $0.01 pre-trade integrity check on a crypto order by fetching live Coinbase and Gemini order book depth, estimating slippage and spread, and returning a signed PASS/FAIL verdict before execution.

## Facts

- Endpoint: POST https://butterflydelta.com/api/agent/order-preflight?utm_source=zero.xyz
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-10
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/butterfly-delta-order-preflight-a027d635
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_OkLqqe_CE5h0Y5aioNCRm

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability butterfly-delta-order-preflight-a027d635 -d '<json body>'
```

Example prompt: Before my bot submits that 0.25 BTC market buy on Coinbase, run a Butterfly Delta preflight on BTC-USD — check that slippage stays under 25 bps, spread under 10 bps, and quotes are fresh within 10 seconds.

## When to prefer this

Choose this endpoint when an autonomous crypto trading agent needs a signed, machine-readable pre-trade integrity gate before committing a real order — especially when slippage, spread, order book depth, quote freshness, or cross-venue divergence are failure conditions that must be verified and logged. It is ideal for bots trading on Coinbase or Gemini where explainability and auditability of pre-trade conditions matter, or when a downstream compliance layer requires a signed attestation. Prefer it over generic market-data APIs when you need an actionable PASS/FAIL verdict with explicit assumption assertions rather than raw quote data.

## Known failure modes

- Stale quotes: if order book data exceeds maxQuoteAgeSeconds, the freshness assertion fails and the gate returns FAIL
- Thin order book: insufficient depth to cover baseSize triggers minDepthCoveragePct failure
- Spread too wide: spread exceeding maxVenueSpreadBps causes a venue integrity assertion failure
- Cross-venue divergence: if Coinbase and Gemini mid-prices diverge beyond maxCrossVenueDivergenceBps, gate fails
- Slippage exceeded: estimated slippage above maxEstimatedSlippageBps returns a FAIL verdict
- Unsupported pair: trading pair not found in Coinbase or Gemini coverage returns NO_MATCH_IN_CURRENT_COVERAGE verdict
- Payment failure: missing or invalid x402 USDC payment header results in 402 rejection before preflight runs
- Invalid pair format: pair string not matching the required pattern returns a schema validation error

## How this service works

A $0.01 exact-order preflight for crypto trading bots: live Coinbase and Gemini depth, estimated slippage, spread, freshness, and venue integrity before every order.

## Output

Returns a JSON object containing an executionGate with a PASS or FAIL state and a machineAction directive (e.g. PROCEED_UNDER_CALLER_POLICY), a list of assumption results (venue health, spread, slippage, depth coverage, quote freshness), a coverage status indicating which integrity modules were checked, and a signed EIP-191 attestation with an expiry timestamp — giving the calling agent a verifiable, machine-readable record of pre-trade conditions.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "trade": {
   "type": "object",
   "required": [
    "pair"
   ],
   "properties": {
    "pair": {
     "type": "string",
     "pattern": "^[A-Za-z0-9]{2,15}[-/_]USD$",
     "description": "USD spot pair, for example BTC-USD."
    },
    "side": {
     "enum": [
      "buy",
      "sell"
     ],
     "type": "string"
    },
    "venue": {
     "enum": [
      "coinbase",
      "gemini"
     ],
     "type": "string",
     "description": "Optional execution venue. Include with side and baseSize for exact-order simulation."
    },
    "summary": {
     "type": "string",
     "maxLength": 1000
    },
    "baseSize": {
     "type": "number",
     "description": "Exact base-asset size, for example 0.25 BTC.",
     "exclusiveMinimum": 0
    },
    "deadline": {
     "type": "string",
     "maxLength": 120
    },
    "orderType": {
     "enum": [
      "market",
      "limit"
     ],
     "type": "string",
     "default": "market"
    },
    "limitPrice": {
     "type": "number",
     "description": "Required when orderType is limit.",
     "exclusiveMinimum": 0
    },
    "minHealthyVenues": {
     "type": "number",
     "default": 2,
     "maximum": 2,
     "minimum": 1
    },
    "maxVenueSpreadBps": {
     "type": "number",
     "default": 10,
     "maximum": 10000,
     "minimum": 0
    },
    "maxQuoteAgeSeconds": {
     "type": "number",
     "default": 10,
     "maximum": 3600,
     "minimum": 0
    },
    "minDepthCoveragePct": {
     "type": "number",
     "default": 100,
     "maximum": 100,
     "minimum": 0
    },
    "maxEstimatedSlippageBps": {
     "type": "number",
     "default": 25,
     "maximum": 10000,
     "minimum": 0
    },
    "maxCrossVenueDivergenceBps": {
     "type": "number",
     "default": 20,
     "maximum": 10000,
     "minimum": 0
    }
   },
   "description": "Bot-native input. Butterfly Delta expands this policy into explicit, signed venue assertions.",
   "additionalProperties": false
  },
  "action": {
   "type": "object",
   "required": [
    "kind",
    "target"
   ],
   "properties": {
    "kind": {
     "enum": [
      "trade",
      "purchase",
      "transfer",
      "deploy",
      "publish",
      "api_call",
      "execute",
      "other"
     ],
     "type": "string"
    },
    "stakes": {
     "type": "object",
     "properties": {
      "value": {
       "type": "string",
       "maxLength": 80
      },
      "currency": {
       "type": "string",
       "maxLength": 32
   
… (truncated)
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "verdict": "NO_MATCH_IN_CURRENT_COVERAGE",
  "coverage": {
   "status": "PARTIAL",
   "matchedModules": [
    {
     "id": "crypto.execution_integrity"
    },
    {
     "id": "us.crypto_regulation"
    }
   ]
  },
  "protocol": "butterflydelta-preflight/1.0",
  "capability": "delta_preflight",
  "attestation": {
   "payload": {
    "scheme": "eip191",
    "expiresAt": "..."
   },
   "signature": "0x..."
  },
  "executionGate": {
   "state": "PASS",
   "machineAction": "PROCEED_UNDER_CALLER_POLICY",
   "allRequiredAssertionsHold": true
  },
  "assumptionResults": [
   {
    "id": "venue",
    "state": "HOLDS",
    "observed": true
   }
  ]
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/butterfly-delta-order-preflight-a027d635/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from butterflydelta.com](https://www.zero.xyz/host/butterflydelta.com/llms.txt)
