# Moon Position API

> Moon Position calculates the moon's altitude in the sky for any latitude and longitude coordinates. Provide an optional time of day to determine lunar elevation; paid plans add custom dates, azimuth, and distance.

**Endpoint:** `GET https://api.apiverve.com/v1/moonposition`  
**Category:** Astrology  
**Cost:** 2 credits per call  
**Canonical page:** https://apiverve.com/marketplace/moonposition

## Overview

A moon and lunar position API. Moon Position works by analyzing the location provided and calculating moon position data. It uses advanced algorithms to calculate data such as altitude, azimuth, and distance of the moon from the location and returns the moon position data.

## Authentication

Every call carries your key in an `x-api-key` header. The same key works across the whole
APIVerve catalog — there are no per-API subscriptions. Responses always use the same three
top-level keys: `status`, `error`, and `data`.

## Example request

```bash
curl "https://api.apiverve.com/v1/moonposition?lat=37.7749&lon=-122.4194&date=01-16-2026&time=14%3A30&timezone=America%2FLos_Angeles" \
  -H "x-api-key: YOUR_API_KEY"
```

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `lat` | number | Yes | The latitude of the location. range -90-90 |
| `lon` | number | Yes | The longitude of the location. range -180-180 |
| `date` | string | No | The date to get the moon position data for (MM-DD-YYYY or YYYY-MM-DD). An ISO date-time such as 2026-06-21T21:00:00 is also accepted and supplies the time; with Z or an offset it is read as that exact instant. Years 1700 to 2300 are supported. datetime. Premium field |
| `time` | string | No | The time of day for the calculation (HH:mm, 24-hour; HH:mm:ss and 12-hour times such as 9:00 PM are also accepted, seconds are ignored). Defaults to 00:00 if not provided. time |
| `timezone` | string | No | IANA timezone name the date and time are given in. Defaults to the timezone of the supplied coordinates. timezone |

## Response fields

- `date` — string · The date for which moon position was calculated
- `time` — string · The time of observation in HH:MM format
- `coordinates` — object · The observation location the position was calculated for
  - `coordinates.latitude` — number · The latitude coordinate of the observation location
  - `coordinates.longitude` — number · The longitude coordinate of the observation location
- `moon` — object · The moon's position as seen from the observation location
  - `moon.altitude` — number · Moon altitude above the horizon in radians, calculated from observation location. Negative values mean the moon is below the horizon
  - `moon.azimuth` — number · Moon azimuth in radians, measured from due south and increasing westward (the suncalc convention). Use compassBearing for degrees clockwise from north · (premium)
  - `moon.distance` — number · Distance from observer to moon in kilometers · (premium)

## Sample response

```json
{
  "status": "ok",
  "error": null,
  "data": {
    "date": "01-22-2026",
    "time": "14:30",
    "coordinates": {
      "latitude": 37.7749,
      "longitude": -122.4194
    },
    "moon": {
      "altitude": -0.407908976399288,
      "azimuth": 1.4720499058762104,
      "distance": 404332.6834067969
    }
  }
}
```

## Use cases

- **Night Photography Planning** — Landscape photographers check moon altitude across evening hours to time foreground illumination and align night-sky shots.
- **Telescope Pointing Assistants** — Amateur astronomy software plots lunar elevation by observer coordinates to guide telescope targeting during backyard stargazing sessions.
- **Coastal Night Navigation** — When planning coastal night voyages, marine navigation tools track lunar altitude to anticipate natural visibility over open water.
- **Nocturnal Wildlife Research** — Field biology platforms log lunar elevation against animal GPS tracks to correlate predator hunting patterns with ambient moonlight.

## SDKs

- **npm** — `npm install @apiverve/moonposition` (https://www.npmjs.com/package/@apiverve/moonposition)
- **PyPI** — `pip install apiverve-moonposition` (https://pypi.org/project/apiverve-moonposition/)
- **NuGet** — `dotnet add package APIVerve.API.MoonPosition` (https://www.nuget.org/packages/APIVerve.API.MoonPosition)
- **Source** — https://github.com/apiverve/moonposition-api

## More

- Full reference: https://docs.apiverve.com/ref/moonposition
- Get an API key: https://dashboard.apiverve.com
- Full catalog: https://apiverve.com/marketplace
