{
  "openapi": "3.1.0",
  "info": {
    "title": "Lunologium Living Ephemeris Edge API",
    "version": "1.1.0",
    "description": "Sub-millisecond deterministic celestial mechanics, dual Western Tropical & Vedic Sidereal zodiac placements, 27 Vedic Nakshatras, phytodynamic plant chronobiology & sap mechanics, and live dynamic SVG README badges delivered from Cloudflare's global edge network. Zero authentication required.",
    "contact": {
      "name": "lunologium.com",
      "url": "https://lunologium.com"
    },
    "license": {
      "name": "MIT / CC-BY 4.0",
      "url": "https://lunologium.com/api"
    }
  },
  "servers": [
    {
      "url": "https://lunologium.com",
      "description": "Global Edge Production Runtime (Cloudflare Pages)"
    }
  ],
  "paths": {
    "/api/v1/moon": {
      "get": {
        "summary": "Retrieve Live Moon Phase & Ephemeris Telemetry",
        "description": "Calculates topocentric astrometric position, illumination fraction, synodic age, dual Tropical/Sidereal placements, Nakshatra, phytodynamic sap-flow vectors and cellular turgor, and traditional folklore names.",
        "operationId": "getMoonEphemeris",
        "parameters": [
          {
            "name": "lat",
            "in": "query",
            "required": false,
            "description": "Observer geocentric latitude (-90.0 to 90.0). Default: 40.7128 (New York City).",
            "schema": {
              "type": "number",
              "default": 40.7128
            }
          },
          {
            "name": "lon",
            "in": "query",
            "required": false,
            "description": "Observer geocentric longitude (-180.0 to 180.0). Default: -74.0060 (New York City).",
            "schema": {
              "type": "number",
              "default": -74.006
            }
          },
          {
            "name": "date",
            "in": "query",
            "required": false,
            "description": "Observation date as ISO 8601 (e.g. 2026-10-31T00:00:00Z) or natural astronomical alias: 'next-full-moon', 'next-new-moon', 'next-first-quarter', 'next-last-quarter', 'today', 'now'.",
            "schema": {
              "type": "string",
              "default": "now",
              "examples": [
                "2026-10-31",
                "next-full-moon",
                "next-new-moon",
                "1969-07-20"
              ]
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "description": "Payload serialization format. Options: 'json' (default full payload), 'compact' (~150-byte minified IoT payload), 'oled' (8-line 128x64 display grid), 'text' / 'ascii' (shaded terminal ASCII art).",
            "schema": {
              "type": "string",
              "enum": ["json", "compact", "oled", "text", "ascii"],
              "default": "json"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful ephemeris calculation",
            "headers": {
              "Cache-Control": {
                "schema": { "type": "string" },
                "description": "Edge cache directive (public, max-age=60, s-maxage=300)"
              },
              "Server-Timing": {
                "schema": { "type": "string" },
                "description": "Server execution timing in milliseconds"
              },
              "X-Execution-Time-Ms": {
                "schema": { "type": "string" },
                "description": "Analytical execution duration on Cloudflare edge isolate"
              },
              "X-Edge-Colo": {
                "schema": { "type": "string" },
                "description": "Cloudflare edge colocation code (e.g. EWR, LHR, NRT)"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "epoch": {
                      "type": "object",
                      "properties": {
                        "iso": { "type": "string" },
                        "unix": { "type": "integer" },
                        "julian_day": { "type": "number" }
                      }
                    },
                    "observer": {
                      "type": "object",
                      "properties": {
                        "latitude": { "type": "number" },
                        "longitude": { "type": "number" },
                        "elevation_m": { "type": "number" }
                      }
                    },
                    "lunar": {
                      "type": "object",
                      "properties": {
                        "phase": {
                          "type": "object",
                          "properties": {
                            "name": { "type": "string" },
                            "latin": { "type": "string" },
                            "fraction": { "type": "number" },
                            "illumination_pct": { "type": "integer" },
                            "emoji": { "type": "string" },
                            "stage": { "type": "string" },
                            "age_days": { "type": "number" },
                            "cycle_length_days": { "type": "number" }
                          }
                        },
                        "orbital": {
                          "type": "object",
                          "properties": {
                            "distance_km": { "type": "integer" },
                            "distance_earth_radii": { "type": "number" },
                            "perigee_apogee": { "type": "string" }
                          }
                        }
                      }
                    },
                    "zodiac": {
                      "type": "object",
                      "properties": {
                        "tropical": {
                          "type": "object",
                          "properties": {
                            "sign": { "type": "string" },
                            "glyph": { "type": "string" },
                            "degree_in_sign": { "type": "number" },
                            "element": { "type": "string" },
                            "modality": { "type": "string" },
                            "ruling_planet": { "type": "string" }
                          }
                        },
                        "sidereal": {
                          "type": "object",
                          "properties": {
                            "sign": { "type": "string" },
                            "glyph": { "type": "string" },
                            "nakshatra": {
                              "type": "object",
                              "properties": {
                                "index": { "type": "integer" },
                                "name": { "type": "string" },
                                "pada": { "type": "integer" },
                                "ruler": { "type": "string" },
                                "deity": { "type": "string" },
                                "symbol": { "type": "string" }
                              }
                            }
                          }
                        }
                      }
                    },
                    "adjacent_learnings": {
                      "type": "object",
                      "properties": {
                        "biodynamic_agriculture": {
                          "type": "object",
                          "properties": {
                            "day_type": { "type": "string" },
                            "element": { "type": "string" },
                            "focus": { "type": "string" }
                          }
                        }
                      }
                    }
                  }
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string",
                  "description": "Monochrome formatted ASCII art or 8-line 128x64 OLED grid"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter (coordinate out of bounds [-90, 90], malformed date, or payload length overflow)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "parameter": { "type": "string", "nullable": true },
                    "status": { "type": "integer", "example": 400 },
                    "documentation": { "type": "string" }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (Maximum 60 requests per minute per IP)",
            "headers": {
              "Retry-After": {
                "schema": { "type": "string" },
                "description": "Seconds until rate limit window resets"
              },
              "X-RateLimit-Limit": {
                "schema": { "type": "string" },
                "description": "Maximum requests allowed per minute (60)"
              },
              "X-RateLimit-Remaining": {
                "schema": { "type": "string" },
                "description": "Remaining request quota in current window"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": { "type": "string" },
                    "status": { "type": "integer", "example": 429 },
                    "retry_after_seconds": { "type": "integer" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/badge.svg": {
      "get": {
        "summary": "Render Dynamic Moon Phase SVG Badge",
        "description": "Generates a real-time vector badge with illuminated moon disc, phase name, illumination %, and zodiac placements. Embeddable in GitHub READMEs, Notion, and websites.",
        "operationId": "getMoonBadgeSvg",
        "parameters": [
          {
            "name": "theme",
            "in": "query",
            "required": false,
            "description": "Visual theme preset. Options: 'brass' (midnight gold), 'e-ink' (high-contrast monochrome), 'cyberpunk' (cyan/fuchsia neon), 'minimal' (clean dark pill).",
            "schema": {
              "type": "string",
              "enum": ["brass", "e-ink", "cyberpunk", "minimal"],
              "default": "brass"
            }
          },
          {
            "name": "style",
            "in": "query",
            "required": false,
            "description": "Badge layout dimensions. 'full' (310x34px) or 'compact' (175x28px).",
            "schema": {
              "type": "string",
              "enum": ["full", "compact"],
              "default": "full"
            }
          },
          {
            "name": "zodiac",
            "in": "query",
            "required": false,
            "description": "Zodiac placement display. Options: 'tropical', 'sidereal', 'nakshatra', 'none'.",
            "schema": {
              "type": "string",
              "enum": ["tropical", "sidereal", "nakshatra", "none"],
              "default": "tropical"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "description": "Output format. Use 'shields' for shields.io endpoint JSON schema.",
            "schema": {
              "type": "string",
              "enum": ["svg", "shields", "json"],
              "default": "svg"
            }
          },
          {
            "name": "date",
            "in": "query",
            "required": false,
            "description": "Optional ISO 8601 date string to freeze badge specimen for historical/future ephemeris.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Crisp SVG vector specimen or Shields.io JSON response",
            "content": {
              "image/svg+xml": {
                "schema": {
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schemaVersion": { "type": "integer", "example": 1 },
                    "label": { "type": "string", "example": "moon" },
                    "labelColor": { "type": "string", "example": "07090e" },
                    "message": {
                      "type": "string",
                      "example": "Full Moon 100% · ♍ Virgo"
                    },
                    "color": { "type": "string", "example": "c9a961" }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
