---
title: "Calculate an instant Panchang and local solar events"
method: POST
path: "/api/astro/panchang"
tags: ["Calculations"]
---

# Calculate an instant Panchang and local solar events

`POST /api/astro/panchang`

## Request

- Base URL: `https://api.cosmicephemeris.com`
- URL: `https://api.cosmicephemeris.com/api/astro/panchang`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`

Strict civil snapshot at the requested instant, not automatically at sunrise. Sidereal Lahiri default. Sunrise/sunset belong to the requested local civil date at elevation zero; ambiguous/nonexistent midnight boundaries return 400. No festivals, regional calendar or arbitrary event search. Latitude is restricted to inclusive [-88,88] for the verified solar-event solver domain. Returned solar candidates must satisfy a geometric crossing check; unsupported near-tangent geometry returns 400 instead of invented events. A solar event inside a recorded leap second returns 400 because its local civil timestamp cannot represent second 60. All admitted attempts reserve one standard quota unit; failed or timed-out admitted attempts are not refunded, including unsupported geometry. No automatic retries.
Historical mode uses an explicit BCE/CE date object and UT1 conventions. Its response is the versioned historical envelope, not the modern UTC envelope. Read result for calculation fields and metadata for limits and uncertainty.

## Request body

- union
  - PanchangRequest: Strict civil snapshot at the requested instant, not automatically at sunrise. Sidereal Lahiri default. Sunrise/sunset belong to the requested local civil date at elevation zero; ambiguous/nonexistent midnight boundaries return 400. No festivals, regional calendar or arbitrary event search. Latitude is restricted to inclusive [-88,88] for the verified solar-event solver domain. Returned solar candidates must satisfy a geometric crossing check; unsupported near-tangent geometry returns 400 instead of invented events. A solar event inside a recorded leap second returns 400 because its local civil timestamp cannot represent second 60.
    - `at` PanchangMomentInput, required: Strict nested birth input; no unknown properties, nulls, booleans or numeric strings. Known civil time required; semantic date/DST/undefined-angle validation occurs on the server.
      - `date` string, date, required: Valid Gregorian YYYY-MM-DD local civil date, inclusive 1800-01-01 through 2200-12-31. Calendar validity and timezone conversion are checked by the server.
      - `time` string, required: HH:MM or HH:MM:SS; no offset in this field. Use timezone to select the civil-time zone.
      - `timezone` string: Valid IANA zone; UTC when omitted. Ambiguous and nonexistent civil times are rejected.
      - `lat` number, required: Panchang supported sunrise admission is limited to inclusive [-88,88] latitude.
      - `lon` number, required
    - `ayanamsa` 'lahiri' | 'raman' | 'krishnamurti' | 'fagan_bradley' | 'yukteshwar' | 'sassanian' | 'true_chitra' | 'true_revati' | 'true_pushya' | 'galactic_center_0_sagittarius' | 'galactic_alignment_mardyks'
  - HistoricalPanchangRequest: Explicit historical mode, 1000 BCE (BC)–2500 CE (AD). No year zero, implicit calendar, UTC or IANA zone. Preserve tool-specific mathematical, geographic and search limits; calendar/time conventions and estimated Delta-T are not certified historical accuracy.
    - `at` HistoricalBirthInput, required
      - `date` HistoricalDate, required: Explicit civil date, 1000 BCE (BC)–2500 CE (AD); no year zero. Calendar validity is checked by the server. Available only on documented connected historical operations, with explicit UT1/fixed-offset conventions.
        - `year` integer, required
        - `era` 'BCE' | 'CE', required: Display BCE (BC) / CE (AD); API values remain BCE / CE. No year zero.
        - `month` integer, required
        - `day` integer, required
        - `calendar` 'proleptic_gregorian' | 'proleptic_julian', required: Explicit choice; applies the selected calendar rules throughout history without a regional adoption switch.
      - `time` string, required: Explicit HH:MM[:SS]; whole seconds only, no leap seconds. Normalized helper output includes seconds.
      - `timezone` string, required: Explicit UT1 or fixed offset UT1+/-HH:MM[:SS], within 14 hours. Local clock minus offset yields UT1, not UTC. No IANA timezone inference. Original offset spelling is preserved.
      - `lat` number, required
      - `lon` number, required
    - `ayanamsa` 'lahiri' | 'raman' | 'krishnamurti' | 'fagan_bradley' | 'yukteshwar' | 'sassanian' | 'true_chitra' | 'true_revati' | 'true_pushya' | 'galactic_center_0_sagittarius' | 'galactic_alignment_mardyks'

## Response `200`

Successful calculation. Field nesting is specific to this route.

- union
  - PanchangResponse
    - `status` 'current', required
    - `type` 'panchang', required
    - `input` object, required
      - `at` PanchangMomentResult, required: Strict nested birth input; no unknown properties, nulls, booleans or numeric strings. Known civil time required; semantic date/DST/undefined-angle validation occurs on the server.
        - `date` string, date, required: Valid Gregorian YYYY-MM-DD local civil date, inclusive 1800-01-01 through 2200-12-31. Calendar validity and timezone conversion are checked by the server.
        - `time` string, required: HH:MM or HH:MM:SS; no offset in this field. Use timezone to select the civil-time zone.
        - `timezone` string, required: Valid IANA zone; UTC when omitted. Ambiguous and nonexistent civil times are rejected.
        - `lat` number, required: Panchang supported sunrise admission is limited to inclusive [-88,88] latitude.
        - `lon` number, required
      - `ayanamsa` 'lahiri' | 'raman' | 'krishnamurti' | 'fagan_bradley' | 'yukteshwar' | 'sassanian' | 'true_chitra' | 'true_revati' | 'true_pushya' | 'galactic_center_0_sagittarius' | 'galactic_alignment_mardyks', required
    - `at_utc` string, date-time, required: Normalized UTC timestamp; fractional seconds may be present.
    - `zodiac` 'sidereal', required
    - `ayanamsa` 'lahiri' | 'raman' | 'krishnamurti' | 'fagan_bradley' | 'yukteshwar' | 'sassanian' | 'true_chitra' | 'true_revati' | 'true_pushya' | 'galactic_center_0_sagittarius' | 'galactic_alignment_mardyks', required
    - `longitudes` object, required
      - `sun_tropical` number, required
      - `moon_tropical` number, required
      - `sun_sidereal` number, required
      - `moon_sidereal` number, required
    - `tithi` object, required
      - `index` integer, required
      - `name` string, required
      - `paksha` 'shukla' | 'krishna', required
      - `paksha_index` integer, required
      - `elongation_degrees` number, required
    - `nakshatra` object, required
      - `index` integer, required
      - `name` string, required
      - `lord` 'ketu' | 'venus' | 'sun' | 'moon' | 'mars' | 'rahu' | 'jupiter' | 'saturn' | 'mercury', required
      - `pada` integer, required
      - `sidereal_longitude` number, required
    - `yoga` object, required
      - `index` integer, required
      - `name` string, required
      - `sum_degrees` number, required
    - `karana` object, required
      - `index` integer, required
      - `name` string, required
      - `kind` 'fixed' | 'repeating', required
    - `weekday` PanchangWeekday, required
      - `index` integer, required
      - `name` 'Sunday' | 'Monday' | 'Tuesday' | 'Wednesday' | 'Thursday' | 'Friday' | 'Saturday', required
    - `vara` union, required: Most recent sunrise on the current/previous civil date, Sunday index0. No extension through a polar season. Explicit nulls when the bounded sunrise cannot define vara.
      - object
        - `status` 'available', required
        - `index` integer, required
        - `name` string, required
        - `start_utc` string, date-time, required: Normalized UTC timestamp; fractional seconds may be present.
      - object
        - `status` 'unavailable_no_sunrise' | 'unavailable_previous_date', required
        - `index` unknown, required
        - `name` unknown, required
        - `start_utc` unknown, required
    - `solar_events` PanchangSolarEvents, required: Bounded [start_utc,end_utc) local civil day; 23/25-hour DST days supported. Standard USNO -50 arcminute horizon at elevation 0, not Hindu-geocentric sunrise. Polar no-event results remain empty arrays; no transit-as-sunrise fallback.
      - `local_date` string, date, required: Valid Gregorian YYYY-MM-DD local civil date, inclusive 1800-01-01 through 2200-12-31. Calendar validity and timezone conversion are checked by the server.
      - `timezone` string, required
      - `start_utc` string, date-time, required: Normalized UTC timestamp; fractional seconds may be present.
      - `end_utc` string, date-time, required: Normalized UTC timestamp; fractional seconds may be present.
      - `sunrise` SolarEvent[], required
        - `utc` string, date-time, required: Normalized UTC timestamp; fractional seconds may be present.
        - `local` string, required: ISO local timestamp with historical IANA offsets, which can include offset seconds (not always RFC3339). Use the adjacent utc field for interoperable instant parsing.
      - `sunset` SolarEvent[], required
        - `utc` string, date-time, required: Normalized UTC timestamp; fractional seconds may be present.
        - `local` string, required: ISO local timestamp with historical IANA offsets, which can include offset seconds (not always RFC3339). Use the adjacent utc field for interoperable instant parsing.
      - `sunrise_status` 'occurs' | 'no_event', required
      - `sunset_status` 'occurs' | 'no_event', required
      - `model` 'usno_standard_50_arcminutes', required
      - `horizon_degrees` -0.8333333333333334, required
      - `elevation_m` 0, required
    - `metadata` PanchangMetadata, required
      - `calculation_status` 'current', required
      - `practitioner_review` 'not_completed', required
      - `classification_precision` 'unrounded_binary64', required
      - `classification_time` 'requested_instant', required
      - `frame` 'apparent_geocentric_sidereal_retained_nutation', required
      - `intervals` 'half_open', required
      - `weekday_basis` 'local_civil_midnight', required
      - `vara_basis` 'most_recent_sunrise_on_current_or_previous_civil_date', required
      - `regional_calendar` false, required
      - `festivals` false, required
  - HistoricalPanchangResponse
    - `schema` 'cosmicephemeris-historical-calculation-v1', required
    - `status` 'historical', required
    - `type` 'panchang', required
    - `input` HistoricalPanchangRequest, required: Explicit historical mode, 1000 BCE (BC)–2500 CE (AD). No year zero, implicit calendar, UTC or IANA zone. Preserve tool-specific mathematical, geographic and search limits; calendar/time conventions and estimated Delta-T are not certified historical accuracy.
      - `at` HistoricalBirthInput, required
        - `date` HistoricalDate, required: Explicit civil date, 1000 BCE (BC)–2500 CE (AD); no year zero. Calendar validity is checked by the server. Available only on documented connected historical operations, with explicit UT1/fixed-offset conventions.
          - `year` integer, required
          - `era` 'BCE' | 'CE', required: Display BCE (BC) / CE (AD); API values remain BCE / CE. No year zero.
          - `month` integer, required
          - `day` integer, required
          - `calendar` 'proleptic_gregorian' | 'proleptic_julian', required: Explicit choice; applies the selected calendar rules throughout history without a regional adoption switch.
        - `time` string, required: Explicit HH:MM[:SS]; whole seconds only, no leap seconds. Normalized helper output includes seconds.
        - `timezone` string, required: Explicit UT1 or fixed offset UT1+/-HH:MM[:SS], within 14 hours. Local clock minus offset yields UT1, not UTC. No IANA timezone inference. Original offset spelling is preserved.
        - `lat` number, required
        - `lon` number, required
      - `ayanamsa` 'lahiri' | 'raman' | 'krishnamurti' | 'fagan_bradley' | 'yukteshwar' | 'sassanian' | 'true_chitra' | 'true_revati' | 'true_pushya' | 'galactic_center_0_sagittarius' | 'galactic_alignment_mardyks'
    - `result` object, required: Complete historical calculation adapter result. Times are explicit UT1 date records, never UTC strings; derived times may include fractional seconds and years outside the input range.
    - `metadata` object, required
      - `time_standard` 'UT1', required
      - `historical_accuracy_certified` unknown, required
      - `warnings` string[], required

## Other responses

- `400`: Invalid request, malformed JSON, out-of-range date/location, unknown model, invalid timezone or ambiguous/nonexistent clock-change time. Invalid attempts reaching quota reservation consume one unit.
- `401`: Missing, invalid, revoked API key or unavailable activated key owner. Dashboard cookies do not authenticate calculation routes.
- `403`: Origin not allowed by production CORS policy. Server-to-server requests can omit Origin.
- `404`: Wrong/case-variant/noncanonical or trailing-slash route; public paths have no version prefix.
- `413`: Request exceeds the body limit; gateway JSON is capped at 128 KiB. Edge failures may be HTML.
- `429`: Monthly quota exhausted, per-user two-request concurrency reached, or nginx rate/connection admission refused. Retry-After: 2 is sent for application per-user concurrency only, not a promise that monthly quota resets in two seconds.
- `500`: Bounded gateway/database/internal failure. An admitted attempt can still consume quota.
- `502`: Engine unavailable, unsuccessful internal server response or invalid upstream JSON. No engine internals are exposed.
- `503`: Four-request global calculation pool full (Retry-After: 2), maintenance or upstream service unavailable.
- `504`: Application engine timeout: 15 seconds normally; planetary events, house ingresses, aspect windows, event calendar, eclipse geometry, electional search, and event-rule search use 30 seconds; Nakshatra Timeline plus the explicitly enumerated readiness, robustness, location, uncertainty, and electional-audit family use 60 seconds. Timer includes response-body parsing; an admitted timeout consumes quota.

---

[API](https://skmtc.dev/cosmicephemeris/apis/cosmic-ephemeris-calculation-api.md) · [All operations](https://skmtc.dev/cosmicephemeris/apis/cosmic-ephemeris-calculation-api/llms.txt) · [OpenAPI document](https://skmtc.dev/cosmicephemeris/apis/cosmic-ephemeris-calculation-api/revisions/f041e924cea3?raw)
