# OnchainExpat Air Quality API

> OnchainExpat Air Quality API is a paid API for AI agents from x402.onchainexpat.com, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-14).

Returns real-time air quality data for a given location via pay-per-request x402 protocol

## Facts

- Endpoint: POST https://x402.onchainexpat.com/api/x402-tools/air/quality
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/onchainexpat-air-quality-api-50cace4e
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_uDrIvlRRVjjFAGv-9wv0C

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 onchainexpat-air-quality-api-50cace4e -d '<json body>'
```

Example prompt: What's the current air quality index in Los Angeles right now? I want to know if it's safe to exercise outdoors.

## When to prefer this

Use this endpoint when you need real-time air quality data on a per-request pay-as-you-go basis using the x402 crypto micropayment protocol, without requiring a subscription. Prefer over alternatives when integrating into blockchain-native or agent-based workflows that already support x402 payments.

## Known failure modes

- Invalid or unrecognized location returns error or empty result
- Missing required location parameters causes 400 bad request
- Payment not included or insufficient USDC causes x402 payment required response
- Upstream air quality data source unavailable returns 503
- Coordinates outside supported coverage area return no data

## How this service works

Pay-per-request AI, crypto, proxy, and utility APIs using x402 protocol

## Output

A JSON object containing air quality index (AQI) score, pollutant breakdown (e.g. PM2.5, PM10, ozone, CO), and possibly health category or recommendations for the requested location.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "radius": {
   "type": "number",
   "description": "Search radius in km (default 10) when using lat/lon"
  },
  "latitude": {
   "type": "number",
   "description": "Latitude in decimal degrees. Alias: 'lat'"
  },
  "longitude": {
   "type": "number",
   "description": "Longitude in decimal degrees. Alias: 'lon'"
  },
  "sensor_index": {
   "type": "integer",
   "description": "PurpleAir sensor index (use this OR latitude+longitude). Alias: 'sensor'"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "aqi": {
   "type": "number"
  },
  "pm10": {
   "type": "number"
  },
  "pm2_5": {
   "type": "number"
  },
  "cached": {
   "type": "boolean"
  },
  "location": {
   "type": "string"
  },
  "sensor_index": {
   "type": "integer"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/onchainexpat-air-quality-api-50cace4e/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402.onchainexpat.com](https://www.zero.xyz/host/x402.onchainexpat.com/llms.txt)
