{
  "openapi": "3.1.0",
  "info": {
    "title": "Jadwal Sholat API",
    "version": "1.0.0",
    "description": "Free prayer times for every Indonesian city and regency (Kemenag RI method), and for any coordinates worldwide. No key, no signup, CORS open. Computed at the edge, so responses are fast and never rate limited by an upstream.",
    "license": {
      "name": "MIT"
    }
  },
  "servers": [
    {
      "url": "https://sholat.zakiego.com"
    }
  ],
  "tags": [
    {
      "name": "Schedule"
    },
    {
      "name": "Cities"
    },
    {
      "name": "Meta"
    }
  ],
  "paths": {
    "/api/v1/schedule/{city}": {
      "get": {
        "tags": [
          "Schedule"
        ],
        "operationId": "getCitySchedule",
        "summary": "Prayer times for a city, one day or one month",
        "parameters": [
          {
            "name": "city",
            "in": "path",
            "required": true,
            "description": "City slug (`banjarbaru`, `kab-bogor`) or Kemendagri code (`63.72`).",
            "schema": {
              "type": "string",
              "example": "banjarbaru"
            }
          },
          {
            "name": "date",
            "in": "query",
            "required": false,
            "description": "Local date. Defaults to today in the location's time zone.",
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-11-11"
            }
          },
          {
            "name": "month",
            "in": "query",
            "required": false,
            "description": "Return every day of this month instead of one date.",
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}$",
              "example": "2026-11"
            }
          },
          {
            "name": "method",
            "in": "query",
            "required": false,
            "description": "Calculation method.",
            "schema": {
              "type": "string",
              "enum": [
                "kemenag",
                "mwl",
                "isna",
                "egypt",
                "makkah",
                "karachi",
                "jakim",
                "muis",
                "diyanet"
              ],
              "default": "kemenag"
            }
          },
          {
            "name": "asr",
            "in": "query",
            "required": false,
            "description": "Asr shadow rule.",
            "schema": {
              "type": "string",
              "enum": [
                "standard",
                "hanafi"
              ],
              "default": "standard"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "description": "`csv` returns a CSV file. Only with `month`.",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "csv"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A day, or a MonthSchedule when `month` is set",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DaySchedule"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/schedule": {
      "get": {
        "tags": [
          "Schedule"
        ],
        "operationId": "getSchedule",
        "summary": "Prayer times by coordinates, or by the caller's IP when no location is given",
        "parameters": [
          {
            "name": "lat",
            "in": "query",
            "required": false,
            "description": "Latitude. Use with `lng` for any place in the world.",
            "schema": {
              "type": "number",
              "example": -3.4386
            }
          },
          {
            "name": "lng",
            "in": "query",
            "required": false,
            "description": "Longitude.",
            "schema": {
              "type": "number",
              "example": 114.8311
            }
          },
          {
            "name": "tz",
            "in": "query",
            "required": false,
            "description": "IANA time zone. Guessed from coordinates when omitted.",
            "schema": {
              "type": "string",
              "example": "Asia/Makassar"
            }
          },
          {
            "name": "elevation",
            "in": "query",
            "required": false,
            "description": "Meters above sea level.",
            "schema": {
              "type": "number",
              "example": 31
            }
          },
          {
            "name": "city",
            "in": "query",
            "required": false,
            "description": "City slug, instead of coordinates.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "date",
            "in": "query",
            "required": false,
            "description": "Local date. Defaults to today in the location's time zone.",
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-11-11"
            }
          },
          {
            "name": "month",
            "in": "query",
            "required": false,
            "description": "Return every day of this month instead of one date.",
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}$",
              "example": "2026-11"
            }
          },
          {
            "name": "method",
            "in": "query",
            "required": false,
            "description": "Calculation method.",
            "schema": {
              "type": "string",
              "enum": [
                "kemenag",
                "mwl",
                "isna",
                "egypt",
                "makkah",
                "karachi",
                "jakim",
                "muis",
                "diyanet"
              ],
              "default": "kemenag"
            }
          },
          {
            "name": "asr",
            "in": "query",
            "required": false,
            "description": "Asr shadow rule.",
            "schema": {
              "type": "string",
              "enum": [
                "standard",
                "hanafi"
              ],
              "default": "standard"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "description": "`csv` returns a CSV file. Only with `month`.",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "csv"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DaySchedule"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/next/{city}": {
      "get": {
        "tags": [
          "Schedule"
        ],
        "operationId": "getNextPrayer",
        "summary": "The next of the five daily prayers",
        "parameters": [
          {
            "name": "city",
            "in": "path",
            "required": true,
            "description": "City slug (`banjarbaru`, `kab-bogor`) or Kemendagri code (`63.72`).",
            "schema": {
              "type": "string",
              "example": "banjarbaru"
            }
          },
          {
            "name": "method",
            "in": "query",
            "required": false,
            "description": "Calculation method.",
            "schema": {
              "type": "string",
              "enum": [
                "kemenag",
                "mwl",
                "isna",
                "egypt",
                "makkah",
                "karachi",
                "jakim",
                "muis",
                "diyanet"
              ],
              "default": "kemenag"
            }
          },
          {
            "name": "asr",
            "in": "query",
            "required": false,
            "description": "Asr shadow rule.",
            "schema": {
              "type": "string",
              "enum": [
                "standard",
                "hanafi"
              ],
              "default": "standard"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Next"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/calendar/{city}.ics": {
      "get": {
        "tags": [
          "Schedule"
        ],
        "operationId": "getCalendar",
        "summary": "iCalendar feed to subscribe to in Google Calendar, Apple Calendar or Outlook",
        "parameters": [
          {
            "name": "city",
            "in": "path",
            "required": true,
            "description": "City slug (`banjarbaru`, `kab-bogor`) or Kemendagri code (`63.72`).",
            "schema": {
              "type": "string",
              "example": "banjarbaru"
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "description": "How many days ahead.",
            "schema": {
              "type": "integer",
              "default": 60,
              "maximum": 366
            }
          },
          {
            "name": "alarm",
            "in": "query",
            "required": false,
            "description": "Minutes before each prayer for a reminder.",
            "schema": {
              "type": "integer",
              "maximum": 120
            }
          },
          {
            "name": "prayers",
            "in": "query",
            "required": false,
            "description": "Comma-separated keys to include.",
            "schema": {
              "type": "string",
              "example": "fajr,maghrib"
            }
          },
          {
            "name": "method",
            "in": "query",
            "required": false,
            "description": "Calculation method.",
            "schema": {
              "type": "string",
              "enum": [
                "kemenag",
                "mwl",
                "isna",
                "egypt",
                "makkah",
                "karachi",
                "jakim",
                "muis",
                "diyanet"
              ],
              "default": "kemenag"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "text/calendar",
            "content": {
              "text/calendar": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cities": {
      "get": {
        "tags": [
          "Cities"
        ],
        "operationId": "searchCities",
        "summary": "Search the 514 Indonesian kabupaten and kota",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Name to search.",
            "schema": {
              "type": "string",
              "example": "banjar"
            }
          },
          {
            "name": "province",
            "in": "query",
            "required": false,
            "description": "Exact province name.",
            "schema": {
              "type": "string",
              "example": "Kalimantan Selatan"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Max results.",
            "schema": {
              "type": "integer",
              "default": 10,
              "maximum": 600
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CityList"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/cities/{city}": {
      "get": {
        "tags": [
          "Cities"
        ],
        "operationId": "getCity",
        "summary": "One city",
        "parameters": [
          {
            "name": "city",
            "in": "path",
            "required": true,
            "description": "City slug (`banjarbaru`, `kab-bogor`) or Kemendagri code (`63.72`).",
            "schema": {
              "type": "string",
              "example": "banjarbaru"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/City"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/locate": {
      "get": {
        "tags": [
          "Meta"
        ],
        "operationId": "locate",
        "summary": "Where we think the caller is, from their IP",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/v1/methods": {
      "get": {
        "tags": [
          "Meta"
        ],
        "operationId": "listMethods",
        "summary": "Calculation methods and their angles",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "example": "city_not_found"
              },
              "message": {
                "type": "string"
              },
              "docs": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "City": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "63.72"
          },
          "slug": {
            "type": "string",
            "example": "banjarbaru"
          },
          "name": {
            "type": "string",
            "example": "Kota Banjarbaru"
          },
          "type": {
            "type": "string",
            "enum": [
              "kota",
              "kabupaten"
            ]
          },
          "province": {
            "type": "string",
            "example": "Kalimantan Selatan"
          },
          "capital": {
            "type": "string"
          },
          "latitude": {
            "type": "number"
          },
          "longitude": {
            "type": "number"
          },
          "elevation": {
            "type": "number"
          },
          "timezone": {
            "type": "string",
            "example": "Asia/Makassar"
          },
          "population": {
            "type": [
              "integer",
              "null"
            ]
          },
          "url": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "slug",
          "name",
          "type",
          "province",
          "capital",
          "latitude",
          "longitude",
          "elevation",
          "timezone",
          "population",
          "url"
        ]
      },
      "CityList": {
        "type": "object",
        "properties": {
          "count": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          },
          "provinces": {
            "type": "integer"
          },
          "cities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/City"
            }
          }
        },
        "required": [
          "count",
          "total",
          "provinces",
          "cities"
        ]
      },
      "Location": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "slug": {
            "type": [
              "string",
              "null"
            ]
          },
          "province": {
            "type": [
              "string",
              "null"
            ]
          },
          "latitude": {
            "type": "number"
          },
          "longitude": {
            "type": "number"
          },
          "elevation": {
            "type": "number"
          },
          "timezone": {
            "type": "string"
          },
          "timezone_abbr": {
            "type": [
              "string",
              "null"
            ],
            "example": "WITA"
          }
        },
        "required": [
          "name",
          "slug",
          "province",
          "latitude",
          "longitude",
          "elevation",
          "timezone",
          "timezone_abbr"
        ]
      },
      "Times": {
        "type": "object",
        "properties": {
          "imsak": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{2}:\\d{2}$",
            "example": "04:29"
          },
          "fajr": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{2}:\\d{2}$",
            "example": "04:29"
          },
          "sunrise": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{2}:\\d{2}$",
            "example": "04:29"
          },
          "dhuha": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{2}:\\d{2}$",
            "example": "04:29"
          },
          "dhuhr": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{2}:\\d{2}$",
            "example": "04:29"
          },
          "asr": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{2}:\\d{2}$",
            "example": "04:29"
          },
          "maghrib": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{2}:\\d{2}$",
            "example": "04:29"
          },
          "isha": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^\\d{2}:\\d{2}$",
            "example": "04:29"
          }
        },
        "required": [
          "imsak",
          "fajr",
          "sunrise",
          "dhuha",
          "dhuhr",
          "asr",
          "maghrib",
          "isha"
        ]
      },
      "Timestamps": {
        "type": "object",
        "properties": {
          "imsak": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "example": "2026-11-11T04:29:00+08:00"
          },
          "fajr": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "example": "2026-11-11T04:29:00+08:00"
          },
          "sunrise": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "example": "2026-11-11T04:29:00+08:00"
          },
          "dhuha": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "example": "2026-11-11T04:29:00+08:00"
          },
          "dhuhr": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "example": "2026-11-11T04:29:00+08:00"
          },
          "asr": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "example": "2026-11-11T04:29:00+08:00"
          },
          "maghrib": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "example": "2026-11-11T04:29:00+08:00"
          },
          "isha": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "example": "2026-11-11T04:29:00+08:00"
          }
        },
        "required": [
          "imsak",
          "fajr",
          "sunrise",
          "dhuha",
          "dhuhr",
          "asr",
          "maghrib",
          "isha"
        ]
      },
      "Hijri": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "example": "1448-05-20"
          },
          "day": {
            "type": "integer"
          },
          "month": {
            "type": "integer"
          },
          "month_name": {
            "type": "string"
          },
          "year": {
            "type": "integer"
          },
          "text": {
            "type": "string",
            "example": "20 Jumadil Awal 1448 H"
          }
        },
        "required": [
          "date",
          "day",
          "month",
          "month_name",
          "year",
          "text"
        ]
      },
      "NextPrayer": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "enum": [
              "fajr",
              "dhuhr",
              "asr",
              "maghrib",
              "isha"
            ]
          },
          "name": {
            "type": "string",
            "example": "Ashar"
          },
          "date": {
            "type": "string"
          },
          "time": {
            "type": "string"
          },
          "timestamp": {
            "type": "string"
          },
          "epoch": {
            "type": "integer"
          },
          "in_seconds": {
            "type": "integer"
          }
        },
        "required": [
          "key",
          "name",
          "date",
          "time",
          "timestamp",
          "epoch",
          "in_seconds"
        ]
      },
      "Next": {
        "type": "object",
        "properties": {
          "location": {
            "$ref": "#/components/schemas/Location"
          },
          "now": {
            "type": "string"
          },
          "next": {
            "$ref": "#/components/schemas/NextPrayer"
          }
        },
        "required": [
          "location",
          "now",
          "next"
        ]
      },
      "DaySchedule": {
        "type": "object",
        "properties": {
          "location": {
            "$ref": "#/components/schemas/Location"
          },
          "method": {
            "type": "object"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "weekday": {
            "type": "string",
            "example": "Rabu"
          },
          "hijri": {
            "$ref": "#/components/schemas/Hijri"
          },
          "utc_offset": {
            "type": "string",
            "example": "+08:00"
          },
          "times": {
            "$ref": "#/components/schemas/Times"
          },
          "timestamps": {
            "$ref": "#/components/schemas/Timestamps"
          },
          "next": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/NextPrayer"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "location",
          "method",
          "date",
          "weekday",
          "hijri",
          "utc_offset",
          "times",
          "timestamps",
          "next"
        ]
      }
    }
  }
}