API Reference

Astronomy

Computed astronomy from public NOAA/USNO formulas: sunrise/sunset, day length, twilight, moon phase, upcoming moon phases, and eclipse predictions. Pure local computation — no external data source, commercially safe to use.

Main endpoint
GET https://use.apiindonesia.id/api/v1/astronomi/sun
Endpoints
5
Authentication
x-api-key header (create one free in the dashboard)
Price
2 credits (Rp2) per successful request; failed requests are free
Format
JSON (REST), with cURL, JavaScript and Python examples
Product Brief

What this API gives you

Computed astronomy from public NOAA/USNO formulas: sunrise/sunset, day length, twilight, moon phase, upcoming moon phases, and eclipse predictions. Pure local computation — no external data source, commercially safe to use.

Coverage
5

ready-to-use endpoints in this product, with JSON responses and consistent error handling.

Access
API key

Can be tried with the 3,000 credit signup bonus, then used in production through one API Indonesia key.

Sample resource
https://use.apiindonesia.id/api/v1/astronomi/sun

Returns sunrise, sunset, solar noon, and day length for a given lat/lon and date. Handles polar night / midnight sun.

When should you use it?

The Astronomy API fits lifestyle, photography, travel, agriculture, construction, and calendar apps that need sunrise/sunset, twilight, moon phase, and eclipse predictions from calculations.

Photography products need golden hour, blue hour, or moon phase for shoot planning.

Outdoor apps need day-length and twilight estimates for a specific location.

Calendars want to show moon phases or eclipse predictions as extra context.

Some outputs are approximate calculations. For high-precision scientific observation, use dedicated astronomy data from a suitable provider.

Example product scenarios

This section separates the product page from the docs. The docs explain how to call endpoints; this page explains why the endpoints make sense for your feature.

  • Muslim & lifestyle apps: show sunrise/sunset and moon phase for worship scheduling or outdoor events.
  • Photography & travel: plan golden/blue hours and astrophotography sessions from twilight times & moon phase.
  • Agriculture & construction: estimate effective working hours from day length and sunlight.

Example Usage

Request
curl "https://use.apiindonesia.id/api/v1/astronomi/sun?lat=-6.2&lon=106.8&tanggal=2025-06-21&tz=%2B07:00" \
  -H "x-api-key: YOUR_API_KEY"
Response · 200 OK
{
  "data": {
    "date": "2025-06-21",
    "latitude": -6.2,
    "longitude": 106.8,
    "timezone": "+07:00",
    "sunrise": "06:00",
    "sunset": "17:46",
    "solarNoon": "11:53",
    "dayLength": 42343,
    "declination": 23.44,
    "equationOfTime": -0.76,
    "polarPhase": "normal"
  },
  "meta": {
    "disclaimer": "Hasil dihitung dari rumus astronomi publik (NOAA/USNO). Aksen ±2 menit adalah normal untuk terbit/terbenam.",
    "source": "Computed (NOAA/USNO)"
  }
}

Related Articles

Pricing 2 credits (Rp2) per successful request; failed requests are free. One-time 3,000 credit signup bonus, no credit card, no monthly allowance.

Astronomy API questions

What can it compute?

Sunrise and sunset, day length, twilight times, moon phase, upcoming moon phases and eclipse predictions.

Where does the data come from?

It is computed locally with public NOAA/USNO formulas and no external data source, so it is safe for commercial use.

How do I get sunrise for a specific place?

Call GET /api/v1/astronomi/sun with lat, lon, tanggal (date) and tz.

Get Started

Start Integrating
Today

Sign up for free and get a 3,000 credit bonus (Rp3,000) once your email is verified, grab an API key, and call your first endpoint right away. No credit card, no tedious approval process.

Dot wave visualization