# Calendar sunrise, sunset and moon phase API

Get Calendar Sun & Moon data via REST or OpenAny MCP—with pay-per-use pricing and no subscription. Powered by Apish, pass parameters such as output, q, raw, and retrieve structured data including location time zone, computed sunrise timestamp, computed sunset timestamp, polar-day flag, and moon-phase label for calendar context, and follow-up calculations.

Documentation: https://openany.si/market/apis/calendar/calendar-sunrise-sunset-and-moon-phase-api/?offering=a2ea9071-ab27-461b-b9d1-38f8596d39d7
API ID: a2ea9071-ab27-461b-b9d1-38f8596d39d7
Provider: apish
Contract revision: 3
Method: GET
Endpoint: https://api.openany.si/v1/agent-apis/apish/calendar/v1/sun-moon
Page update time: 2026-12-03T02:45:13.667Z
Access: OpenAny REST
OpenAny MCP: availability is not supplied by this REST contract. Check get_api on the configured OpenAny MCP server before execution.
Request content type: none
Execution mode: sync
Authentication: Authorization: Bearer $OPENANY_API_KEY

## Billing
Price: $0.002 / billing credit
API-key calls use your shared balance. Review the published billing rules before making a paid request.
Price source: OpenAny public API contract. Price update time: not supplied.
Contract update time: 2026-12-03T02:45:12.088Z. This is not a price-change timestamp.
```json
{
  "currency": "USD",
  "mode": "rules",
  "parameters": [],
  "policy_version": 2,
  "sale": {
    "addons": [],
    "base_price_micro_usd": "0",
    "max_cost_micro_usd": "2000",
    "quantities": [
      {
        "id": "upstream_credits",
        "label": "Actual API.SH credits used",
        "max_quantity": "1",
        "measure": "value",
        "pointer": "/credits_used",
        "price_micro_usd": "2000",
        "quantity_scale": 0,
        "source": "response",
        "unit": "credit",
        "unit_quantity": "1"
      }
    ],
    "rounding": "ceil",
    "variants": []
  }
}
```

## Request parameters
```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Calendar sunrise, sunset and moon phase API request inputs",
  "$comment": "Declared input types grouped by HTTP location. Path, query and header values describe decoded inputs and are serialized as text on the wire; body is the payload. This is not an exhaustive provider contract or a schema for the raw HTTP request.",
  "type": "object",
  "properties": {
    "path": {
      "type": "object",
      "properties": {}
    },
    "query": {
      "type": "object",
      "properties": {
        "q": {
          "type": "string",
          "description": "Place name, e.g. London or Paris, France."
        },
        "lat": {
          "type": "number",
          "description": "Latitude (with lon) instead of a place."
        },
        "lon": {
          "type": "number",
          "description": "Longitude."
        },
        "postal_code": {
          "type": "string",
          "description": "Postal code (with country)."
        },
        "country": {
          "type": "string",
          "description": "Country code to narrow a place or postal code."
        },
        "date": {
          "type": "string",
          "description": "First day (YYYY-MM-DD); default today at the place."
        },
        "days": {
          "type": "integer",
          "description": "Number of days (default 1, max 31)."
        },
        "elevation": {
          "type": "number",
          "description": "Observer height in metres (moves sunrise and sunset slightly)."
        },
        "raw": {
          "type": "string",
          "description": "0 leaves out the bulky `raw` source blocks (often 10-30x smaller).",
          "enum": [
            "0",
            "1"
          ]
        },
        "fields": {
          "type": "string",
          "description": "Comma-separated fields to return, e.g. `posts.id,posts.title`. Call metadata is always included."
        },
        "fresh": {
          "type": "string",
          "description": "1 skips the 24-hour cache and fetches live.",
          "enum": [
            "1"
          ]
        },
        "output": {
          "type": "string",
          "description": "JSON only for this OpenAny product. CSV and NDJSON exports are not supported; omit output or send json.",
          "enum": [
            "json"
          ]
        },
        "records": {
          "type": "string",
          "description": "With output=csv|ndjson: the top-level list to turn into rows (e.g. `reviews`), or `.` for the whole object as one row."
        }
      }
    },
    "headers": {
      "type": "object",
      "properties": {}
    }
  },
  "required": [
    "path",
    "query",
    "headers"
  ]
}
```

