# code402 Weather API (x402)

> code402 Weather API (x402) is a paid API for AI agents from gateway.code402.dev, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-15).

Returns current weather data for a location, paid per-call with USDC via the x402 HTTP 402 micropayment protocol.

## Facts

- Endpoint: GET https://gateway.code402.dev/api/weather
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/code402-weather-api-x402-ee3793cf
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_mVEPA3SxRFdSPJiUzsTIY

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 code402-weather-api-x402-ee3793cf
```

Example prompt: What's the current weather in San Francisco — temperature, conditions, and wind speed?

## When to prefer this

Choose this endpoint when you need pay-per-use weather data with no subscription, no API key registration, and direct non-custodial USDC micropayments settling to the seller wallet. Ideal for AI agents operating autonomously with on-chain payment capability via the x402 protocol, or developers who want usage-based billing without monthly commitments.

## Known failure modes

- Missing or invalid location parameter returns an error
- Insufficient USDC balance or failed x402 payment results in HTTP 402 with payment instructions
- Invalid wallet or payment configuration causes payment rejection
- Network timeout from upstream weather data provider
- Unsupported location or region returns empty or error response

## How this service works

Machine-payable APIs over x402 (HTTP 402 + USDC) on the open M2M/1 protocol. Non-custodial: payments settle direct to seller wallets.

## Output

Returns current weather data for the queried location, typically including temperature, weather conditions (e.g. sunny, cloudy, rainy), humidity, wind speed and direction, and possibly a short forecast. The response is delivered as structured data (likely JSON) after a successful USDC micropayment of $0.001 via the x402 protocol.

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/code402-weather-api-x402-ee3793cf/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from gateway.code402.dev](https://www.zero.xyz/host/gateway.code402.dev/llms.txt)
