# Base TWAP Price Oracle (Manipulation-Resistant)

> Base TWAP Price Oracle (Manipulation-Resistant) is a paid API for AI agents from x402-data-api.bodhinindustries.workers.dev, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-15).

Returns manipulation-resistant TWAP and spot prices for any Base ERC-20 token, computed live from on-chain Uniswap v3 data with deviation and manipulation detection.

## Facts

- Endpoint: GET https://x402-data-api.bodhinindustries.workers.dev/price
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/base-twap-price-oracle-manipulation-resistant-e9935e7d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_AEyXB7NpZfHSmiuzHlv-m

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 base-twap-price-oracle-manipulation-resistant-e9935e7d
```

Example prompt: What's the manipulation-resistant TWAP price of the Base token at contract 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 in USDC, using a 30-minute averaging window — and flag it if the price looks suspicious?

## When to prefer this

Choose this endpoint when you need a trustless, auditable, on-chain price for a Base ERC-20 that cannot be spoofed by third-party data feeds. It is ideal for DeFi agents that need manipulation-resistant pricing, security analysis of token price integrity, or any scenario where you cannot trust centralized price oracles. Prefer it over CoinGecko or CoinMarketCap lookups when on-chain auditability matters.

## Known failure modes

- Token address not found or not a valid ERC-20 on Base — returns error or empty response
- No Uniswap v3 liquidity pool exists for the token — unable to compute TWAP
- Window parameter out of range (below 60 or above 7200) — may return validation error
- Token has insufficient liquidity for reliable TWAP — manipulationSuspected may be true
- Network or RPC errors on Base chain — transient 5xx response
- Payment not provided or insufficient — 402 Payment Required

## How this service works

Self-computed Base onchain toolkit for AI agents: ERC-20 safety scan, manipulation-resistant TWAP price oracle, gas/fee oracle, calldata decoder, token/address/contract intel, wallet approval-risk audit, and batch token triage — all computed live from raw Base chain, no third-party data.

## Output

Returns a JSON object with the token's current spot price and TWAP price in the requested quote asset (USDC or WETH), the deviation in basis points between spot and TWAP, a boolean flag if manipulation is suspected, token metadata (symbol, decimals), the block height, the window actually used, and a confirmation that no third-party data was used.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "token"
 ],
 "properties": {
  "quote": {
   "enum": [
    "usdc",
    "weth"
   ],
   "type": "string",
   "description": "Quote currency: 'usdc' (default) or 'weth'."
  },
  "token": {
   "type": "string",
   "description": "Base ERC-20 contract address to price."
  },
  "window": {
   "type": "integer",
   "description": "TWAP averaging window in seconds (60–7200, default 1800). Longer = more manipulation-resistant."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "block": {
   "type": "integer",
   "description": "Base block height"
  },
  "token": {
   "type": "string",
   "description": "token priced"
  },
  "method": {
   "type": "string",
   "description": "univ3_observe_tick_twap"
  },
  "symbol": {
   "type": "string",
   "description": "token symbol"
  },
  "decimals": {
   "type": "integer",
   "description": "token decimals"
  },
  "spotPrice": {
   "type": "string",
   "description": "current spot price in the quote asset (decimal string)"
  },
  "twapPrice": {
   "type": "string",
   "description": "time-weighted average price in the quote asset (decimal string)"
  },
  "computedAt": {
   "type": "string",
   "description": "ISO-8601 timestamp"
  },
  "quoteAsset": {
   "type": "string",
   "description": "USDC or WETH"
  },
  "deviationBps": {
   "type": "integer",
   "description": "abs(spot-twap)/twap in basis points"
  },
  "twapPriceWeth": {
   "type": "string",
   "description": "TWAP price denominated in WETH"
  },
  "windowSeconds": {
   "type": "integer",
   "description": "window actually used"
  },
  "thirdPartyDataUsed": {
   "type": "boolean",
   "description": "always false — auditable"
  },
  "manipulationSuspected": {
   "type": "boolean",
   "description": "true if deviation is large or liquidity is very low"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/base-twap-price-oracle-manipulation-resistant-e9935e7d/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-data-api.bodhinindustries.workers.dev](https://www.zero.xyz/host/x402-data-api.bodhinindustries.workers.dev/llms.txt)