## Response fields
Source: Inferred from examples; not an exhaustive provider schema.
```json
{
  "type": "object",
  "properties": {
    "cached": {
      "type": "boolean"
    },
    "count": {
      "type": "integer"
    },
    "credits_used": {
      "type": "integer"
    },
    "days": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string"
          },
          "moon": {
            "type": "object",
            "properties": {
              "age_days": {
                "type": "number"
              },
              "always_down": {
                "type": "boolean"
              },
              "always_up": {
                "type": "boolean"
              },
              "distance_km": {
                "type": "integer"
              },
              "illumination_pct": {
                "type": "number"
              },
              "moonrise": {
                "type": "string"
              },
              "moonset": {
                "type": "string"
              },
              "phase": {
                "type": "number"
              },
              "phase_name": {
                "type": "string"
              },
              "waxing": {
                "type": "boolean"
              }
            }
          },
          "sun": {
            "type": "object",
            "properties": {
              "astronomical_dawn": {
                "type": "string"
              },
              "astronomical_dusk": {
                "type": "string"
              },
              "civil_dawn": {
                "type": "string"
              },
              "civil_dusk": {
                "type": "string"
              },
              "day_length": {
                "type": "string"
              },
              "day_length_seconds": {
                "type": "integer"
              },
              "golden_hour_evening_start": {
                "type": "string"
              },
              "golden_hour_morning_end": {
                "type": "string"
              },
              "nautical_dawn": {
                "type": "string"
              },
              "nautical_dusk": {
                "type": "string"
              },
              "polar_day": {
                "type": "boolean"
              },
              "polar_night": {
                "type": "boolean"
              },
              "solar_noon": {
                "type": "string"
              },
              "solar_noon_altitude_deg": {
                "type": "number"
              },
              "sunrise": {
                "type": "string"
              },
              "sunset": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "elevation_m": {
      "type": "integer"
    },
    "fetched_at": {
      "type": "string"
    },
    "location": {
      "type": "object",
      "properties": {
        "admin1": {
          "type": "string"
        },
        "admin1_code": {
          "type": "string"
        },
        "admin2": {
          "type": "string"
        },
        "ascii_name": {
          "type": "string"
        },
        "country": {
          "type": "string"
        },
        "country_code": {
          "type": "string"
        },
        "elevation_m": {
          "type": "integer"
        },
        "feature": {
          "type": "string"
        },
        "feature_code": {
          "type": "string"
        },
        "geonameid": {
          "type": "integer"
        },
        "lat": {
          "type": "number"
        },
        "lon": {
          "type": "number"
        },
        "name": {
          "type": "string"
        },
        "population": {
          "type": "integer"
        },
        "query": {
          "type": "object",
          "properties": {
            "q": {
              "type": "string"
            }
          }
        },
        "timezone": {
          "type": "string"
        }
      }
    },
    "next_moon_phases": {
      "type": "object",
      "properties": {
        "first_quarter": {
          "type": "string"
        },
        "full_moon": {
          "type": "string"
        },
        "last_quarter": {
          "type": "string"
        },
        "new_moon": {
          "type": "string"
        }
      }
    },
    "note": {
      "type": "string"
    }
  }
}
```

## Request example
Scenario: Official example · Live API.SH response · Minimal request
```bash
curl \
  'https://api.openany.si/v1/agent-apis/apish/calendar/v1/sun-moon?output=json&q=London&raw=0' \
  -X GET \
  -H "Authorization: Bearer $OPENANY_API_KEY" \
  -H 'Content-Type: application/json'
```

## Response example
Example from the provider's documentation. Field values in your results will differ.
Sample response · Documented HTTP 200
```json
{
  "cached": false,
  "count": 1,
  "credits_used": 1,
  "days": [
    {
      "date": "2026-11-19",
      "moon": {
        "age_days": 9.4,
        "always_down": false,
        "always_up": false,
        "distance_km": 388585,
        "illumination_pct": 70.8,
        "moonrise": "2026-11-19T13:36:13+00:00",
        "moonset": "2026-11-19T00:55:41+00:00",
        "phase": 0.318,
        "phase_name": "Waxing Gibbous",
        "waxing": true
      },
      "sun": {
        "astronomical_dawn": "2026-11-19T05:27:06+00:00",
        "astronomical_dusk": "2026-11-19T18:07:29+00:00",
        "civil_dawn": "2026-11-19T06:47:36+00:00",
        "civil_dusk": "2026-11-19T16:46:58+00:00",
        "day_length": "8h 44m",
        "day_length_seconds": 31478,
        "golden_hour_evening_start": "2026-11-19T15:15:06+00:00",
        "golden_hour_morning_end": "2026-11-19T08:19:29+00:00",
        "nautical_dawn": "2026-11-19T06:06:35+00:00",
        "nautical_dusk": "2026-11-19T17:27:59+00:00",
        "polar_day": false,
        "polar_night": false,
        "solar_noon": "2026-11-19T11:47:17+00:00",
        "solar_noon_altitude_deg": 19.07,
        "sunrise": "2026-11-19T07:24:58+00:00",
        "sunset": "2026-11-19T16:09:36+00:00"
      }
    }
  ],
  "elevation_m": 25,
  "fetched_at": "2026-11-19T12:20:13.298Z",
  "location": {
    "admin1": "England",
    "admin1_code": "ENG",
    "admin2": "Greater London",
    "ascii_name": "London",
    "country": "United Kingdom",
    "country_code": "GB",
    "elevation_m": 25,
    "feature": "capital",
    "feature_code": "PPLC",
    "geonameid": 2643743,
    "lat": 51.50853,
    "lon": -0.12574,
    "name": "London",
    "population": 8961989,
    "query": {
      "q": "London"
    },
    "timezone": "Europe/London"
  },
  "next_moon_phases": {
    "first_quarter": "2026-12-17T01:51:00+00:00",
    "full_moon": "2026-11-24T17:36:00+00:00",
    "last_quarter": "2026-12-01T08:46:00+00:00",
    "new_moon": "2026-12-08T23:58:00+00:00"
  },
  "note": "Computed astronomically for the location (times in its local time zone, accurate to about a minute; moon times to a few minutes). Phase: 0 new, 0.25 first quarter, 0.5 full, 0.75 last quarter."
}
```

## Error handling
400: Check the request fields.
401 / 403: Verify credentials and access permissions.
402: Inspect payment requirements and balance.
429: Respect returned retry guidance.
5xx: Inspect the error and usage record before retrying a paid operation.

## Available implementations
- apish: https://openany.si/market/apis/calendar/calendar-sunrise-sunset-and-moon-phase-api/?offering=a2ea9071-ab27-461b-b9d1-38f8596d39d7

Integration guide: https://openany.si/docs/
Agent setup: https://openany.si/SKILL.md
