Skip to content

Moon

What this does

Returns the current moon phase, how much of the moon is lit, and when the moon rises and sets for a place in the UK. You can pass a postcode (easiest) or latitude and longitude. Optionally pass a date and time to see the moon for a specific moment instead of right now.

Who it is for

  • Event planners scheduling outdoor evening events
  • Photographers planning night shoots
  • Apps showing “moon tonight” for a user’s postcode
  • Anyone curious whether the moon is visible from their garden

Try it

Default: Westminster, London, right now.

https://fetch.li/v1/moon?postcode=SW1A1AA

Other examples:

https://fetch.li/v1/moon?lat=53.4808&lon=-2.2426
https://fetch.li/v1/moon?postcode=EH11AA&at=2026-12-24T18:00:00Z

HTTP example

GET /v1/moon?postcode=SW1A1AA HTTP/1.1
Host: fetch.li
Accept: application/json

curl

curl -sS "https://fetch.li/v1/moon?postcode=SW1A1AA"

JavaScript fetch

const postcode = "SW1A1AA";
const response = await fetch(
  `https://fetch.li/v1/moon?postcode=${encodeURIComponent(postcode)}`
);
const moon = await response.json();
console.log(moon.phase, moon.rise, moon.set);

Python requests

import requests

response = requests.get(
    "https://fetch.li/v1/moon",
    params={"postcode": "SW1A1AA"},
)
response.raise_for_status()
moon = response.json()
print(moon["phase"], moon["rise"], moon["set"])

Example JSON response

{
  "phase": "Waxing Crescent",
  "illumination": 0.23,
  "rise": "09:14",
  "set": "21:02",
  "transit": "15:08",
  "location": {
    "postcode": "SW1A 1AA",
    "lat": 51.5014,
    "lon": -0.1419,
    "label": "Westminster, London"
  },
  "at": "2026-08-25T12:00:00.000Z",
  "timezone": "Europe/London"
}

Parameters

Parameter Required Type Description
postcode One of postcode or lat/lon string UK postcode, with or without spaces (e.g. SW1A1AA or SW1A 1AA)
lat With lon if no postcode number Latitude in decimal degrees (e.g. 51.5074)
lon With lat if no postcode number Longitude in decimal degrees (e.g. -0.1278)
at No string (ISO 8601) Instant to calculate for (UTC). Defaults to now

Provide either postcode or both lat and lon.

Errors that can happen

HTTP error.code When
400 invalid_body Missing location, invalid at format, or lat/lon out of range
404 not_found Postcode not recognised
429 rate_limited Demo limit exceeded (60/hour per IP)
500 internal Unexpected server error

Demo

GET endpoints work without an API key on the public demo tier (60 calls per hour per IP). POST /v1/vibe/classify needs a key.

Try it

GET https://fetch.li/v1/moon


    
    
    
  

Answer

Response

response