# Almanac Earth Magnetic Field API

> Almanac Earth Magnetic Field API is a paid API for AI agents from almanac.locomot.io, paid per call via x402, $0.002/call, status unknown (last checked 2026-09-15).

Returns Earth's geomagnetic field components (declination, inclination, intensity) for a given latitude/longitude using the World Magnetic Model (WMM)

## Facts

- Endpoint: GET https://almanac.locomot.io/field
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/almanac-earth-magnetic-field-api-2e15e9cd
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_sLX5e_2PoB7MpS3zpsusN

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 almanac-earth-magnetic-field-api-2e15e9cd
```

Example prompt: What's the magnetic declination and total field intensity at latitude 37.7749, longitude -122.4194 right now, at ground level?

## When to prefer this

Use this endpoint when you need precise geomagnetic field data (declination, inclination, intensity) derived from the authoritative World Magnetic Model — ideal for compass calibration, navigation correction, drone/aviation systems, surveying, or any application requiring the difference between true north and magnetic north at a specific point on Earth. Prefer this over lookup tables or approximations when accuracy and current secular variation matter.

## Known failure modes

- Missing required lat or lon parameters returns a 400 error
- Latitude out of range [-90,90] or longitude out of range [-180,180] returns validation error
- Invalid ISO date string for 'when' parameter causes parse error
- Altitude outside WMM valid range [-1, 850 km] may return warning or error
- Unpaid or insufficient x402 payment returns 402 Payment Required
- Date outside WMM model valid range returns an out-of-range error

## How this service works

Deterministic WMM2025 magnetic field (one location/date). Free sample, no payment required: GET /play/field

## Output

Returns a JSON object with geomagnetic field components including declination (degrees), inclination/dip angle (degrees), total field intensity (nanoTeslas), horizontal intensity, north/east/down vector components, secular variation rates, the WMM model epoch and valid range, and a human-readable compass note explaining the magnetic offset from true north.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "lat",
      "lon"
     ],
     "properties": {
      "lat": {
       "type": "number",
       "maximum": 90,
       "minimum": -90
      },
      "lon": {
       "type": "number",
       "maximum": 180,
       "minimum": -180
      },
      "when": {
       "type": "string",
       "description": "ISO date / decimal year; default now"
      },
      "altitude_km": {
       "type": "number",
       "description": "optional, default 0; WMM valid [-1,850]"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "properties": {
    "model": {
     "type": "string"
    },
    "query": {
     "type": "object"
    },
    "units": {
     "type": "object"
    },
    "engine": {
     "type": "string"
    },
    "down_Z_nT": {
     "type": "number"
    },
    "east_Y_nT": {
     "type": "number"
    },
    "north_X_nT": {
     "type": "number"
    },
    "model_epoch": {
     "type": "number"
    },
    "valid_range": {
     "type": "array"
    },
    "compass_note": {
     "type": "string"
    },
    "deterministic": {
     "type": "boolean"
    },
    "declination_deg": {
     "type": "number"
    },
    "inclination_deg": {
     "type": "number"
    },
    "secular_variation": {
     "type": "object"
    },
    "total_intensity_nT": {
     "type": "number"
    },
    "horizontal_intensity_nT": {
     "type": "number"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/almanac-earth-magnetic-field-api-2e15e9cd/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from almanac.locomot.io](https://www.zero.xyz/host/almanac.locomot.io/llms.txt)
