canonical: https://jentic.com/apis/astronomyapi.com/astronomyapi

# Astronomy API

The Astronomy API returns positions of celestial bodies, predicts astronomical events, and renders star charts and moon phase images on demand. It covers the major Solar System bodies and a searchable catalogue of stars and deep space objects, accepting observer location and date inputs to produce horizon-relative coordinates. The Studio endpoints generate ready-to-display PNG charts so applications can drop astronomy visuals into pages without rolling their own ephemeris engine.

## For AI agents

Look up celestial body positions, generate moon phase or star chart images, and search astronomy catalogues for a given date and observer location.

## Scope

Does not handle weather forecasts, satellite tracking, or telescope control - use for celestial body positions, events, and astronomy imagery only.

## Capabilities

- Compute the position of a specific celestial body for an observer's latitude, longitude, and date via `/bodies/positions/{body}`
- List astronomical events such as transits and oppositions for a body over a date range using `/bodies/events/{body}`
- Generate a printable star chart image for a given location and viewing date through POST `/studio/star-chart`
- Render a moon phase image scaled to the requested observation moment via POST `/studio/moon-phase`
- Search the catalogue of stars and deep space objects with /search and a free-text query

## Use cases

### Sky-Tonight Application

Consumer stargazing apps need to tell users which planets and bright stars are visible from their location right now. The Astronomy API answers this with `/bodies/positions`, returning altitude, azimuth, and constellation for each Solar System body relative to the observer, so the app can render a 'tonight's sky' summary without bundling its own ephemeris data. Latency is low enough for live mobile use.

Example prompt: Call GET `/bodies/positions` for latitude 51.5074, longitude -0.1278, on 2026-06-09 21:00 UTC and return the bodies with altitude greater than 10 degrees

### Editorial Star Charts

News and educational sites publish weekly stargazing guides with charts. The Studio endpoints generate a star chart PNG for a chosen latitude, longitude, and timestamp, so an editorial CMS can pre-render charts for upcoming meteor showers or eclipses without an in-house astronomy stack. The chart returns as an image URL that can be embedded directly in articles.

Example prompt: POST to `/studio/star-chart` with latitude 40.7128, longitude -74.0060, observation date 2026-08-12 23:00, and view 'constellation: Perseus' to produce a chart image URL

### Moon Phase Widget

Lifestyle and gardening apps display today's moon phase. The `/studio/moon-phase` endpoint renders the moon's illuminated fraction at the requested moment as a PNG, so the front end just embeds the returned URL. The same endpoint can be backdated for almanac-style content where a calendar shows the phase for each day of the month.

Example prompt: POST to `/studio/moon-phase` with date 2026-06-09 to retrieve the current phase image and percentage illuminated

### Agent-Driven Astronomy Lookups via Jentic

Through Jentic, an AI agent answering an astronomy question searches by intent ('where is Mars tonight') and Jentic returns the matching `/bodies/positions` operation with its observer-location schema. Basic auth credentials are held in your Jentic One instance, so the agent can call the API without seeing the application secret. This makes ad-hoc astronomy queries answerable inside any LLM-driven chat or workflow.

Example prompt: Use Jentic to search 'find Mars position tonight from my location', load the GET `/bodies/positions/{body}` schema, and execute with body='mars' and the user's coordinates

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | `/bodies` | List all supported celestial bodies |
| GET | `/bodies/positions` | Get positions for all bodies for an observer |
| GET | `/bodies/positions/{body}` | Get position of a specific body |
| GET | `/bodies/events/{body}` | Get events such as rise and set times for a body |
| POST | `/studio/star-chart` | Generate a star chart image |
| POST | `/studio/moon-phase` | Generate a moon phase image |
| GET | `/search` | Search stars and deep space objects |

## Key resources

- **Bodies** — List supported celestial bodies and retrieve their positions and events
- **Studio** — Generate star chart and moon phase images for a given observer and time
- **Search** — Search the catalogue of stars and deep space objects

## Why Jentic

- **Setup:** Wiring Astronomy API by hand means encoding an application ID and secret as basic auth and passing observer-location parameters for positions and events. Through Jentic you install once, import the Astronomy API from the API Directory, store the credentials once, and your agent calls it while Jentic builds the Authorization header.
- **Permission scoping:** Astronomy API puts the body name in the URL path (`/bodies/positions/{body}`) for reads, so a rule can pin your agent to position and event reads for one body. You choose the operations it may call, so the star-chart and moon-phase generators are not included unless you add them.
- **Credential handling:** Your Astronomy API application ID and secret are stored once, encrypted, by your own Jentic One instance and used to build the basic-auth header at execution time. They never enter the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'find Mars position tonight', and Jentic returns the matching `/bodies/positions` operation with its observer-location parameters so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **NASA APOD** — NASA's Astronomy Picture of the Day, often paired with sky-tonight content
- **NASA NeoWs** — Near Earth Object Web Service for asteroid approaches
- **WeatherAPI** — Weather and astronomy data including sunrise, sunset, and moonrise times

## FAQ

### What authentication does the Astronomy API use?

The Astronomy API uses HTTP Basic Auth, with the application ID as the username and the application secret as the password. Through Jentic, both values are held in your Jentic One instance and injected at call time, so they never appear in the agent's context.

### Can I get the current position of a planet with the Astronomy API?

Yes. Call GET `/bodies/positions/{body}` with the body slug (for example 'mars'), the observer's latitude and longitude, and the date and time. The response returns the body's altitude, azimuth, and apparent constellation for that observer.

### What are the rate limits for the Astronomy API?

Astronomy API plans publish per-minute and per-day quotas tied to the application key. The spec does not encode them, so check the dashboard for the active plan and back off on HTTP 429 responses.

### How do I generate a star chart image through Jentic?

Search Jentic for 'generate a star chart', load the POST `/studio/star-chart` schema, and execute with the observer location, observation time, and chart style. Jentic returns the image URL produced by the API so the agent can hand it back to the caller.

### Can I search for deep space objects with the Astronomy API?

Yes. The GET /search endpoint accepts a free-text query and returns matching stars and deep space objects from the catalogue, including identifiers that can then be passed back to `/bodies/positions` or chart generation.

### Which celestial bodies does the Astronomy API support?

The API covers the Sun, Moon, and the major Solar System planets via the /bodies endpoint, which lists every supported body slug to use in subsequent position and event calls.

### Can I limit what my agent is allowed to do with the Astronomy API?

Yes. Because your Jentic One instance is self-hosted, your own rules decide which operations and credentials the agent may use. The Astronomy API puts the body name in the URL path for reads (`/bodies/positions/{body}`), so you can pin the agent to position and event reads for a single body. Since you choose the operations it may call, the POST `/studio/star-chart` and POST `/studio/moon-phase` image generators stay out of reach unless you explicitly add them.
