{
  "openapi": "3.1.0",
  "info": {
    "title": "Apna Panchang public API",
    "version": "1.0.0",
    "description": "Free, read-only JSON endpoints for the daily Hindu panchang, the covered cities and the festival list. Times are IST clock strings; dates are YYYY-MM-DD. Please cache responses and keep request rates modest.",
    "contact": { "email": "hello@apnapanchang.in", "url": "https://apnapanchang.in/developers" }
  },
  "servers": [{ "url": "https://apnapanchang.in" }],
  "paths": {
    "/api/panchang": {
      "get": {
        "summary": "Daily panchang for a city and date",
        "operationId": "getPanchang",
        "parameters": [
          { "name": "city", "in": "query", "required": false, "schema": { "type": "string", "example": "jaipur" }, "description": "City slug from /api/cities. Defaults to the site default city." },
          { "name": "date", "in": "query", "required": false, "schema": { "type": "string", "format": "date", "example": "2026-11-08" }, "description": "YYYY-MM-DD in the city's timezone. Defaults to today." }
        ],
        "responses": {
          "200": {
            "description": "Panchang for the requested day",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "date": { "type": "string", "format": "date" },
                    "city": {
                      "type": "object",
                      "properties": {
                        "slug": { "type": "string" },
                        "name": { "type": "string" },
                        "nameHindi": { "type": "string" },
                        "district": { "type": "string" },
                        "state": { "type": "string" }
                      }
                    },
                    "tithi": { "type": "string" },
                    "paksha": { "type": "string" },
                    "nakshatra": { "type": "string" },
                    "yoga": { "type": "string" },
                    "karana": { "type": "string" },
                    "vaar": { "type": "string" },
                    "moonSign": { "type": "string" },
                    "sunSign": { "type": "string" },
                    "sunrise": { "type": "string", "example": "06:37 AM" },
                    "sunset": { "type": "string", "example": "05:42 PM" },
                    "moonrise": { "type": "string" },
                    "rahuKalam": { "type": "string", "example": "02:56 PM – 04:19 PM" },
                    "choghadiyaDay": { "type": "array", "items": { "type": "object" } },
                    "choghadiyaNight": { "type": "array", "items": { "type": "object" } }
                  }
                }
              }
            }
          },
          "404": { "description": "Unknown city or no panchang for that date" }
        }
      }
    },
    "/api/cities": {
      "get": {
        "summary": "All covered cities",
        "operationId": "listCities",
        "responses": {
          "200": {
            "description": "City list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cities": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "slug": { "type": "string" },
                          "name": { "type": "string" },
                          "nameHindi": { "type": "string" },
                          "district": { "type": "string" },
                          "state": { "type": "string" },
                          "timezone": { "type": "string", "example": "Asia/Kolkata" }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/festivals": {
      "get": {
        "summary": "Festival and vrat dates",
        "operationId": "listFestivals",
        "responses": {
          "200": {
            "description": "Festival list sorted by date",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "festivals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "slug": { "type": "string" },
                          "date": { "type": "string", "format": "date" },
                          "nameEnglish": { "type": "string" },
                          "nameHindi": { "type": "string" },
                          "regionTag": { "type": "string", "enum": ["marwar", "mewar", "pan-india"] }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
